diff --git a/.env.example b/.env.example
new file mode 100644
index 00000000..8f55cbd3
--- /dev/null
+++ b/.env.example
@@ -0,0 +1 @@
+PORT=
\ No newline at end of file
diff --git a/server/.env.sample b/.env.sample
similarity index 100%
rename from server/.env.sample
rename to .env.sample
diff --git a/README.md b/README.md
index e69de29b..d510adcb 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,88 @@
+# API Documentation
+
+This documentation provides an overview of the available routes and data models for the Cohort Tools API.
+
+Throughout the project, you should use this documentation as a reference and a guide. Refer to it whenever you need information or more details on how to implement the routes or model your database.
+
+
+
+## Routes
+
+In this section, you will find detailed information about the different routes available in the API.
+The API offers a variety of routes to work with *cohort* and *student* documents. Each route is associated with a specific HTTP verb and URL, allowing you to perform CRUD (Create, Read, Update, and Delete) actions on the data.
+
+
+
+#### Cohort routes
+
+| HTTP verb | URL | Request body | Action |
+| --------- | -------------------------- | ------------ | -------------------------------------- |
+| GET | `/api/cohorts` | (empty) | Returns all the cohorts in JSON format |
+| GET | `/api/cohorts/:cohortId` | (empty) | Returns the specified cohort by id |
+| POST | `/api/cohorts` | JSON | Creates a new cohort |
+| PUT | `/api/cohorts/:cohortId` | JSON | Updates the specified cohort by id |
+| DELETE | `/api/cohorts/:cohortId` | (empty) | Deletes the specified cohort by id |
+
+
+
+
+#### Student routes
+
+| HTTP verb | URL | Request body | Action |
+| --------- | --------------------------------- | ------------ | -------------------------------------------------------------- |
+| GET | `/api/students` | (empty) | Returns all the students in JSON format |
+| GET | `/api/students/cohort/:cohortId` | (empty) | Returns all the students of a specified cohort in JSON format |
+| GET | `/api/students/:studentId` | (empty) | Returns the specified student by id |
+| POST | `/api/students` | JSON | Creates a new student **with their respective cohort id** |
+| PUT | `/api/students/:studentId` | JSON | Updates the specified student by id |
+| DELETE | `/api/students/:studentId` | (empty) | Deletes the specified cohort by id |
+
+
+
+
+
+
+## Models
+
+The *Models* section holds information about the data models for your database. It outlines the structure of the documents in the database, providing you with a clear understanding of how your data should be organized.
+
+
+
+#### Cohort Model
+
+| Field | Data Type | Description |
+|----------------|------------------|---------------------------------------------|
+| `cohortSlug` | *`String`* | Unique identifier for the cohort. Required. |
+| `cohortName` | *`String`* | Name of the cohort. Required. |
+| `program` | *`String`* | Program/course name. Allowed values: "Web Dev", "UX/UI", "Data Analytics", "Cybersecurity". |
+| `format` | *`String`* | Format of the cohort. Allowed values: "Full Time", "Part Time". |
+| `campus` | *`String`* | Campus location. Allowed values: "Madrid", "Barcelona", "Miami", "Paris", "Berlin", "Amsterdam", "Lisbon", "Remote". |
+| `startDate` | *`Date`* | Start date of the cohort. Default: Current date. |
+| `endDate` | *`Date`* | End date of the cohort. |
+| `inProgress` | *`Boolean`* | Indicates if the cohort is currently in progress. Default: false. |
+| `programManager` | *`String`* | Name of the program manager. Required. |
+| `leadTeacher` | *`String`* | Name of the lead teacher. Required. |
+| `totalHours` | *`Number`* | Total hours of the cohort program. Default: 360. |
+
+
+
+
+#### Student Model
+
+| Field | Data Type | Description |
+|--------------|--------------------------------------|----------------------------------------------|
+| `firstName` | *`String`* | First name of the student. Required. |
+| `lastName` | *`String`* | Last name of the student. Required. |
+| `email` | *`String`* | Email address of the student. Required, unique. |
+| `phone` | *`String`* | Phone number of the student. Required. |
+| `linkedinUrl` | *`String`* | URL to the student's LinkedIn profile. Default: Empty string. |
+| `languages` | *`Array`* of Strings | Spoken languages of the student. Allowed values: "English", "Spanish", "French", "German", "Portuguese", "Dutch", "Other". |
+| `program` | *`String`* | Type of program the student is enrolled in. Allowed values: "Web Dev", "UX/UI", "Data Analytics", "Cybersecurity". |
+| `background` | *`String`* | Background information about the student. Default: Empty. |
+| `image` | *`String`* | URL to the student's profile image. Default: https://i.imgur.com/r8bo8u7.png . |
+| `cohort` | *`ObjectId`*, | Reference *_id* of the cohort the student belongs to. |
+| `projects` | *`Array`* | Array of the student's projects. |
+
+
+
+
diff --git a/app.js b/app.js
new file mode 100644
index 00000000..41db2953
--- /dev/null
+++ b/app.js
@@ -0,0 +1,247 @@
+process.loadEnvFile();
+// Express framework for creating the server and routes
+const express = require("express");
+// STATIC DATA
+// CREATE EXPRESS APPLICATION
+const app = express();
+
+// Morgan logs HTTP requests in the terminal
+// const morgan = require("morgan");
+
+// Helps read cookies sent by the browser
+const cookieParser = require("cookie-parser");
+
+// Mongoose allows Node.js to communicate with MongoDB
+// const mongoose = require("mongoose");
+
+// Enables communication between frontend and backend on different ports/domains
+const cors = require("cors");
+
+//* DEFINE SERVER PORT
+// The backend server will run on port 5005
+// const PORT = 5005;
+
+// IMPORT DATABASE MODELS
+// These models represent collections in MongoDB
+const Cohort = require("./models/Cohort.model");
+const Student = require("./models/Student.model");
+
+//* MIDDLEWARE
+// Research Team - Set up CORS middleware here:
+const config = require("./config");
+config(app);
+
+// Enable CORS so frontend apps can access this API
+// app.use(cors());
+
+//* Connect to MongoDB database
+//We import DB from its dedicated folder (db)
+const connectDB = require("./db");
+app.use(async (req, res, next) => {
+ await connectDB();
+ next();
+});
+// mongoose.connect("mongodb://127.0.0.1:27017/cohort-tools-api")
+// Runs if connection is successful
+// .then((x) => console.log(`Connected to Database: "${x.connections[0].name}"`))
+
+// Runs if there is a database connection error
+// .catch((err) => console.error("Error connecting to MongoDB", err));
+
+// Parse incoming JSON data from requests
+app.use(express.json());
+
+// Log requests in the terminal
+// app.use(morgan("dev"));
+
+// Makes files inside the "public" folder accessible
+app.use(express.static("public"));
+
+// Parses URL-encoded form data
+// Useful when data comes from HTML forms
+app.use(express.urlencoded({ extended: false }));
+
+// Allows reading cookies from requests
+app.use(cookieParser());
+
+// ROUTES - https://expressjs.com/en/starter/basic-routing.html
+// Devs Team - Start working on the routes here:
+//* TEST ROUTE
+// Sends the docs.html file when user visits /docs
+app.get("/docs", (req, res) => {
+ // __dirname = current folder location
+ // res.sendFile(__dirname + "/views/docs.html");
+ res.status(200).json({ message: "looking perfect already" });
+});
+
+app.get("/api/test", (req, res, next) => {
+ console.log(req.body); // when we receive a lot of data, usually for document creation or updates
+ console.log(req.query); // when we are trying to search or filter data
+ console.log(req.params); // when we are passings ids, usually for getting the details of a specific document, updating or deleting a specific document
+
+ res.status(200).json({ message: "perfectly working fine" });
+});
+
+app.get("/", (req, res, next) => {
+ res.json("Testing");
+});
+
+// GET ALL COHORTS
+// Route: GET /cohorts
+app.get("/api/cohorts", async (req, res) => {
+ try {
+ const response = await Cohort.find({ awardsWon: { $gte: 200 } }).select({
+ name: 1,
+ awardsWon: 1,
+ });
+ console.log(response);
+
+ if (response.length === 0) {
+ res.status(204).json(response);
+ } else {
+ res.status(200).json(response);
+ }
+ } catch (error) {
+ console.log(error);
+ }
+});
+
+// this is to create a new student
+app.post("/cohorts", async (req, res) => {
+ try {
+ const newCohort = {
+ cohortSlug: req.body.cohortSlug,
+ cohortName: req.body.cohortName,
+ program: req.body.program,
+ campus: req.body.campus,
+ startDate: req.body.startDate,
+ endDate: req.body.endDate,
+ };
+ const response = await Cohort.create(newCohort);
+ res.status(200).json(response);
+ console.log("new cohort created");
+ } catch (error) {
+ console.log(error);
+ }
+});
+
+// this is to update the student
+app.patch("/cohorts/:cohortId", async (req, res) => {
+ try {
+ const updatedCohort = {
+ cohortSlug: req.body.cohortSlug,
+ cohortName: req.body.cohortName,
+ program: req.body.program,
+ campus: req.body.campus,
+ startDate: req.body.startDate,
+ endDate: req.body.endDate,
+ };
+ const response = await Cohort.findByIdAndUpdate(
+ req.params.cohortId,
+ updatedCohort,
+ { new: true },
+ );
+ res.status(200).json(response);
+ console.log("new cohort updated");
+ } catch (error) {
+ console.log(error);
+ }
+});
+
+// this is to delete a student
+app.delete("/cohorts/:cohortId", async (req, res) => {
+ try {
+ const response = await Cohort.findByIdAndDelete(req.params.cohortId);
+ res.sendStatus(200);
+ console.log("cohort deleted");
+ } catch (error) {
+ console.log(error);
+ }
+});
+
+// GET ALL STUDENTS
+// Route: GET /students
+app.get("/", (req, res) => {
+ try {
+ res.json({ message: "all is good you are connecting to " });
+ } catch (err) {
+ console.log(error);
+ }
+});
+app.get("/students", async (req, res) => {
+ try {
+ const response = await Student.find();
+ console.log("Retrieved students ->", response);
+ res.status(200).json(response);
+ } catch (error) {
+ console.log(error);
+ }
+});
+
+// this is to create a new student
+app.post("/students", async (req, res) => {
+ try {
+ const newStudent = {
+ firstName: req.body.firstName,
+ lastName: req.body.lastName,
+ email: req.body.email,
+ phone: req.body.phone,
+ linkedinUrl: req.body.linkedinUrl,
+ program: req.body.proram,
+ background: req.body.background,
+ image: req.body.image,
+ cohort: req.body.cohort,
+ };
+ const response = await Student.create(newStudent);
+ res.status(200).json(response);
+ console.log("new student created");
+ } catch (error) {
+ console.log(error);
+ }
+});
+
+// this is to update the student
+app.patch("/students/:studentId", async (req, res) => {
+ try {
+ const updatedStudent = {
+ firstName: req.body.firstName,
+ lastName: req.body.lastName,
+ email: req.body.email,
+ phone: req.body.phone,
+ linkedinUrl: req.body.linkedinUrl,
+ program: req.body.proram,
+ background: req.body.background,
+ image: req.body.image,
+ };
+ const response = await Student.findByIdAndUpdate(
+ req.params.studentId,
+ updatedStudent,
+ { new: true },
+ );
+ res.status(200).json(response);
+ console.log("new student updated");
+ } catch (error) {
+ console.log(error);
+ }
+});
+
+// this is to delete a student
+app.delete("/students/:studentId", async (req, res) => {
+ try {
+ const response = await Student.findByIdAndDelete(req.params.studentId);
+ res.sendStatus(200);
+ console.log("student deleted");
+ } catch (error) {
+ console.log(error);
+ }
+});
+
+const indexRouter = require("./routes/index.routes");
+app.use("/api", indexRouter);
+// server listen & PORT
+
+// Start server
+const PORT = process.env.PORT || 5006;
+app.listen(PORT, () => {
+ console.log(`Server listening on http://localhost:${PORT}`);
+});
diff --git a/config/index.js b/config/index.js
new file mode 100644
index 00000000..d27fe1b0
--- /dev/null
+++ b/config/index.js
@@ -0,0 +1,26 @@
+const express = require("express");
+const logger = require("morgan");
+const cors = require("cors");
+
+// Middleware configuration | Enables Express to trust reverse proxies (e.g., when deployed behind services like Heroku or Vercel)
+function config(app) {
+ app.set("trust proxy", 1);
+
+ // CORS to allow requests only from the specified origin
+ app.use(
+ cors({
+ origin: [process.env.ORIGIN],
+ }),
+ );
+
+ // Logs requests in the development environment
+ app.use(logger("dev"));
+
+ // Parses incoming JSON requests
+ app.use(express.json());
+
+ // Parses incoming request bodies with URL-encoded data (form submissions)
+ app.use(express.urlencoded({ extended: false }));
+}
+
+module.exports = config;
diff --git a/db/index.js b/db/index.js
new file mode 100644
index 00000000..c658c736
--- /dev/null
+++ b/db/index.js
@@ -0,0 +1,18 @@
+const mongoose = require("mongoose");
+
+// Checks if a DB connection is already present. Prevents duplicate connections on serverless deployments like Vercel.
+async function connectDB() {
+ if (mongoose.connection.readyState === 1) {
+ return;
+ }
+
+ try {
+ const response = await mongoose.connect(process.env.MONGODB_URI);
+ const dbName = response.connections[0].name;
+ console.log(`Connected to Mongo! Database name: "${dbName}"`);
+ } catch (err) {
+ console.error("Error connecting to mongo: ", err);
+ }
+}
+
+module.exports = connectDB;
diff --git a/models/Cohort.model.js b/models/Cohort.model.js
new file mode 100644
index 00000000..1b88fa70
--- /dev/null
+++ b/models/Cohort.model.js
@@ -0,0 +1,12 @@
+const mongoose = require("mongoose");
+
+const cohortSchema = new mongoose.Schema({
+ cohortSlug: String,
+ cohortName: String,
+ program: String,
+ campus: String,
+ startDate: Date,
+ endDate: Date,
+});
+
+module.exports = mongoose.model("Cohort", cohortSchema);
\ No newline at end of file
diff --git a/models/Student.model.js b/models/Student.model.js
new file mode 100644
index 00000000..ec72ef0f
--- /dev/null
+++ b/models/Student.model.js
@@ -0,0 +1,18 @@
+const mongoose = require("mongoose");
+
+const studentSchema = new mongoose.Schema({
+ firstName: String,
+ lastName: String,
+ email: String,
+ phone: String,
+ linkedinUrl: String,
+ program: String,
+ background: String,
+ image: String,
+ cohort:{
+ type:mongoose.Schema.Types.ObjectId,
+ ref:"Cohort"
+ }
+});
+
+module.exports = mongoose.model("Student", studentSchema);
\ No newline at end of file
diff --git a/models/User.model.js b/models/User.model.js
new file mode 100644
index 00000000..fb624429
--- /dev/null
+++ b/models/User.model.js
@@ -0,0 +1,27 @@
+const { Schema, model } = require("mongoose");
+
+const userSchema = new Schema(
+ {
+ email: {
+ type: String,
+ required: [true, "Email is required!"],
+ unique: true,
+ lowercase: true,
+ trim: true,
+ },
+
+ password: {
+ type: String,
+ required: [true, "Password is required."],
+ },
+ username: String,
+ },
+ {
+ // this second object adds extra properties: `createdAt` and `updatedAt`
+ timestamps: true,
+ },
+);
+
+const User = model("User", userSchema);
+
+module.exports = User;
diff --git a/server/package-lock.json b/node_modules/.package-lock.json
similarity index 53%
rename from server/package-lock.json
rename to node_modules/.package-lock.json
index 23e2f78a..d71c7489 100644
--- a/server/package-lock.json
+++ b/node_modules/.package-lock.json
@@ -4,15 +4,28 @@
"lockfileVersion": 3,
"requires": true,
"packages": {
- "": {
- "name": "cohort-tools-api",
- "version": "1.0.0",
- "license": "ISC",
+ "node_modules/@mongodb-js/saslprep": {
+ "version": "1.4.11",
+ "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.4.11.tgz",
+ "integrity": "sha512-o9rAHc0IpIjuPSxRutWpE1F62x7n+4mVS4rCNHkzhIUMQcc18bb6xEq5wd2NdN0WjepIyXIppRshYI2kQDOZVA==",
+ "license": "MIT",
+ "dependencies": {
+ "sparse-bitfield": "^3.0.3"
+ }
+ },
+ "node_modules/@types/webidl-conversions": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
+ "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==",
+ "license": "MIT"
+ },
+ "node_modules/@types/whatwg-url": {
+ "version": "13.0.0",
+ "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz",
+ "integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==",
+ "license": "MIT",
"dependencies": {
- "cookie-parser": "^1.4.6",
- "express": "^4.18.2",
- "morgan": "^1.10.0",
- "nodemon": "^3.0.1"
+ "@types/webidl-conversions": "*"
}
},
"node_modules/abbrev": {
@@ -70,6 +83,15 @@
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
+ "node_modules/bcryptjs": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-3.0.3.tgz",
+ "integrity": "sha512-GlF5wPWnSa/X5LKM1o0wz0suXIINz1iHRLvTS+sLyi7XPbe5ycmYI3DlZqVGZZtDgl4DmasFg7gOB3JYbphV5g==",
+ "license": "BSD-3-Clause",
+ "bin": {
+ "bcrypt": "bin/bcrypt"
+ }
+ },
"node_modules/binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@@ -79,22 +101,23 @@
}
},
"node_modules/body-parser": {
- "version": "1.20.1",
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
- "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
+ "version": "1.20.5",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz",
+ "integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==",
+ "license": "MIT",
"dependencies": {
- "bytes": "3.1.2",
- "content-type": "~1.0.4",
+ "bytes": "~3.1.2",
+ "content-type": "~1.0.5",
"debug": "2.6.9",
"depd": "2.0.0",
- "destroy": "1.2.0",
- "http-errors": "2.0.0",
- "iconv-lite": "0.4.24",
- "on-finished": "2.4.1",
- "qs": "6.11.0",
- "raw-body": "2.5.1",
+ "destroy": "~1.2.0",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "on-finished": "~2.4.1",
+ "qs": "~6.15.1",
+ "raw-body": "~2.5.3",
"type-is": "~1.6.18",
- "unpipe": "1.0.0"
+ "unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8",
@@ -102,40 +125,75 @@
}
},
"node_modules/brace-expansion": {
- "version": "1.1.11",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
- "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "version": "1.1.14",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz",
+ "integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==",
+ "license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/braces": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
- "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "license": "MIT",
"dependencies": {
- "fill-range": "^7.0.1"
+ "fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
}
},
+ "node_modules/bson": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/bson/-/bson-7.2.0.tgz",
+ "integrity": "sha512-YCEo7KjMlbNlyHhz7zAZNDpIpQbd+wOEHJYezv0nMYTn4x31eIUM2yomNNubclAt63dObUzKHWsBLJ9QcZNSnQ==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=20.19.0"
+ }
+ },
+ "node_modules/buffer-equal-constant-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
+ "license": "BSD-3-Clause"
+ },
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+ "license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
- "node_modules/call-bind": {
+ "node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
- "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
- "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/call-bound": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
+ "license": "MIT",
"dependencies": {
- "function-bind": "^1.1.1",
- "get-intrinsic": "^1.0.2"
+ "call-bind-apply-helpers": "^1.0.2",
+ "get-intrinsic": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -187,24 +245,27 @@
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+ "license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
- "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==",
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-parser": {
- "version": "1.4.6",
- "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz",
- "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==",
+ "version": "1.4.7",
+ "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz",
+ "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==",
+ "license": "MIT",
"dependencies": {
- "cookie": "0.4.1",
+ "cookie": "0.7.2",
"cookie-signature": "1.0.6"
},
"engines": {
@@ -216,6 +277,23 @@
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
},
+ "node_modules/cors": {
+ "version": "2.8.6",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz",
+ "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",
+ "license": "MIT",
+ "dependencies": {
+ "object-assign": "^4",
+ "vary": "^1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
"node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
@@ -236,90 +314,145 @@
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
+ "license": "MIT",
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/ecdsa-sig-formatter": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+ "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/encodeurl": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
- "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+ "license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
- "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+ "license": "MIT"
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
- "version": "4.18.2",
- "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
- "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
+ "version": "4.22.2",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz",
+ "integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==",
+ "license": "MIT",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
- "body-parser": "1.20.1",
- "content-disposition": "0.5.4",
+ "body-parser": "~1.20.5",
+ "content-disposition": "~0.5.4",
"content-type": "~1.0.4",
- "cookie": "0.5.0",
- "cookie-signature": "1.0.6",
+ "cookie": "~0.7.1",
+ "cookie-signature": "~1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
- "finalhandler": "1.2.0",
- "fresh": "0.5.2",
- "http-errors": "2.0.0",
- "merge-descriptors": "1.0.1",
+ "finalhandler": "~1.3.1",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.0",
+ "merge-descriptors": "1.0.3",
"methods": "~1.1.2",
- "on-finished": "2.4.1",
+ "on-finished": "~2.4.1",
"parseurl": "~1.3.3",
- "path-to-regexp": "0.1.7",
+ "path-to-regexp": "~0.1.12",
"proxy-addr": "~2.0.7",
- "qs": "6.11.0",
+ "qs": "~6.15.1",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
- "send": "0.18.0",
- "serve-static": "1.15.0",
+ "send": "~0.19.0",
+ "serve-static": "~1.16.2",
"setprototypeof": "1.2.0",
- "statuses": "2.0.1",
+ "statuses": "~2.0.1",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.10.0"
- }
- },
- "node_modules/express/node_modules/cookie": {
- "version": "0.5.0",
- "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
- "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
- "engines": {
- "node": ">= 0.6"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
}
},
"node_modules/fill-range": {
- "version": "7.0.1",
- "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
- "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "license": "MIT",
"dependencies": {
"to-regex-range": "^5.0.1"
},
@@ -328,16 +461,17 @@
}
},
"node_modules/finalhandler": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
- "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
+ "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
+ "license": "MIT",
"dependencies": {
"debug": "2.6.9",
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
- "on-finished": "2.4.1",
+ "on-finished": "~2.4.1",
"parseurl": "~1.3.3",
- "statuses": "2.0.1",
+ "statuses": "~2.0.2",
"unpipe": "~1.0.0"
},
"engines": {
@@ -356,6 +490,7 @@
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
+ "license": "MIT",
"engines": {
"node": ">= 0.6"
}
@@ -374,24 +509,51 @@
}
},
"node_modules/function-bind": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
},
"node_modules/get-intrinsic": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
- "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "license": "MIT",
"dependencies": {
- "function-bind": "^1.1.1",
- "has": "^1.0.3",
- "has-proto": "^1.0.1",
- "has-symbols": "^1.0.3"
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
@@ -403,15 +565,16 @@
"node": ">= 6"
}
},
- "node_modules/has": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
- "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
- "dependencies": {
- "function-bind": "^1.1.1"
- },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "license": "MIT",
"engines": {
- "node": ">= 0.4.0"
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-flag": {
@@ -422,10 +585,11 @@
"node": ">=4"
}
},
- "node_modules/has-proto": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
- "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "license": "MIT",
"engines": {
"node": ">= 0.4"
},
@@ -433,36 +597,43 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/has-symbols": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
- "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
+ "node_modules/hasown": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz",
+ "integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
"engines": {
"node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/http-errors": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
- "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
+ "license": "MIT",
"dependencies": {
- "depd": "2.0.0",
- "inherits": "2.0.4",
- "setprototypeof": "1.2.0",
- "statuses": "2.0.1",
- "toidentifier": "1.0.1"
+ "depd": "~2.0.0",
+ "inherits": "~2.0.4",
+ "setprototypeof": "~1.2.0",
+ "statuses": "~2.0.2",
+ "toidentifier": "~1.0.1"
},
"engines": {
"node": ">= 0.8"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
@@ -478,7 +649,8 @@
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "license": "ISC"
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
@@ -522,10 +694,111 @@
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "license": "MIT",
"engines": {
"node": ">=0.12.0"
}
},
+ "node_modules/jsonwebtoken": {
+ "version": "9.0.3",
+ "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz",
+ "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==",
+ "license": "MIT",
+ "dependencies": {
+ "jws": "^4.0.1",
+ "lodash.includes": "^4.3.0",
+ "lodash.isboolean": "^3.0.3",
+ "lodash.isinteger": "^4.0.4",
+ "lodash.isnumber": "^3.0.3",
+ "lodash.isplainobject": "^4.0.6",
+ "lodash.isstring": "^4.0.1",
+ "lodash.once": "^4.0.0",
+ "ms": "^2.1.1",
+ "semver": "^7.5.4"
+ },
+ "engines": {
+ "node": ">=12",
+ "npm": ">=6"
+ }
+ },
+ "node_modules/jsonwebtoken/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/jwa": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz",
+ "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer-equal-constant-time": "^1.0.1",
+ "ecdsa-sig-formatter": "1.0.11",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/jws": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz",
+ "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==",
+ "license": "MIT",
+ "dependencies": {
+ "jwa": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/kareem": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/kareem/-/kareem-3.3.0.tgz",
+ "integrity": "sha512-kpSuLD3/7RenBnjnJdOHXCKC8dTd1JzeOiJhN0necWWci6cC+qX+VuwPnMVgb+a4+KNJSfgqahpnfWaeDXCimw==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/lodash.includes": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
+ "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isboolean": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
+ "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isinteger": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
+ "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isnumber": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
+ "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isplainobject": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
+ "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isstring": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
+ "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.once": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
+ "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==",
+ "license": "MIT"
+ },
"node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@@ -537,18 +810,38 @@
"node": ">=10"
}
},
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
+ "license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
+ "node_modules/memory-pager": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
+ "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
+ "license": "MIT"
+ },
"node_modules/merge-descriptors": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
- "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
},
"node_modules/methods": {
"version": "1.1.2",
@@ -562,6 +855,7 @@
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "license": "MIT",
"bin": {
"mime": "cli.js"
},
@@ -589,9 +883,10 @@
}
},
"node_modules/minimatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
+ "license": "ISC",
"dependencies": {
"brace-expansion": "^1.1.7"
},
@@ -599,16 +894,103 @@
"node": "*"
}
},
+ "node_modules/mongodb": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.2.0.tgz",
+ "integrity": "sha512-F/2+BMZtLVhY30ioZp0dAmZ+IRZMBqI+nrv6t5+9/1AIwCa8sMRC3jBf81lpxMhnZgqq8CoUD503Z1oZWq1/sw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@mongodb-js/saslprep": "^1.3.0",
+ "bson": "^7.2.0",
+ "mongodb-connection-string-url": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=20.19.0"
+ },
+ "peerDependencies": {
+ "@aws-sdk/credential-providers": "^3.806.0",
+ "@mongodb-js/zstd": "^7.0.0",
+ "gcp-metadata": "^7.0.1",
+ "kerberos": "^7.0.0",
+ "mongodb-client-encryption": ">=7.0.0 <7.1.0",
+ "snappy": "^7.3.2",
+ "socks": "^2.8.6"
+ },
+ "peerDependenciesMeta": {
+ "@aws-sdk/credential-providers": {
+ "optional": true
+ },
+ "@mongodb-js/zstd": {
+ "optional": true
+ },
+ "gcp-metadata": {
+ "optional": true
+ },
+ "kerberos": {
+ "optional": true
+ },
+ "mongodb-client-encryption": {
+ "optional": true
+ },
+ "snappy": {
+ "optional": true
+ },
+ "socks": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/mongodb-connection-string-url": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.1.tgz",
+ "integrity": "sha512-h0AZ9A7IDVwwHyMxmdMXKy+9oNlF0zFoahHiX3vQ8e3KFcSP3VmsmfvtRSuLPxmyv2vjIDxqty8smTgie/SNRQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@types/whatwg-url": "^13.0.0",
+ "whatwg-url": "^14.1.0"
+ },
+ "engines": {
+ "node": ">=20.19.0"
+ }
+ },
+ "node_modules/mongoose": {
+ "version": "9.6.2",
+ "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-9.6.2.tgz",
+ "integrity": "sha512-7m8HntjkoRnwEmuPC0kdlwcZXJOQf4twumFj+PNzg/anqqZE2Er7hQslqyzy07mP3JcFjoTSgH5765PyqOXsxw==",
+ "license": "MIT",
+ "dependencies": {
+ "kareem": "3.3.0",
+ "mongodb": "~7.2",
+ "mpath": "0.9.0",
+ "mquery": "6.0.0",
+ "ms": "2.1.3",
+ "sift": "17.1.3"
+ },
+ "engines": {
+ "node": ">=20.19.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/mongoose"
+ }
+ },
+ "node_modules/mongoose/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
"node_modules/morgan": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
- "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==",
+ "version": "1.10.1",
+ "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.1.tgz",
+ "integrity": "sha512-223dMRJtI/l25dJKWpgij2cMtywuG/WiUKXdvwfbhGKBhy1puASqXwFzmWZ7+K73vUPoR7SS2Qz2cI/g9MKw0A==",
+ "license": "MIT",
"dependencies": {
"basic-auth": "~2.0.1",
"debug": "2.6.9",
"depd": "~2.0.0",
"on-finished": "~2.3.0",
- "on-headers": "~1.0.2"
+ "on-headers": "~1.1.0"
},
"engines": {
"node": ">= 0.8.0"
@@ -625,6 +1007,24 @@
"node": ">= 0.8"
}
},
+ "node_modules/mpath": {
+ "version": "0.9.0",
+ "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
+ "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/mquery": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/mquery/-/mquery-6.0.0.tgz",
+ "integrity": "sha512-b2KQNsmgtkscfeDgkYMcWGn9vZI9YoXh802VDEwE6qc50zxBFQ0Oo8ROkawbPAsXCY1/Z1yp0MagqsZStPWJjw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=20.19.0"
+ }
+ },
"node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
@@ -700,10 +1100,23 @@
"node": ">=0.10.0"
}
},
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/object-inspect": {
- "version": "1.12.3",
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
- "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
+ "version": "1.13.4",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -712,6 +1125,7 @@
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+ "license": "MIT",
"dependencies": {
"ee-first": "1.1.1"
},
@@ -720,9 +1134,10 @@
}
},
"node_modules/on-headers": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
- "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz",
+ "integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==",
+ "license": "MIT",
"engines": {
"node": ">= 0.8"
}
@@ -731,19 +1146,22 @@
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
- "version": "0.1.7",
- "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
- "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
+ "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
+ "license": "MIT"
},
"node_modules/picomatch": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
- "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
+ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
+ "license": "MIT",
"engines": {
"node": ">=8.6"
},
@@ -768,12 +1186,22 @@
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
"integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w=="
},
+ "node_modules/punycode": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/qs": {
- "version": "6.11.0",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
- "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
+ "version": "6.15.2",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz",
+ "integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==",
+ "license": "BSD-3-Clause",
"dependencies": {
- "side-channel": "^1.0.4"
+ "side-channel": "^1.1.0"
},
"engines": {
"node": ">=0.6"
@@ -786,19 +1214,21 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
- "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
+ "version": "2.5.3",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
+ "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
+ "license": "MIT",
"dependencies": {
- "bytes": "3.1.2",
- "http-errors": "2.0.0",
- "iconv-lite": "0.4.24",
- "unpipe": "1.0.0"
+ "bytes": "~3.1.2",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
@@ -837,7 +1267,8 @@
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
- "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "license": "MIT"
},
"node_modules/semver": {
"version": "7.5.4",
@@ -854,23 +1285,24 @@
}
},
"node_modules/send": {
- "version": "0.18.0",
- "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
- "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
+ "version": "0.19.2",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
+ "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
+ "license": "MIT",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
- "fresh": "0.5.2",
- "http-errors": "2.0.0",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.1",
"mime": "1.6.0",
"ms": "2.1.3",
- "on-finished": "2.4.1",
+ "on-finished": "~2.4.1",
"range-parser": "~1.2.1",
- "statuses": "2.0.1"
+ "statuses": "~2.0.2"
},
"engines": {
"node": ">= 0.8.0"
@@ -879,17 +1311,19 @@
"node_modules/send/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
},
"node_modules/serve-static": {
- "version": "1.15.0",
- "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
- "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
+ "version": "1.16.3",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
+ "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
+ "license": "MIT",
"dependencies": {
- "encodeurl": "~1.0.2",
+ "encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
- "send": "0.18.0"
+ "send": "~0.19.1"
},
"engines": {
"node": ">= 0.8.0"
@@ -898,21 +1332,87 @@
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
- "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+ "license": "ISC"
},
"node_modules/side-channel": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
- "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
+ "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.3",
+ "side-channel-list": "^1.0.0",
+ "side-channel-map": "^1.0.1",
+ "side-channel-weakmap": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-list": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
+ "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-map": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-weakmap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
+ "license": "MIT",
"dependencies": {
- "call-bind": "^1.0.0",
- "get-intrinsic": "^1.0.2",
- "object-inspect": "^1.9.0"
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3",
+ "side-channel-map": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/sift": {
+ "version": "17.1.3",
+ "resolved": "https://registry.npmjs.org/sift/-/sift-17.1.3.tgz",
+ "integrity": "sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==",
+ "license": "MIT"
+ },
"node_modules/simple-update-notifier": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
@@ -924,10 +1424,20 @@
"node": ">=10"
}
},
+ "node_modules/sparse-bitfield": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
+ "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
+ "license": "MIT",
+ "dependencies": {
+ "memory-pager": "^1.0.2"
+ }
+ },
"node_modules/statuses": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
- "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
+ "license": "MIT",
"engines": {
"node": ">= 0.8"
}
@@ -947,6 +1457,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "license": "MIT",
"dependencies": {
"is-number": "^7.0.0"
},
@@ -958,6 +1469,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+ "license": "MIT",
"engines": {
"node": ">=0.6"
}
@@ -973,10 +1485,23 @@
"nodetouch": "bin/nodetouch.js"
}
},
+ "node_modules/tr46": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz",
+ "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==",
+ "license": "MIT",
+ "dependencies": {
+ "punycode": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+ "license": "MIT",
"dependencies": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
@@ -994,6 +1519,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+ "license": "MIT",
"engines": {
"node": ">= 0.8"
}
@@ -1014,6 +1540,28 @@
"node": ">= 0.8"
}
},
+ "node_modules/webidl-conversions": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+ "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/whatwg-url": {
+ "version": "14.2.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
+ "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==",
+ "license": "MIT",
+ "dependencies": {
+ "tr46": "^5.1.0",
+ "webidl-conversions": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
diff --git a/node_modules/@mongodb-js/saslprep/LICENSE b/node_modules/@mongodb-js/saslprep/LICENSE
new file mode 100644
index 00000000..481c7a50
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2014 Dmitry Tsvettsikh
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/.esm-wrapper.mjs b/node_modules/@mongodb-js/saslprep/dist/.esm-wrapper.mjs
new file mode 100644
index 00000000..0b46bfa6
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/.esm-wrapper.mjs
@@ -0,0 +1,4 @@
+import mod from "./node.js";
+
+export default mod;
+export const saslprep = mod.saslprep;
diff --git a/node_modules/@mongodb-js/saslprep/dist/browser.d.ts b/node_modules/@mongodb-js/saslprep/dist/browser.d.ts
new file mode 100644
index 00000000..1c70d492
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/browser.d.ts
@@ -0,0 +1,5 @@
+declare const saslprep: (input: string, opts?: {
+ allowUnassigned?: boolean;
+} | undefined) => string;
+export = saslprep;
+//# sourceMappingURL=browser.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/browser.d.ts.map b/node_modules/@mongodb-js/saslprep/dist/browser.d.ts.map
new file mode 100644
index 00000000..669fc643
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/browser.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,QAAQ;;wBAAmC,CAAC;AAIlD,SAAS,QAAQ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/browser.js b/node_modules/@mongodb-js/saslprep/dist/browser.js
new file mode 100644
index 00000000..1bedd860
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/browser.js
@@ -0,0 +1,12 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+const index_1 = __importDefault(require("./index"));
+const memory_code_points_1 = require("./memory-code-points");
+const code_points_data_browser_1 = __importDefault(require("./code-points-data-browser"));
+const codePoints = (0, memory_code_points_1.createMemoryCodePoints)(code_points_data_browser_1.default);
+const saslprep = index_1.default.bind(null, codePoints);
+Object.assign(saslprep, { saslprep, default: saslprep });
+module.exports = saslprep;
+//# sourceMappingURL=browser.js.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/browser.js.map b/node_modules/@mongodb-js/saslprep/dist/browser.js.map
new file mode 100644
index 00000000..40edf44b
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/browser.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";;;;AAAA,oDAAgC;AAChC,6DAA8D;AAC9D,0FAA8C;AAE9C,MAAM,UAAU,GAAG,IAAA,2CAAsB,EAAC,kCAAI,CAAC,CAAC;AAEhD,MAAM,QAAQ,GAAG,eAAS,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAElD,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;AAEzD,iBAAS,QAAQ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.d.ts b/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.d.ts
new file mode 100644
index 00000000..85013da3
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.d.ts
@@ -0,0 +1,3 @@
+declare const data: Buffer;
+export default data;
+//# sourceMappingURL=code-points-data-browser.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.d.ts.map b/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.d.ts.map
new file mode 100644
index 00000000..b8369475
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"code-points-data-browser.d.ts","sourceRoot":"","sources":["../src/code-points-data-browser.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,qBAGT,CAAC;AACF,eAAe,IAAI,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.js b/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.js
new file mode 100644
index 00000000..5ea96355
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.js
@@ -0,0 +1,5 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const data = Buffer.from('AAHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAP////AAAAAAAAAAAAAAADAAAAAAAAAAH//wAAAAAAAAAAAAD//wAA893wFAAAIAAAAAABAAAAAAH/AAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAz8AAP////+AAAAAAYCAAAAAAJ+AACAAACAH/wAAAB8H///3/+6AAAAfAAAD/wAAAAAAAAAAAAAAAAAAAAAAAwABAAIAAAAHAAAAH////////wAAAAAAAD///////////////////////////////////////////////////////4gAAAAAAAAwAAMHAAAAf/+IBmAAAEBcNAZj/vIMAAAf2B5gAABASTQeY/+F/AAH/4gKIAAAQEgwAiN//3wA//+IBmAAAEBMMA5j/PI8AH//yBxDlOccAjwcQ/7//gAf/4gEQAAAQAg8BEP5/zwA///IBEAAAEAIPARD+f08AP//yARAAABAADwMQ/7/PAD//8gAAcAAACALAd4FAP//x/+AAAAAAAAAHgAAAA//////llvwgIrIACMFAwAz/////wAAAAAAAAAAAIAAAAAfgAAADwCAAAAABAAG////////AAAAACCQHD8AAAA///////////8AAAAAA/8AAAAAAG8AAAAAAAAAAAAAAD4AAAAAAAAAAB8AAAAAAAAAAAAAPwEAAAAAAAAAAUMBQwAAAAABQwAAAAFDAUMBAQAAAQAAAAFDAQAAAAABAAAfgAAAB/////8AAAAAAAAAAAAAB/+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB/wAAAAcAAAAAAAAAAAAAf/8ABAf/AAAB/wAAD/8ABE//AAAAAAAAAAAAAAAHAD///wABAD8AAAAAAAAAAAAAAP8AAAAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAA/AAADAwAAAAADAwCqAAAAAwAAAAAAAAQABAAMCAAAxAEAAAAAAAAAAAAAHv4PwDAAAAH//wAAP////wAAAB///wAAAAAAAAAYAA/gAAAAAAAP/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf///////wAAAAAB////AB///wAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAAAAAAAAAAAAAAAADAD///////////////////4QwAAAAgAAAAAodAYAAAAAAAAcAAACAAf//AAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wAAACAAAAAAAAAAAAAAD/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///8ADwAAAAAAAAAAgAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAA+AAAAAAHgAAAAAAAAAAAAAABAAAAAAD/////////AAAAAAAHAAAAAA//gAAAAAAOAAAAAAAAAAAADwAAAAAAAQAAAAAAAAAAAAAAAAAAAeAAAAAAAAAAAAAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAB////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAABoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcDAwMcBAf+A////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAQ//AAAAH/////////////////////////////8AAAAAAwAAAAAD//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wAAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////////////////////////////////////////////////////////////////////////////////wAAAAAAAAAAAAAEAAAAAAAAAAAE2YQAKEgAAAAAAAAAAhgEBAAAACEFwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////P/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////z//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////P/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////z//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////P/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////z//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////P/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////y/////AAAAAAAAAAAAAAAA/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////P//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKQAP///+D4AAAAABF////g/+AAAAAHf////////////////AQGAAA+//y////4AAAAAAAAAAAAAP/////8AEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAA//gAAAAAAAAAAAAAAAAAAPv/////////////////////+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIgAAAAAAAAAAAAf///4H///+AAAAAAACAEIP///v////7/////////////////////////////////////////////////v//wAAAA///////////////8/5/AAMAA+AIAAAAAAAAAAAAAAAAAAAAAACAC6///3//////+//////wA/////////////////////+A///////////7//////MD//wAAAAB//////n9//////0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABf////////HgHiA/8//gAA3+Z///7+jw4GYAQ3D/8/gB+Gf//+/tsOAAAB6A/84ABf13///v7fHgFiAAIP/AAA3+Z///7+zxoGYAQ3D/4AAF+O8axjj/cNjuAEAAf/gAHf7v///v/fAeAAAAMP/AAA3+7///7/3wvmwBgLD/wAAN/u///+//8ODuAEAw/8AADf//j///9/0/gHA/wAAOAB///////+wAP4B//AAAAAAaaQPf3U3sAT6AP/MAAAAAP///z////qD/3/////gAAEE8AAAAAAAA/35AAAAAAAA/////99oQID///8AAAAAAAAAAAD//////AD//////5D//////////////8H//////////+D/////////////wP7//////////rz+vP/////+vP////68/rz+/v///v////68/v/////+///gf///+AAAAAD/////////////+AB////////////////////////////////////////////////////////////////////////////////////////////////////////+AH///+D/////////////gAD/+8AA///GAP//wAD/+4AA/////////gP9gA/o/8AAAAAA/8D//////////////wD//////4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/////////////////////////w///////////////A///8/P/////8/P9V/////P////////v6O/jz8P/4O/gAAgAAAAAAAAAAAAAAAEABAAAAAAAAAAAAAAAAAAAAACE/9HwKvd/HB8AAAP/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////gAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAB/wHz4f/////////////4Hf//////////////vB//////4f//////////////+//////8AAAAAAAAA///////4//////AAAAD////x////////gAD/8P///////v///////////////////h////////////////z////+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAP/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8/////////+AAAAAAAAAAAAAAAAAAAAAAAAD+AB8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB////gf///4AP//////////////j8/PzgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////vAA////4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////P/////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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/4AAYD////8P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/////////////7///////////7Jnv/17f//////////ef7+////976P7////////////////////////////////////////////////////////D////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////w=', 'base64');
+exports.default = data;
+//# sourceMappingURL=code-points-data-browser.js.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.js.map b/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.js.map
new file mode 100644
index 00000000..feba4779
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"code-points-data-browser.js","sourceRoot":"","sources":["../src/code-points-data-browser.ts"],"names":[],"mappings":";;AAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CACtB,8sliBAA8sliB,EAC9sliB,QAAQ,CACT,CAAC;AACF,kBAAe,IAAI,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-data.d.ts b/node_modules/@mongodb-js/saslprep/dist/code-points-data.d.ts
new file mode 100644
index 00000000..eb93246e
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-data.d.ts
@@ -0,0 +1,3 @@
+declare const _default: Buffer;
+export default _default;
+//# sourceMappingURL=code-points-data.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-data.d.ts.map b/node_modules/@mongodb-js/saslprep/dist/code-points-data.d.ts.map
new file mode 100644
index 00000000..62c29e29
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-data.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"code-points-data.d.ts","sourceRoot":"","sources":["../src/code-points-data.ts"],"names":[],"mappings":";AAEA,wBAKE"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-data.js b/node_modules/@mongodb-js/saslprep/dist/code-points-data.js
new file mode 100644
index 00000000..6af9a89b
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-data.js
@@ -0,0 +1,5 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const zlib_1 = require("zlib");
+exports.default = (0, zlib_1.gunzipSync)(Buffer.from('H4sIAAAAAAACA+3dTYgcaRkA4LemO9Mhxm0FITnE9Cwr4jHgwgZ22B6YywqCJ0HQg5CL4sGTuOjCtGSF4CkHEW856MlTQHD3EJnWkU0Owh5VxE3LHlYQdNxd2U6mU59UV/d09fw4M2EySSXPAzNdP1/9fX/99bzVNZEN4jisRDulVFnQmLxm1aXF9Id/2/xMxNJ4XZlg576yuYlGt9gupV6xoFf8jhu9YvulVrFlp5XSx+lfvYhORGPXvqIRWSxERKtIm8bKFd10WNfKDS5Fo9jJWrq2+M2IlW+8uHgl/+BsROfPF4v5L7148Ur68Sha6dqZpYiVVy8tvLCWXo80Sf/lS89dGX2wHGvpzoXVn75/YWH5wmqe8uika82ViJXTy83Ve2k5Urozm38wm4/ls6t5uT6yfsTSJ7J3T0VKt8c5ExEXI8aFkH729c3eT+7EC6ca8cVULZUiYacX0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uRLAAAAAAAAACA2hv9D1iu/VAYaAYA', 'base64'));
+//# sourceMappingURL=code-points-data.js.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-data.js.map b/node_modules/@mongodb-js/saslprep/dist/code-points-data.js.map
new file mode 100644
index 00000000..1da1c550
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-data.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"code-points-data.js","sourceRoot":"","sources":["../src/code-points-data.ts"],"names":[],"mappings":";;AAAA,+BAAkC;AAElC,kBAAe,IAAA,iBAAU,EACvB,MAAM,CAAC,IAAI,CACT,knFAAknF,EAClnF,QAAQ,CACT,CACF,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-src.d.ts b/node_modules/@mongodb-js/saslprep/dist/code-points-src.d.ts
new file mode 100644
index 00000000..36b6c565
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-src.d.ts
@@ -0,0 +1,7 @@
+export declare const unassigned_code_points: Set;
+export declare const commonly_mapped_to_nothing: Set;
+export declare const non_ASCII_space_characters: Set;
+export declare const prohibited_characters: Set;
+export declare const bidirectional_r_al: Set;
+export declare const bidirectional_l: Set;
+//# sourceMappingURL=code-points-src.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-src.d.ts.map b/node_modules/@mongodb-js/saslprep/dist/code-points-src.d.ts.map
new file mode 100644
index 00000000..ef0e6947
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-src.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"code-points-src.d.ts","sourceRoot":"","sources":["../src/code-points-src.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,sBAAsB,aA6YjC,CAAC;AAMH,eAAO,MAAM,0BAA0B,aAIrC,CAAC;AAMH,eAAO,MAAM,0BAA0B,aASrC,CAAC;AAMH,eAAO,MAAM,qBAAqB,aA6GhC,CAAC;AAMH,eAAO,MAAM,kBAAkB,aAmC7B,CAAC;AAMH,eAAO,MAAM,eAAe,aAyW1B,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-src.js b/node_modules/@mongodb-js/saslprep/dist/code-points-src.js
new file mode 100644
index 00000000..2caa6297
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-src.js
@@ -0,0 +1,881 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.bidirectional_l = exports.bidirectional_r_al = exports.prohibited_characters = exports.non_ASCII_space_characters = exports.commonly_mapped_to_nothing = exports.unassigned_code_points = void 0;
+const util_1 = require("./util");
+exports.unassigned_code_points = new Set([
+ 0x0221,
+ ...(0, util_1.range)(0x0234, 0x024f),
+ ...(0, util_1.range)(0x02ae, 0x02af),
+ ...(0, util_1.range)(0x02ef, 0x02ff),
+ ...(0, util_1.range)(0x0350, 0x035f),
+ ...(0, util_1.range)(0x0370, 0x0373),
+ ...(0, util_1.range)(0x0376, 0x0379),
+ ...(0, util_1.range)(0x037b, 0x037d),
+ ...(0, util_1.range)(0x037f, 0x0383),
+ 0x038b,
+ 0x038d,
+ 0x03a2,
+ 0x03cf,
+ ...(0, util_1.range)(0x03f7, 0x03ff),
+ 0x0487,
+ 0x04cf,
+ ...(0, util_1.range)(0x04f6, 0x04f7),
+ ...(0, util_1.range)(0x04fa, 0x04ff),
+ ...(0, util_1.range)(0x0510, 0x0530),
+ ...(0, util_1.range)(0x0557, 0x0558),
+ 0x0560,
+ 0x0588,
+ ...(0, util_1.range)(0x058b, 0x0590),
+ 0x05a2,
+ 0x05ba,
+ ...(0, util_1.range)(0x05c5, 0x05cf),
+ ...(0, util_1.range)(0x05eb, 0x05ef),
+ ...(0, util_1.range)(0x05f5, 0x060b),
+ ...(0, util_1.range)(0x060d, 0x061a),
+ ...(0, util_1.range)(0x061c, 0x061e),
+ 0x0620,
+ ...(0, util_1.range)(0x063b, 0x063f),
+ ...(0, util_1.range)(0x0656, 0x065f),
+ ...(0, util_1.range)(0x06ee, 0x06ef),
+ 0x06ff,
+ 0x070e,
+ ...(0, util_1.range)(0x072d, 0x072f),
+ ...(0, util_1.range)(0x074b, 0x077f),
+ ...(0, util_1.range)(0x07b2, 0x0900),
+ 0x0904,
+ ...(0, util_1.range)(0x093a, 0x093b),
+ ...(0, util_1.range)(0x094e, 0x094f),
+ ...(0, util_1.range)(0x0955, 0x0957),
+ ...(0, util_1.range)(0x0971, 0x0980),
+ 0x0984,
+ ...(0, util_1.range)(0x098d, 0x098e),
+ ...(0, util_1.range)(0x0991, 0x0992),
+ 0x09a9,
+ 0x09b1,
+ ...(0, util_1.range)(0x09b3, 0x09b5),
+ ...(0, util_1.range)(0x09ba, 0x09bb),
+ 0x09bd,
+ ...(0, util_1.range)(0x09c5, 0x09c6),
+ ...(0, util_1.range)(0x09c9, 0x09ca),
+ ...(0, util_1.range)(0x09ce, 0x09d6),
+ ...(0, util_1.range)(0x09d8, 0x09db),
+ 0x09de,
+ ...(0, util_1.range)(0x09e4, 0x09e5),
+ ...(0, util_1.range)(0x09fb, 0x0a01),
+ ...(0, util_1.range)(0x0a03, 0x0a04),
+ ...(0, util_1.range)(0x0a0b, 0x0a0e),
+ ...(0, util_1.range)(0x0a11, 0x0a12),
+ 0x0a29,
+ 0x0a31,
+ 0x0a34,
+ 0x0a37,
+ ...(0, util_1.range)(0x0a3a, 0x0a3b),
+ 0x0a3d,
+ ...(0, util_1.range)(0x0a43, 0x0a46),
+ ...(0, util_1.range)(0x0a49, 0x0a4a),
+ ...(0, util_1.range)(0x0a4e, 0x0a58),
+ 0x0a5d,
+ ...(0, util_1.range)(0x0a5f, 0x0a65),
+ ...(0, util_1.range)(0x0a75, 0x0a80),
+ 0x0a84,
+ 0x0a8c,
+ 0x0a8e,
+ 0x0a92,
+ 0x0aa9,
+ 0x0ab1,
+ 0x0ab4,
+ ...(0, util_1.range)(0x0aba, 0x0abb),
+ 0x0ac6,
+ 0x0aca,
+ ...(0, util_1.range)(0x0ace, 0x0acf),
+ ...(0, util_1.range)(0x0ad1, 0x0adf),
+ ...(0, util_1.range)(0x0ae1, 0x0ae5),
+ ...(0, util_1.range)(0x0af0, 0x0b00),
+ 0x0b04,
+ ...(0, util_1.range)(0x0b0d, 0x0b0e),
+ ...(0, util_1.range)(0x0b11, 0x0b12),
+ 0x0b29,
+ 0x0b31,
+ ...(0, util_1.range)(0x0b34, 0x0b35),
+ ...(0, util_1.range)(0x0b3a, 0x0b3b),
+ ...(0, util_1.range)(0x0b44, 0x0b46),
+ ...(0, util_1.range)(0x0b49, 0x0b4a),
+ ...(0, util_1.range)(0x0b4e, 0x0b55),
+ ...(0, util_1.range)(0x0b58, 0x0b5b),
+ 0x0b5e,
+ ...(0, util_1.range)(0x0b62, 0x0b65),
+ ...(0, util_1.range)(0x0b71, 0x0b81),
+ 0x0b84,
+ ...(0, util_1.range)(0x0b8b, 0x0b8d),
+ 0x0b91,
+ ...(0, util_1.range)(0x0b96, 0x0b98),
+ 0x0b9b,
+ 0x0b9d,
+ ...(0, util_1.range)(0x0ba0, 0x0ba2),
+ ...(0, util_1.range)(0x0ba5, 0x0ba7),
+ ...(0, util_1.range)(0x0bab, 0x0bad),
+ 0x0bb6,
+ ...(0, util_1.range)(0x0bba, 0x0bbd),
+ ...(0, util_1.range)(0x0bc3, 0x0bc5),
+ 0x0bc9,
+ ...(0, util_1.range)(0x0bce, 0x0bd6),
+ ...(0, util_1.range)(0x0bd8, 0x0be6),
+ ...(0, util_1.range)(0x0bf3, 0x0c00),
+ 0x0c04,
+ 0x0c0d,
+ 0x0c11,
+ 0x0c29,
+ 0x0c34,
+ ...(0, util_1.range)(0x0c3a, 0x0c3d),
+ 0x0c45,
+ 0x0c49,
+ ...(0, util_1.range)(0x0c4e, 0x0c54),
+ ...(0, util_1.range)(0x0c57, 0x0c5f),
+ ...(0, util_1.range)(0x0c62, 0x0c65),
+ ...(0, util_1.range)(0x0c70, 0x0c81),
+ 0x0c84,
+ 0x0c8d,
+ 0x0c91,
+ 0x0ca9,
+ 0x0cb4,
+ ...(0, util_1.range)(0x0cba, 0x0cbd),
+ 0x0cc5,
+ 0x0cc9,
+ ...(0, util_1.range)(0x0cce, 0x0cd4),
+ ...(0, util_1.range)(0x0cd7, 0x0cdd),
+ 0x0cdf,
+ ...(0, util_1.range)(0x0ce2, 0x0ce5),
+ ...(0, util_1.range)(0x0cf0, 0x0d01),
+ 0x0d04,
+ 0x0d0d,
+ 0x0d11,
+ 0x0d29,
+ ...(0, util_1.range)(0x0d3a, 0x0d3d),
+ ...(0, util_1.range)(0x0d44, 0x0d45),
+ 0x0d49,
+ ...(0, util_1.range)(0x0d4e, 0x0d56),
+ ...(0, util_1.range)(0x0d58, 0x0d5f),
+ ...(0, util_1.range)(0x0d62, 0x0d65),
+ ...(0, util_1.range)(0x0d70, 0x0d81),
+ 0x0d84,
+ ...(0, util_1.range)(0x0d97, 0x0d99),
+ 0x0db2,
+ 0x0dbc,
+ ...(0, util_1.range)(0x0dbe, 0x0dbf),
+ ...(0, util_1.range)(0x0dc7, 0x0dc9),
+ ...(0, util_1.range)(0x0dcb, 0x0dce),
+ 0x0dd5,
+ 0x0dd7,
+ ...(0, util_1.range)(0x0de0, 0x0df1),
+ ...(0, util_1.range)(0x0df5, 0x0e00),
+ ...(0, util_1.range)(0x0e3b, 0x0e3e),
+ ...(0, util_1.range)(0x0e5c, 0x0e80),
+ 0x0e83,
+ ...(0, util_1.range)(0x0e85, 0x0e86),
+ 0x0e89,
+ ...(0, util_1.range)(0x0e8b, 0x0e8c),
+ ...(0, util_1.range)(0x0e8e, 0x0e93),
+ 0x0e98,
+ 0x0ea0,
+ 0x0ea4,
+ 0x0ea6,
+ ...(0, util_1.range)(0x0ea8, 0x0ea9),
+ 0x0eac,
+ 0x0eba,
+ ...(0, util_1.range)(0x0ebe, 0x0ebf),
+ 0x0ec5,
+ 0x0ec7,
+ ...(0, util_1.range)(0x0ece, 0x0ecf),
+ ...(0, util_1.range)(0x0eda, 0x0edb),
+ ...(0, util_1.range)(0x0ede, 0x0eff),
+ 0x0f48,
+ ...(0, util_1.range)(0x0f6b, 0x0f70),
+ ...(0, util_1.range)(0x0f8c, 0x0f8f),
+ 0x0f98,
+ 0x0fbd,
+ ...(0, util_1.range)(0x0fcd, 0x0fce),
+ ...(0, util_1.range)(0x0fd0, 0x0fff),
+ 0x1022,
+ 0x1028,
+ 0x102b,
+ ...(0, util_1.range)(0x1033, 0x1035),
+ ...(0, util_1.range)(0x103a, 0x103f),
+ ...(0, util_1.range)(0x105a, 0x109f),
+ ...(0, util_1.range)(0x10c6, 0x10cf),
+ ...(0, util_1.range)(0x10f9, 0x10fa),
+ ...(0, util_1.range)(0x10fc, 0x10ff),
+ ...(0, util_1.range)(0x115a, 0x115e),
+ ...(0, util_1.range)(0x11a3, 0x11a7),
+ ...(0, util_1.range)(0x11fa, 0x11ff),
+ 0x1207,
+ 0x1247,
+ 0x1249,
+ ...(0, util_1.range)(0x124e, 0x124f),
+ 0x1257,
+ 0x1259,
+ ...(0, util_1.range)(0x125e, 0x125f),
+ 0x1287,
+ 0x1289,
+ ...(0, util_1.range)(0x128e, 0x128f),
+ 0x12af,
+ 0x12b1,
+ ...(0, util_1.range)(0x12b6, 0x12b7),
+ 0x12bf,
+ 0x12c1,
+ ...(0, util_1.range)(0x12c6, 0x12c7),
+ 0x12cf,
+ 0x12d7,
+ 0x12ef,
+ 0x130f,
+ 0x1311,
+ ...(0, util_1.range)(0x1316, 0x1317),
+ 0x131f,
+ 0x1347,
+ ...(0, util_1.range)(0x135b, 0x1360),
+ ...(0, util_1.range)(0x137d, 0x139f),
+ ...(0, util_1.range)(0x13f5, 0x1400),
+ ...(0, util_1.range)(0x1677, 0x167f),
+ ...(0, util_1.range)(0x169d, 0x169f),
+ ...(0, util_1.range)(0x16f1, 0x16ff),
+ 0x170d,
+ ...(0, util_1.range)(0x1715, 0x171f),
+ ...(0, util_1.range)(0x1737, 0x173f),
+ ...(0, util_1.range)(0x1754, 0x175f),
+ 0x176d,
+ 0x1771,
+ ...(0, util_1.range)(0x1774, 0x177f),
+ ...(0, util_1.range)(0x17dd, 0x17df),
+ ...(0, util_1.range)(0x17ea, 0x17ff),
+ 0x180f,
+ ...(0, util_1.range)(0x181a, 0x181f),
+ ...(0, util_1.range)(0x1878, 0x187f),
+ ...(0, util_1.range)(0x18aa, 0x1dff),
+ ...(0, util_1.range)(0x1e9c, 0x1e9f),
+ ...(0, util_1.range)(0x1efa, 0x1eff),
+ ...(0, util_1.range)(0x1f16, 0x1f17),
+ ...(0, util_1.range)(0x1f1e, 0x1f1f),
+ ...(0, util_1.range)(0x1f46, 0x1f47),
+ ...(0, util_1.range)(0x1f4e, 0x1f4f),
+ 0x1f58,
+ 0x1f5a,
+ 0x1f5c,
+ 0x1f5e,
+ ...(0, util_1.range)(0x1f7e, 0x1f7f),
+ 0x1fb5,
+ 0x1fc5,
+ ...(0, util_1.range)(0x1fd4, 0x1fd5),
+ 0x1fdc,
+ ...(0, util_1.range)(0x1ff0, 0x1ff1),
+ 0x1ff5,
+ 0x1fff,
+ ...(0, util_1.range)(0x2053, 0x2056),
+ ...(0, util_1.range)(0x2058, 0x205e),
+ ...(0, util_1.range)(0x2064, 0x2069),
+ ...(0, util_1.range)(0x2072, 0x2073),
+ ...(0, util_1.range)(0x208f, 0x209f),
+ ...(0, util_1.range)(0x20b2, 0x20cf),
+ ...(0, util_1.range)(0x20eb, 0x20ff),
+ ...(0, util_1.range)(0x213b, 0x213c),
+ ...(0, util_1.range)(0x214c, 0x2152),
+ ...(0, util_1.range)(0x2184, 0x218f),
+ ...(0, util_1.range)(0x23cf, 0x23ff),
+ ...(0, util_1.range)(0x2427, 0x243f),
+ ...(0, util_1.range)(0x244b, 0x245f),
+ 0x24ff,
+ ...(0, util_1.range)(0x2614, 0x2615),
+ 0x2618,
+ ...(0, util_1.range)(0x267e, 0x267f),
+ ...(0, util_1.range)(0x268a, 0x2700),
+ 0x2705,
+ ...(0, util_1.range)(0x270a, 0x270b),
+ 0x2728,
+ 0x274c,
+ 0x274e,
+ ...(0, util_1.range)(0x2753, 0x2755),
+ 0x2757,
+ ...(0, util_1.range)(0x275f, 0x2760),
+ ...(0, util_1.range)(0x2795, 0x2797),
+ 0x27b0,
+ ...(0, util_1.range)(0x27bf, 0x27cf),
+ ...(0, util_1.range)(0x27ec, 0x27ef),
+ ...(0, util_1.range)(0x2b00, 0x2e7f),
+ 0x2e9a,
+ ...(0, util_1.range)(0x2ef4, 0x2eff),
+ ...(0, util_1.range)(0x2fd6, 0x2fef),
+ ...(0, util_1.range)(0x2ffc, 0x2fff),
+ 0x3040,
+ ...(0, util_1.range)(0x3097, 0x3098),
+ ...(0, util_1.range)(0x3100, 0x3104),
+ ...(0, util_1.range)(0x312d, 0x3130),
+ 0x318f,
+ ...(0, util_1.range)(0x31b8, 0x31ef),
+ ...(0, util_1.range)(0x321d, 0x321f),
+ ...(0, util_1.range)(0x3244, 0x3250),
+ ...(0, util_1.range)(0x327c, 0x327e),
+ ...(0, util_1.range)(0x32cc, 0x32cf),
+ 0x32ff,
+ ...(0, util_1.range)(0x3377, 0x337a),
+ ...(0, util_1.range)(0x33de, 0x33df),
+ 0x33ff,
+ ...(0, util_1.range)(0x4db6, 0x4dff),
+ ...(0, util_1.range)(0x9fa6, 0x9fff),
+ ...(0, util_1.range)(0xa48d, 0xa48f),
+ ...(0, util_1.range)(0xa4c7, 0xabff),
+ ...(0, util_1.range)(0xd7a4, 0xd7ff),
+ ...(0, util_1.range)(0xfa2e, 0xfa2f),
+ ...(0, util_1.range)(0xfa6b, 0xfaff),
+ ...(0, util_1.range)(0xfb07, 0xfb12),
+ ...(0, util_1.range)(0xfb18, 0xfb1c),
+ 0xfb37,
+ 0xfb3d,
+ 0xfb3f,
+ 0xfb42,
+ 0xfb45,
+ ...(0, util_1.range)(0xfbb2, 0xfbd2),
+ ...(0, util_1.range)(0xfd40, 0xfd4f),
+ ...(0, util_1.range)(0xfd90, 0xfd91),
+ ...(0, util_1.range)(0xfdc8, 0xfdcf),
+ ...(0, util_1.range)(0xfdfd, 0xfdff),
+ ...(0, util_1.range)(0xfe10, 0xfe1f),
+ ...(0, util_1.range)(0xfe24, 0xfe2f),
+ ...(0, util_1.range)(0xfe47, 0xfe48),
+ 0xfe53,
+ 0xfe67,
+ ...(0, util_1.range)(0xfe6c, 0xfe6f),
+ 0xfe75,
+ ...(0, util_1.range)(0xfefd, 0xfefe),
+ 0xff00,
+ ...(0, util_1.range)(0xffbf, 0xffc1),
+ ...(0, util_1.range)(0xffc8, 0xffc9),
+ ...(0, util_1.range)(0xffd0, 0xffd1),
+ ...(0, util_1.range)(0xffd8, 0xffd9),
+ ...(0, util_1.range)(0xffdd, 0xffdf),
+ 0xffe7,
+ ...(0, util_1.range)(0xffef, 0xfff8),
+ ...(0, util_1.range)(0x10000, 0x102ff),
+ 0x1031f,
+ ...(0, util_1.range)(0x10324, 0x1032f),
+ ...(0, util_1.range)(0x1034b, 0x103ff),
+ ...(0, util_1.range)(0x10426, 0x10427),
+ ...(0, util_1.range)(0x1044e, 0x1cfff),
+ ...(0, util_1.range)(0x1d0f6, 0x1d0ff),
+ ...(0, util_1.range)(0x1d127, 0x1d129),
+ ...(0, util_1.range)(0x1d1de, 0x1d3ff),
+ 0x1d455,
+ 0x1d49d,
+ ...(0, util_1.range)(0x1d4a0, 0x1d4a1),
+ ...(0, util_1.range)(0x1d4a3, 0x1d4a4),
+ ...(0, util_1.range)(0x1d4a7, 0x1d4a8),
+ 0x1d4ad,
+ 0x1d4ba,
+ 0x1d4bc,
+ 0x1d4c1,
+ 0x1d4c4,
+ 0x1d506,
+ ...(0, util_1.range)(0x1d50b, 0x1d50c),
+ 0x1d515,
+ 0x1d51d,
+ 0x1d53a,
+ 0x1d53f,
+ 0x1d545,
+ ...(0, util_1.range)(0x1d547, 0x1d549),
+ 0x1d551,
+ ...(0, util_1.range)(0x1d6a4, 0x1d6a7),
+ ...(0, util_1.range)(0x1d7ca, 0x1d7cd),
+ ...(0, util_1.range)(0x1d800, 0x1fffd),
+ ...(0, util_1.range)(0x2a6d7, 0x2f7ff),
+ ...(0, util_1.range)(0x2fa1e, 0x2fffd),
+ ...(0, util_1.range)(0x30000, 0x3fffd),
+ ...(0, util_1.range)(0x40000, 0x4fffd),
+ ...(0, util_1.range)(0x50000, 0x5fffd),
+ ...(0, util_1.range)(0x60000, 0x6fffd),
+ ...(0, util_1.range)(0x70000, 0x7fffd),
+ ...(0, util_1.range)(0x80000, 0x8fffd),
+ ...(0, util_1.range)(0x90000, 0x9fffd),
+ ...(0, util_1.range)(0xa0000, 0xafffd),
+ ...(0, util_1.range)(0xb0000, 0xbfffd),
+ ...(0, util_1.range)(0xc0000, 0xcfffd),
+ ...(0, util_1.range)(0xd0000, 0xdfffd),
+ 0xe0000,
+ ...(0, util_1.range)(0xe0002, 0xe001f),
+ ...(0, util_1.range)(0xe0080, 0xefffd),
+]);
+exports.commonly_mapped_to_nothing = new Set([
+ 0x00ad, 0x034f, 0x1806, 0x180b, 0x180c, 0x180d, 0x200b, 0x200c, 0x200d,
+ 0x2060, 0xfe00, 0xfe01, 0xfe02, 0xfe03, 0xfe04, 0xfe05, 0xfe06, 0xfe07,
+ 0xfe08, 0xfe09, 0xfe0a, 0xfe0b, 0xfe0c, 0xfe0d, 0xfe0e, 0xfe0f, 0xfeff,
+]);
+exports.non_ASCII_space_characters = new Set([
+ 0x00a0, 0x1680,
+ 0x2000, 0x2001, 0x2002,
+ 0x2003, 0x2004,
+ 0x2005, 0x2006,
+ 0x2007, 0x2008,
+ 0x2009, 0x200a,
+ 0x200b, 0x202f,
+ 0x205f, 0x3000,
+]);
+exports.prohibited_characters = new Set([
+ ...exports.non_ASCII_space_characters,
+ ...(0, util_1.range)(0, 0x001f),
+ 0x007f,
+ ...(0, util_1.range)(0x0080, 0x009f),
+ 0x06dd,
+ 0x070f,
+ 0x180e,
+ 0x200c,
+ 0x200d,
+ 0x2028,
+ 0x2029,
+ 0x2060,
+ 0x2061,
+ 0x2062,
+ 0x2063,
+ ...(0, util_1.range)(0x206a, 0x206f),
+ 0xfeff,
+ ...(0, util_1.range)(0xfff9, 0xfffc),
+ ...(0, util_1.range)(0x1d173, 0x1d17a),
+ ...(0, util_1.range)(0xe000, 0xf8ff),
+ ...(0, util_1.range)(0xf0000, 0xffffd),
+ ...(0, util_1.range)(0x100000, 0x10fffd),
+ ...(0, util_1.range)(0xfdd0, 0xfdef),
+ ...(0, util_1.range)(0xfffe, 0xffff),
+ ...(0, util_1.range)(0x1fffe, 0x1ffff),
+ ...(0, util_1.range)(0x2fffe, 0x2ffff),
+ ...(0, util_1.range)(0x3fffe, 0x3ffff),
+ ...(0, util_1.range)(0x4fffe, 0x4ffff),
+ ...(0, util_1.range)(0x5fffe, 0x5ffff),
+ ...(0, util_1.range)(0x6fffe, 0x6ffff),
+ ...(0, util_1.range)(0x7fffe, 0x7ffff),
+ ...(0, util_1.range)(0x8fffe, 0x8ffff),
+ ...(0, util_1.range)(0x9fffe, 0x9ffff),
+ ...(0, util_1.range)(0xafffe, 0xaffff),
+ ...(0, util_1.range)(0xbfffe, 0xbffff),
+ ...(0, util_1.range)(0xcfffe, 0xcffff),
+ ...(0, util_1.range)(0xdfffe, 0xdffff),
+ ...(0, util_1.range)(0xefffe, 0xeffff),
+ ...(0, util_1.range)(0x10fffe, 0x10ffff),
+ ...(0, util_1.range)(0xd800, 0xdfff),
+ 0xfff9,
+ 0xfffa,
+ 0xfffb,
+ 0xfffc,
+ 0xfffd,
+ ...(0, util_1.range)(0x2ff0, 0x2ffb),
+ 0x0340,
+ 0x0341,
+ 0x200e,
+ 0x200f,
+ 0x202a,
+ 0x202b,
+ 0x202c,
+ 0x202d,
+ 0x202e,
+ 0x206a,
+ 0x206b,
+ 0x206c,
+ 0x206d,
+ 0x206e,
+ 0x206f,
+ 0xe0001,
+ ...(0, util_1.range)(0xe0020, 0xe007f),
+]);
+exports.bidirectional_r_al = new Set([
+ 0x05be,
+ 0x05c0,
+ 0x05c3,
+ ...(0, util_1.range)(0x05d0, 0x05ea),
+ ...(0, util_1.range)(0x05f0, 0x05f4),
+ 0x061b,
+ 0x061f,
+ ...(0, util_1.range)(0x0621, 0x063a),
+ ...(0, util_1.range)(0x0640, 0x064a),
+ ...(0, util_1.range)(0x066d, 0x066f),
+ ...(0, util_1.range)(0x0671, 0x06d5),
+ 0x06dd,
+ ...(0, util_1.range)(0x06e5, 0x06e6),
+ ...(0, util_1.range)(0x06fa, 0x06fe),
+ ...(0, util_1.range)(0x0700, 0x070d),
+ 0x0710,
+ ...(0, util_1.range)(0x0712, 0x072c),
+ ...(0, util_1.range)(0x0780, 0x07a5),
+ 0x07b1,
+ 0x200f,
+ 0xfb1d,
+ ...(0, util_1.range)(0xfb1f, 0xfb28),
+ ...(0, util_1.range)(0xfb2a, 0xfb36),
+ ...(0, util_1.range)(0xfb38, 0xfb3c),
+ 0xfb3e,
+ ...(0, util_1.range)(0xfb40, 0xfb41),
+ ...(0, util_1.range)(0xfb43, 0xfb44),
+ ...(0, util_1.range)(0xfb46, 0xfbb1),
+ ...(0, util_1.range)(0xfbd3, 0xfd3d),
+ ...(0, util_1.range)(0xfd50, 0xfd8f),
+ ...(0, util_1.range)(0xfd92, 0xfdc7),
+ ...(0, util_1.range)(0xfdf0, 0xfdfc),
+ ...(0, util_1.range)(0xfe70, 0xfe74),
+ ...(0, util_1.range)(0xfe76, 0xfefc),
+]);
+exports.bidirectional_l = new Set([
+ ...(0, util_1.range)(0x0041, 0x005a),
+ ...(0, util_1.range)(0x0061, 0x007a),
+ 0x00aa,
+ 0x00b5,
+ 0x00ba,
+ ...(0, util_1.range)(0x00c0, 0x00d6),
+ ...(0, util_1.range)(0x00d8, 0x00f6),
+ ...(0, util_1.range)(0x00f8, 0x0220),
+ ...(0, util_1.range)(0x0222, 0x0233),
+ ...(0, util_1.range)(0x0250, 0x02ad),
+ ...(0, util_1.range)(0x02b0, 0x02b8),
+ ...(0, util_1.range)(0x02bb, 0x02c1),
+ ...(0, util_1.range)(0x02d0, 0x02d1),
+ ...(0, util_1.range)(0x02e0, 0x02e4),
+ 0x02ee,
+ 0x037a,
+ 0x0386,
+ ...(0, util_1.range)(0x0388, 0x038a),
+ 0x038c,
+ ...(0, util_1.range)(0x038e, 0x03a1),
+ ...(0, util_1.range)(0x03a3, 0x03ce),
+ ...(0, util_1.range)(0x03d0, 0x03f5),
+ ...(0, util_1.range)(0x0400, 0x0482),
+ ...(0, util_1.range)(0x048a, 0x04ce),
+ ...(0, util_1.range)(0x04d0, 0x04f5),
+ ...(0, util_1.range)(0x04f8, 0x04f9),
+ ...(0, util_1.range)(0x0500, 0x050f),
+ ...(0, util_1.range)(0x0531, 0x0556),
+ ...(0, util_1.range)(0x0559, 0x055f),
+ ...(0, util_1.range)(0x0561, 0x0587),
+ 0x0589,
+ 0x0903,
+ ...(0, util_1.range)(0x0905, 0x0939),
+ ...(0, util_1.range)(0x093d, 0x0940),
+ ...(0, util_1.range)(0x0949, 0x094c),
+ 0x0950,
+ ...(0, util_1.range)(0x0958, 0x0961),
+ ...(0, util_1.range)(0x0964, 0x0970),
+ ...(0, util_1.range)(0x0982, 0x0983),
+ ...(0, util_1.range)(0x0985, 0x098c),
+ ...(0, util_1.range)(0x098f, 0x0990),
+ ...(0, util_1.range)(0x0993, 0x09a8),
+ ...(0, util_1.range)(0x09aa, 0x09b0),
+ 0x09b2,
+ ...(0, util_1.range)(0x09b6, 0x09b9),
+ ...(0, util_1.range)(0x09be, 0x09c0),
+ ...(0, util_1.range)(0x09c7, 0x09c8),
+ ...(0, util_1.range)(0x09cb, 0x09cc),
+ 0x09d7,
+ ...(0, util_1.range)(0x09dc, 0x09dd),
+ ...(0, util_1.range)(0x09df, 0x09e1),
+ ...(0, util_1.range)(0x09e6, 0x09f1),
+ ...(0, util_1.range)(0x09f4, 0x09fa),
+ ...(0, util_1.range)(0x0a05, 0x0a0a),
+ ...(0, util_1.range)(0x0a0f, 0x0a10),
+ ...(0, util_1.range)(0x0a13, 0x0a28),
+ ...(0, util_1.range)(0x0a2a, 0x0a30),
+ ...(0, util_1.range)(0x0a32, 0x0a33),
+ ...(0, util_1.range)(0x0a35, 0x0a36),
+ ...(0, util_1.range)(0x0a38, 0x0a39),
+ ...(0, util_1.range)(0x0a3e, 0x0a40),
+ ...(0, util_1.range)(0x0a59, 0x0a5c),
+ 0x0a5e,
+ ...(0, util_1.range)(0x0a66, 0x0a6f),
+ ...(0, util_1.range)(0x0a72, 0x0a74),
+ 0x0a83,
+ ...(0, util_1.range)(0x0a85, 0x0a8b),
+ 0x0a8d,
+ ...(0, util_1.range)(0x0a8f, 0x0a91),
+ ...(0, util_1.range)(0x0a93, 0x0aa8),
+ ...(0, util_1.range)(0x0aaa, 0x0ab0),
+ ...(0, util_1.range)(0x0ab2, 0x0ab3),
+ ...(0, util_1.range)(0x0ab5, 0x0ab9),
+ ...(0, util_1.range)(0x0abd, 0x0ac0),
+ 0x0ac9,
+ ...(0, util_1.range)(0x0acb, 0x0acc),
+ 0x0ad0,
+ 0x0ae0,
+ ...(0, util_1.range)(0x0ae6, 0x0aef),
+ ...(0, util_1.range)(0x0b02, 0x0b03),
+ ...(0, util_1.range)(0x0b05, 0x0b0c),
+ ...(0, util_1.range)(0x0b0f, 0x0b10),
+ ...(0, util_1.range)(0x0b13, 0x0b28),
+ ...(0, util_1.range)(0x0b2a, 0x0b30),
+ ...(0, util_1.range)(0x0b32, 0x0b33),
+ ...(0, util_1.range)(0x0b36, 0x0b39),
+ ...(0, util_1.range)(0x0b3d, 0x0b3e),
+ 0x0b40,
+ ...(0, util_1.range)(0x0b47, 0x0b48),
+ ...(0, util_1.range)(0x0b4b, 0x0b4c),
+ 0x0b57,
+ ...(0, util_1.range)(0x0b5c, 0x0b5d),
+ ...(0, util_1.range)(0x0b5f, 0x0b61),
+ ...(0, util_1.range)(0x0b66, 0x0b70),
+ 0x0b83,
+ ...(0, util_1.range)(0x0b85, 0x0b8a),
+ ...(0, util_1.range)(0x0b8e, 0x0b90),
+ ...(0, util_1.range)(0x0b92, 0x0b95),
+ ...(0, util_1.range)(0x0b99, 0x0b9a),
+ 0x0b9c,
+ ...(0, util_1.range)(0x0b9e, 0x0b9f),
+ ...(0, util_1.range)(0x0ba3, 0x0ba4),
+ ...(0, util_1.range)(0x0ba8, 0x0baa),
+ ...(0, util_1.range)(0x0bae, 0x0bb5),
+ ...(0, util_1.range)(0x0bb7, 0x0bb9),
+ ...(0, util_1.range)(0x0bbe, 0x0bbf),
+ ...(0, util_1.range)(0x0bc1, 0x0bc2),
+ ...(0, util_1.range)(0x0bc6, 0x0bc8),
+ ...(0, util_1.range)(0x0bca, 0x0bcc),
+ 0x0bd7,
+ ...(0, util_1.range)(0x0be7, 0x0bf2),
+ ...(0, util_1.range)(0x0c01, 0x0c03),
+ ...(0, util_1.range)(0x0c05, 0x0c0c),
+ ...(0, util_1.range)(0x0c0e, 0x0c10),
+ ...(0, util_1.range)(0x0c12, 0x0c28),
+ ...(0, util_1.range)(0x0c2a, 0x0c33),
+ ...(0, util_1.range)(0x0c35, 0x0c39),
+ ...(0, util_1.range)(0x0c41, 0x0c44),
+ ...(0, util_1.range)(0x0c60, 0x0c61),
+ ...(0, util_1.range)(0x0c66, 0x0c6f),
+ ...(0, util_1.range)(0x0c82, 0x0c83),
+ ...(0, util_1.range)(0x0c85, 0x0c8c),
+ ...(0, util_1.range)(0x0c8e, 0x0c90),
+ ...(0, util_1.range)(0x0c92, 0x0ca8),
+ ...(0, util_1.range)(0x0caa, 0x0cb3),
+ ...(0, util_1.range)(0x0cb5, 0x0cb9),
+ 0x0cbe,
+ ...(0, util_1.range)(0x0cc0, 0x0cc4),
+ ...(0, util_1.range)(0x0cc7, 0x0cc8),
+ ...(0, util_1.range)(0x0cca, 0x0ccb),
+ ...(0, util_1.range)(0x0cd5, 0x0cd6),
+ 0x0cde,
+ ...(0, util_1.range)(0x0ce0, 0x0ce1),
+ ...(0, util_1.range)(0x0ce6, 0x0cef),
+ ...(0, util_1.range)(0x0d02, 0x0d03),
+ ...(0, util_1.range)(0x0d05, 0x0d0c),
+ ...(0, util_1.range)(0x0d0e, 0x0d10),
+ ...(0, util_1.range)(0x0d12, 0x0d28),
+ ...(0, util_1.range)(0x0d2a, 0x0d39),
+ ...(0, util_1.range)(0x0d3e, 0x0d40),
+ ...(0, util_1.range)(0x0d46, 0x0d48),
+ ...(0, util_1.range)(0x0d4a, 0x0d4c),
+ 0x0d57,
+ ...(0, util_1.range)(0x0d60, 0x0d61),
+ ...(0, util_1.range)(0x0d66, 0x0d6f),
+ ...(0, util_1.range)(0x0d82, 0x0d83),
+ ...(0, util_1.range)(0x0d85, 0x0d96),
+ ...(0, util_1.range)(0x0d9a, 0x0db1),
+ ...(0, util_1.range)(0x0db3, 0x0dbb),
+ 0x0dbd,
+ ...(0, util_1.range)(0x0dc0, 0x0dc6),
+ ...(0, util_1.range)(0x0dcf, 0x0dd1),
+ ...(0, util_1.range)(0x0dd8, 0x0ddf),
+ ...(0, util_1.range)(0x0df2, 0x0df4),
+ ...(0, util_1.range)(0x0e01, 0x0e30),
+ ...(0, util_1.range)(0x0e32, 0x0e33),
+ ...(0, util_1.range)(0x0e40, 0x0e46),
+ ...(0, util_1.range)(0x0e4f, 0x0e5b),
+ ...(0, util_1.range)(0x0e81, 0x0e82),
+ 0x0e84,
+ ...(0, util_1.range)(0x0e87, 0x0e88),
+ 0x0e8a,
+ 0x0e8d,
+ ...(0, util_1.range)(0x0e94, 0x0e97),
+ ...(0, util_1.range)(0x0e99, 0x0e9f),
+ ...(0, util_1.range)(0x0ea1, 0x0ea3),
+ 0x0ea5,
+ 0x0ea7,
+ ...(0, util_1.range)(0x0eaa, 0x0eab),
+ ...(0, util_1.range)(0x0ead, 0x0eb0),
+ ...(0, util_1.range)(0x0eb2, 0x0eb3),
+ 0x0ebd,
+ ...(0, util_1.range)(0x0ec0, 0x0ec4),
+ 0x0ec6,
+ ...(0, util_1.range)(0x0ed0, 0x0ed9),
+ ...(0, util_1.range)(0x0edc, 0x0edd),
+ ...(0, util_1.range)(0x0f00, 0x0f17),
+ ...(0, util_1.range)(0x0f1a, 0x0f34),
+ 0x0f36,
+ 0x0f38,
+ ...(0, util_1.range)(0x0f3e, 0x0f47),
+ ...(0, util_1.range)(0x0f49, 0x0f6a),
+ 0x0f7f,
+ 0x0f85,
+ ...(0, util_1.range)(0x0f88, 0x0f8b),
+ ...(0, util_1.range)(0x0fbe, 0x0fc5),
+ ...(0, util_1.range)(0x0fc7, 0x0fcc),
+ 0x0fcf,
+ ...(0, util_1.range)(0x1000, 0x1021),
+ ...(0, util_1.range)(0x1023, 0x1027),
+ ...(0, util_1.range)(0x1029, 0x102a),
+ 0x102c,
+ 0x1031,
+ 0x1038,
+ ...(0, util_1.range)(0x1040, 0x1057),
+ ...(0, util_1.range)(0x10a0, 0x10c5),
+ ...(0, util_1.range)(0x10d0, 0x10f8),
+ 0x10fb,
+ ...(0, util_1.range)(0x1100, 0x1159),
+ ...(0, util_1.range)(0x115f, 0x11a2),
+ ...(0, util_1.range)(0x11a8, 0x11f9),
+ ...(0, util_1.range)(0x1200, 0x1206),
+ ...(0, util_1.range)(0x1208, 0x1246),
+ 0x1248,
+ ...(0, util_1.range)(0x124a, 0x124d),
+ ...(0, util_1.range)(0x1250, 0x1256),
+ 0x1258,
+ ...(0, util_1.range)(0x125a, 0x125d),
+ ...(0, util_1.range)(0x1260, 0x1286),
+ 0x1288,
+ ...(0, util_1.range)(0x128a, 0x128d),
+ ...(0, util_1.range)(0x1290, 0x12ae),
+ 0x12b0,
+ ...(0, util_1.range)(0x12b2, 0x12b5),
+ ...(0, util_1.range)(0x12b8, 0x12be),
+ 0x12c0,
+ ...(0, util_1.range)(0x12c2, 0x12c5),
+ ...(0, util_1.range)(0x12c8, 0x12ce),
+ ...(0, util_1.range)(0x12d0, 0x12d6),
+ ...(0, util_1.range)(0x12d8, 0x12ee),
+ ...(0, util_1.range)(0x12f0, 0x130e),
+ 0x1310,
+ ...(0, util_1.range)(0x1312, 0x1315),
+ ...(0, util_1.range)(0x1318, 0x131e),
+ ...(0, util_1.range)(0x1320, 0x1346),
+ ...(0, util_1.range)(0x1348, 0x135a),
+ ...(0, util_1.range)(0x1361, 0x137c),
+ ...(0, util_1.range)(0x13a0, 0x13f4),
+ ...(0, util_1.range)(0x1401, 0x1676),
+ ...(0, util_1.range)(0x1681, 0x169a),
+ ...(0, util_1.range)(0x16a0, 0x16f0),
+ ...(0, util_1.range)(0x1700, 0x170c),
+ ...(0, util_1.range)(0x170e, 0x1711),
+ ...(0, util_1.range)(0x1720, 0x1731),
+ ...(0, util_1.range)(0x1735, 0x1736),
+ ...(0, util_1.range)(0x1740, 0x1751),
+ ...(0, util_1.range)(0x1760, 0x176c),
+ ...(0, util_1.range)(0x176e, 0x1770),
+ ...(0, util_1.range)(0x1780, 0x17b6),
+ ...(0, util_1.range)(0x17be, 0x17c5),
+ ...(0, util_1.range)(0x17c7, 0x17c8),
+ ...(0, util_1.range)(0x17d4, 0x17da),
+ 0x17dc,
+ ...(0, util_1.range)(0x17e0, 0x17e9),
+ ...(0, util_1.range)(0x1810, 0x1819),
+ ...(0, util_1.range)(0x1820, 0x1877),
+ ...(0, util_1.range)(0x1880, 0x18a8),
+ ...(0, util_1.range)(0x1e00, 0x1e9b),
+ ...(0, util_1.range)(0x1ea0, 0x1ef9),
+ ...(0, util_1.range)(0x1f00, 0x1f15),
+ ...(0, util_1.range)(0x1f18, 0x1f1d),
+ ...(0, util_1.range)(0x1f20, 0x1f45),
+ ...(0, util_1.range)(0x1f48, 0x1f4d),
+ ...(0, util_1.range)(0x1f50, 0x1f57),
+ 0x1f59,
+ 0x1f5b,
+ 0x1f5d,
+ ...(0, util_1.range)(0x1f5f, 0x1f7d),
+ ...(0, util_1.range)(0x1f80, 0x1fb4),
+ ...(0, util_1.range)(0x1fb6, 0x1fbc),
+ 0x1fbe,
+ ...(0, util_1.range)(0x1fc2, 0x1fc4),
+ ...(0, util_1.range)(0x1fc6, 0x1fcc),
+ ...(0, util_1.range)(0x1fd0, 0x1fd3),
+ ...(0, util_1.range)(0x1fd6, 0x1fdb),
+ ...(0, util_1.range)(0x1fe0, 0x1fec),
+ ...(0, util_1.range)(0x1ff2, 0x1ff4),
+ ...(0, util_1.range)(0x1ff6, 0x1ffc),
+ 0x200e,
+ 0x2071,
+ 0x207f,
+ 0x2102,
+ 0x2107,
+ ...(0, util_1.range)(0x210a, 0x2113),
+ 0x2115,
+ ...(0, util_1.range)(0x2119, 0x211d),
+ 0x2124,
+ 0x2126,
+ 0x2128,
+ ...(0, util_1.range)(0x212a, 0x212d),
+ ...(0, util_1.range)(0x212f, 0x2131),
+ ...(0, util_1.range)(0x2133, 0x2139),
+ ...(0, util_1.range)(0x213d, 0x213f),
+ ...(0, util_1.range)(0x2145, 0x2149),
+ ...(0, util_1.range)(0x2160, 0x2183),
+ ...(0, util_1.range)(0x2336, 0x237a),
+ 0x2395,
+ ...(0, util_1.range)(0x249c, 0x24e9),
+ ...(0, util_1.range)(0x3005, 0x3007),
+ ...(0, util_1.range)(0x3021, 0x3029),
+ ...(0, util_1.range)(0x3031, 0x3035),
+ ...(0, util_1.range)(0x3038, 0x303c),
+ ...(0, util_1.range)(0x3041, 0x3096),
+ ...(0, util_1.range)(0x309d, 0x309f),
+ ...(0, util_1.range)(0x30a1, 0x30fa),
+ ...(0, util_1.range)(0x30fc, 0x30ff),
+ ...(0, util_1.range)(0x3105, 0x312c),
+ ...(0, util_1.range)(0x3131, 0x318e),
+ ...(0, util_1.range)(0x3190, 0x31b7),
+ ...(0, util_1.range)(0x31f0, 0x321c),
+ ...(0, util_1.range)(0x3220, 0x3243),
+ ...(0, util_1.range)(0x3260, 0x327b),
+ ...(0, util_1.range)(0x327f, 0x32b0),
+ ...(0, util_1.range)(0x32c0, 0x32cb),
+ ...(0, util_1.range)(0x32d0, 0x32fe),
+ ...(0, util_1.range)(0x3300, 0x3376),
+ ...(0, util_1.range)(0x337b, 0x33dd),
+ ...(0, util_1.range)(0x33e0, 0x33fe),
+ ...(0, util_1.range)(0x3400, 0x4db5),
+ ...(0, util_1.range)(0x4e00, 0x9fa5),
+ ...(0, util_1.range)(0xa000, 0xa48c),
+ ...(0, util_1.range)(0xac00, 0xd7a3),
+ ...(0, util_1.range)(0xd800, 0xfa2d),
+ ...(0, util_1.range)(0xfa30, 0xfa6a),
+ ...(0, util_1.range)(0xfb00, 0xfb06),
+ ...(0, util_1.range)(0xfb13, 0xfb17),
+ ...(0, util_1.range)(0xff21, 0xff3a),
+ ...(0, util_1.range)(0xff41, 0xff5a),
+ ...(0, util_1.range)(0xff66, 0xffbe),
+ ...(0, util_1.range)(0xffc2, 0xffc7),
+ ...(0, util_1.range)(0xffca, 0xffcf),
+ ...(0, util_1.range)(0xffd2, 0xffd7),
+ ...(0, util_1.range)(0xffda, 0xffdc),
+ ...(0, util_1.range)(0x10300, 0x1031e),
+ ...(0, util_1.range)(0x10320, 0x10323),
+ ...(0, util_1.range)(0x10330, 0x1034a),
+ ...(0, util_1.range)(0x10400, 0x10425),
+ ...(0, util_1.range)(0x10428, 0x1044d),
+ ...(0, util_1.range)(0x1d000, 0x1d0f5),
+ ...(0, util_1.range)(0x1d100, 0x1d126),
+ ...(0, util_1.range)(0x1d12a, 0x1d166),
+ ...(0, util_1.range)(0x1d16a, 0x1d172),
+ ...(0, util_1.range)(0x1d183, 0x1d184),
+ ...(0, util_1.range)(0x1d18c, 0x1d1a9),
+ ...(0, util_1.range)(0x1d1ae, 0x1d1dd),
+ ...(0, util_1.range)(0x1d400, 0x1d454),
+ ...(0, util_1.range)(0x1d456, 0x1d49c),
+ ...(0, util_1.range)(0x1d49e, 0x1d49f),
+ 0x1d4a2,
+ ...(0, util_1.range)(0x1d4a5, 0x1d4a6),
+ ...(0, util_1.range)(0x1d4a9, 0x1d4ac),
+ ...(0, util_1.range)(0x1d4ae, 0x1d4b9),
+ 0x1d4bb,
+ ...(0, util_1.range)(0x1d4bd, 0x1d4c0),
+ ...(0, util_1.range)(0x1d4c2, 0x1d4c3),
+ ...(0, util_1.range)(0x1d4c5, 0x1d505),
+ ...(0, util_1.range)(0x1d507, 0x1d50a),
+ ...(0, util_1.range)(0x1d50d, 0x1d514),
+ ...(0, util_1.range)(0x1d516, 0x1d51c),
+ ...(0, util_1.range)(0x1d51e, 0x1d539),
+ ...(0, util_1.range)(0x1d53b, 0x1d53e),
+ ...(0, util_1.range)(0x1d540, 0x1d544),
+ 0x1d546,
+ ...(0, util_1.range)(0x1d54a, 0x1d550),
+ ...(0, util_1.range)(0x1d552, 0x1d6a3),
+ ...(0, util_1.range)(0x1d6a8, 0x1d7c9),
+ ...(0, util_1.range)(0x20000, 0x2a6d6),
+ ...(0, util_1.range)(0x2f800, 0x2fa1d),
+ ...(0, util_1.range)(0xf0000, 0xffffd),
+ ...(0, util_1.range)(0x100000, 0x10fffd),
+]);
+//# sourceMappingURL=code-points-src.js.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/code-points-src.js.map b/node_modules/@mongodb-js/saslprep/dist/code-points-src.js.map
new file mode 100644
index 00000000..dfb14ea8
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/code-points-src.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"code-points-src.js","sourceRoot":"","sources":["../src/code-points-src.ts"],"names":[],"mappings":";;;AAAA,iCAA+B;AAMlB,QAAA,sBAAsB,GAAG,IAAI,GAAG,CAAC;IAC5C,MAAM;IACN,GAAG,IAAA,YAAK,EAAC,MAAM,EAAE,MAAM,CAAC;IACxB,GAAG,IAAA,YAAK,EAAC,MAAM,EAAE,MAAM,CAAC;IACxB,GAAG,IAAA,YAAK,EAAC,MAAM,EAAE,MAAM,CAAC;IACxB,GAAG,IAAA,YAAK,EAAC,MAAM,EAAE,MAAM,CAAC;IACxB,GAAG,IAAA,YAAK,EAAC,MAAM,EAAE,MAAM,CAAC;IACxB,GAAG,IAAA,YAAK,EAAC,MAAM,EAAE,MAAM,CAAC;IACxB,GAAG,IAAA,YAAK,EAAC,MAAM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AO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,OAAO;IACP,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,GAAG,IAAA,YAAK,EAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/generate-code-points.d.ts b/node_modules/@mongodb-js/saslprep/dist/generate-code-points.d.ts
new file mode 100644
index 00000000..5a83ab24
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/generate-code-points.d.ts
@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=generate-code-points.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/generate-code-points.d.ts.map b/node_modules/@mongodb-js/saslprep/dist/generate-code-points.d.ts.map
new file mode 100644
index 00000000..b102903e
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/generate-code-points.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"generate-code-points.d.ts","sourceRoot":"","sources":["../src/generate-code-points.ts"],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/generate-code-points.js b/node_modules/@mongodb-js/saslprep/dist/generate-code-points.js
new file mode 100644
index 00000000..38e94392
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/generate-code-points.js
@@ -0,0 +1,83 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || (function () {
+ var ownKeys = function(o) {
+ ownKeys = Object.getOwnPropertyNames || function (o) {
+ var ar = [];
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
+ return ar;
+ };
+ return ownKeys(o);
+ };
+ return function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
+ __setModuleDefault(result, mod);
+ return result;
+ };
+})();
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const zlib_1 = require("zlib");
+const sparse_bitfield_1 = __importDefault(require("sparse-bitfield"));
+const codePoints = __importStar(require("./code-points-src"));
+const fs_1 = require("fs");
+const prettier = __importStar(require("prettier"));
+const unassigned_code_points = (0, sparse_bitfield_1.default)();
+const commonly_mapped_to_nothing = (0, sparse_bitfield_1.default)();
+const non_ascii_space_characters = (0, sparse_bitfield_1.default)();
+const prohibited_characters = (0, sparse_bitfield_1.default)();
+const bidirectional_r_al = (0, sparse_bitfield_1.default)();
+const bidirectional_l = (0, sparse_bitfield_1.default)();
+function traverse(bits, src) {
+ for (const code of src.keys()) {
+ bits.set(code, true);
+ }
+ const buffer = bits.toBuffer();
+ return Buffer.concat([createSize(buffer), buffer]);
+}
+function createSize(buffer) {
+ const buf = Buffer.alloc(4);
+ buf.writeUInt32BE(buffer.length);
+ return buf;
+}
+const memory = [];
+memory.push(traverse(unassigned_code_points, codePoints.unassigned_code_points), traverse(commonly_mapped_to_nothing, codePoints.commonly_mapped_to_nothing), traverse(non_ascii_space_characters, codePoints.non_ASCII_space_characters), traverse(prohibited_characters, codePoints.prohibited_characters), traverse(bidirectional_r_al, codePoints.bidirectional_r_al), traverse(bidirectional_l, codePoints.bidirectional_l));
+async function writeCodepoints() {
+ const config = await prettier.resolveConfig(__dirname);
+ const formatOptions = { ...config, parser: 'typescript' };
+ function write(stream, chunk) {
+ return new Promise((resolve) => stream.write(chunk, () => resolve()));
+ }
+ await write((0, fs_1.createWriteStream)(process.argv[2]), await prettier.format(`import { gunzipSync } from 'zlib';
+
+ export default gunzipSync(
+ Buffer.from(
+ '${(0, zlib_1.gzipSync)(Buffer.concat(memory), { level: 9 }).toString('base64')}',
+ 'base64'
+ )
+ );
+ `, formatOptions));
+ const fsStreamUncompressedData = (0, fs_1.createWriteStream)(process.argv[3]);
+ await write(fsStreamUncompressedData, await prettier.format(`const data = Buffer.from('${Buffer.concat(memory).toString('base64')}', 'base64');\nexport default data;\n`, formatOptions));
+}
+writeCodepoints().catch((error) => console.error('error occurred generating saslprep codepoint data', { error }));
+//# sourceMappingURL=generate-code-points.js.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/generate-code-points.js.map b/node_modules/@mongodb-js/saslprep/dist/generate-code-points.js.map
new file mode 100644
index 00000000..96b6095d
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/generate-code-points.js.map
@@ -0,0 +1 @@
+{"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KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAEhC,OAAO,CAAC,KAAK,CAAC,mDAAmD,EAAE,EAAE,KAAK,EAAE,CAAC,CAC9E,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/index.d.ts b/node_modules/@mongodb-js/saslprep/dist/index.d.ts
new file mode 100644
index 00000000..24d575c5
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/index.d.ts
@@ -0,0 +1,11 @@
+import type { createMemoryCodePoints } from './memory-code-points';
+declare function saslprep({ unassigned_code_points, commonly_mapped_to_nothing, non_ASCII_space_characters, prohibited_characters, bidirectional_r_al, bidirectional_l, }: ReturnType, input: string, opts?: {
+ allowUnassigned?: boolean;
+}): string;
+declare namespace saslprep {
+ export var saslprep: typeof import(".");
+ var _a: typeof import(".");
+ export { _a as default };
+}
+export = saslprep;
+//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/index.d.ts.map b/node_modules/@mongodb-js/saslprep/dist/index.d.ts.map
new file mode 100644
index 00000000..e53e3946
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/index.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAsCnE,iBAAS,QAAQ,CACf,EACE,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAC5C,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAO,GACvC,MAAM,CAqGR;kBAhHQ,QAAQ;;;;;AAoHjB,SAAS,QAAQ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/index.js b/node_modules/@mongodb-js/saslprep/dist/index.js
new file mode 100644
index 00000000..07d87bc5
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/index.js
@@ -0,0 +1,65 @@
+"use strict";
+const getCodePoint = (character) => character.codePointAt(0);
+const first = (x) => x[0];
+const last = (x) => x[x.length - 1];
+function toCodePoints(input) {
+ const codepoints = [];
+ const size = input.length;
+ for (let i = 0; i < size; i += 1) {
+ const before = input.charCodeAt(i);
+ if (before >= 0xd800 && before <= 0xdbff && size > i + 1) {
+ const next = input.charCodeAt(i + 1);
+ if (next >= 0xdc00 && next <= 0xdfff) {
+ codepoints.push((before - 0xd800) * 0x400 + next - 0xdc00 + 0x10000);
+ i += 1;
+ continue;
+ }
+ }
+ codepoints.push(before);
+ }
+ return codepoints;
+}
+function saslprep({ unassigned_code_points, commonly_mapped_to_nothing, non_ASCII_space_characters, prohibited_characters, bidirectional_r_al, bidirectional_l, }, input, opts = {}) {
+ const mapping2space = non_ASCII_space_characters;
+ const mapping2nothing = commonly_mapped_to_nothing;
+ if (typeof input !== 'string') {
+ throw new TypeError('Expected string.');
+ }
+ if (input.length === 0) {
+ return '';
+ }
+ const mapped_input = toCodePoints(input)
+ .map((character) => (mapping2space.get(character) ? 0x20 : character))
+ .filter((character) => !mapping2nothing.get(character));
+ const normalized_input = String.fromCodePoint
+ .apply(null, mapped_input)
+ .normalize('NFKC');
+ const normalized_map = toCodePoints(normalized_input);
+ const hasProhibited = normalized_map.some((character) => prohibited_characters.get(character));
+ if (hasProhibited) {
+ throw new Error('Prohibited character, see https://tools.ietf.org/html/rfc4013#section-2.3');
+ }
+ if (opts.allowUnassigned !== true) {
+ const hasUnassigned = normalized_map.some((character) => unassigned_code_points.get(character));
+ if (hasUnassigned) {
+ throw new Error('Unassigned code point, see https://tools.ietf.org/html/rfc4013#section-2.5');
+ }
+ }
+ const hasBidiRAL = normalized_map.some((character) => bidirectional_r_al.get(character));
+ const hasBidiL = normalized_map.some((character) => bidirectional_l.get(character));
+ if (hasBidiRAL && hasBidiL) {
+ throw new Error('String must not contain RandALCat and LCat at the same time,' +
+ ' see https://tools.ietf.org/html/rfc3454#section-6');
+ }
+ const isFirstBidiRAL = bidirectional_r_al.get(getCodePoint(first(normalized_input)));
+ const isLastBidiRAL = bidirectional_r_al.get(getCodePoint(last(normalized_input)));
+ if (hasBidiRAL && !(isFirstBidiRAL && isLastBidiRAL)) {
+ throw new Error('Bidirectional RandALCat character must be the first and the last' +
+ ' character of the string, see https://tools.ietf.org/html/rfc3454#section-6');
+ }
+ return normalized_input;
+}
+saslprep.saslprep = saslprep;
+saslprep.default = saslprep;
+module.exports = saslprep;
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/index.js.map b/node_modules/@mongodb-js/saslprep/dist/index.js.map
new file mode 100644
index 00000000..e1867eff
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AACrE,MAAM,KAAK,GAAG,CAA2B,CAAI,EAAa,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,MAAM,IAAI,GAAG,CAA2B,CAAI,EAAa,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAO5E,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;IAE1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QA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kB,CAAC,GAAG,CAC1C,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAE,CACtC,CAAC;IAEF,IAAI,UAAU,IAAI,CAAC,CAAC,cAAc,IAAI,aAAa,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CACb,kEAAkE;YAChE,6EAA6E,CAChF,CAAC;IACJ,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7B,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC;AAC5B,iBAAS,QAAQ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/memory-code-points.d.ts b/node_modules/@mongodb-js/saslprep/dist/memory-code-points.d.ts
new file mode 100644
index 00000000..ef457228
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/memory-code-points.d.ts
@@ -0,0 +1,10 @@
+import bitfield from 'sparse-bitfield';
+export declare function createMemoryCodePoints(data: Buffer): {
+ unassigned_code_points: bitfield.BitFieldInstance;
+ commonly_mapped_to_nothing: bitfield.BitFieldInstance;
+ non_ASCII_space_characters: bitfield.BitFieldInstance;
+ prohibited_characters: bitfield.BitFieldInstance;
+ bidirectional_r_al: bitfield.BitFieldInstance;
+ bidirectional_l: bitfield.BitFieldInstance;
+};
+//# sourceMappingURL=memory-code-points.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/memory-code-points.d.ts.map b/node_modules/@mongodb-js/saslprep/dist/memory-code-points.d.ts.map
new file mode 100644
index 00000000..18ce0f41
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/memory-code-points.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"memory-code-points.d.ts","sourceRoot":"","sources":["../src/memory-code-points.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM;;;;;;;EA+BlD"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/memory-code-points.js b/node_modules/@mongodb-js/saslprep/dist/memory-code-points.js
new file mode 100644
index 00000000..2c6ca0fa
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/memory-code-points.js
@@ -0,0 +1,32 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createMemoryCodePoints = createMemoryCodePoints;
+const sparse_bitfield_1 = __importDefault(require("sparse-bitfield"));
+function createMemoryCodePoints(data) {
+ let offset = 0;
+ function read() {
+ const size = data.readUInt32BE(offset);
+ offset += 4;
+ const codepoints = data.slice(offset, offset + size);
+ offset += size;
+ return (0, sparse_bitfield_1.default)({ buffer: codepoints });
+ }
+ const unassigned_code_points = read();
+ const commonly_mapped_to_nothing = read();
+ const non_ASCII_space_characters = read();
+ const prohibited_characters = read();
+ const bidirectional_r_al = read();
+ const bidirectional_l = read();
+ return {
+ unassigned_code_points,
+ commonly_mapped_to_nothing,
+ non_ASCII_space_characters,
+ prohibited_characters,
+ bidirectional_r_al,
+ bidirectional_l,
+ };
+}
+//# sourceMappingURL=memory-code-points.js.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/memory-code-points.js.map b/node_modules/@mongodb-js/saslprep/dist/memory-code-points.js.map
new file mode 100644
index 00000000..208fd5c7
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/memory-code-points.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"memory-code-points.js","sourceRoot":"","sources":["../src/memory-code-points.ts"],"names":[],"mappings":";;;;;AAEA,wDA+BC;AAjCD,sEAAuC;AAEvC,SAAgB,sBAAsB,CAAC,IAAY;IACjD,IAAI,MAAM,GAAG,CAAC,CAAC;IAKf,SAAS,IAAI;QACX,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,IAAI,CAAC,CAAC;QAEZ,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;QACrD,MAAM,IAAI,IAAI,CAAC;QAEf,OAAO,IAAA,yBAAQ,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,sBAAsB,GAAG,IAAI,EAAE,CAAC;IACtC,MAAM,0BAA0B,GAAG,IAAI,EAAE,CAAC;IAC1C,MAAM,0BAA0B,GAAG,IAAI,EAAE,CAAC;IAC1C,MAAM,qBAAqB,GAAG,IAAI,EAAE,CAAC;IACrC,MAAM,kBAAkB,GAAG,IAAI,EAAE,CAAC;IAClC,MAAM,eAAe,GAAG,IAAI,EAAE,CAAC;IAE/B,OAAO;QACL,sBAAsB;QACtB,0BAA0B;QAC1B,0BAA0B;QAC1B,qBAAqB;QACrB,kBAAkB;QAClB,eAAe;KAChB,CAAC;AACJ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/node.d.ts b/node_modules/@mongodb-js/saslprep/dist/node.d.ts
new file mode 100644
index 00000000..0208c8ed
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/node.d.ts
@@ -0,0 +1,10 @@
+declare function saslprep(input: string, opts?: {
+ allowUnassigned?: boolean;
+}): string;
+declare namespace saslprep {
+ export var saslprep: typeof import("./node");
+ var _a: typeof import("./node");
+ export { _a as default };
+}
+export = saslprep;
+//# sourceMappingURL=node.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/node.d.ts.map b/node_modules/@mongodb-js/saslprep/dist/node.d.ts.map
new file mode 100644
index 00000000..3032ff99
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/node.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAMA,iBAAS,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAE7E;kBAFQ,QAAQ;;;;;AAOjB,SAAS,QAAQ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/node.js b/node_modules/@mongodb-js/saslprep/dist/node.js
new file mode 100644
index 00000000..1007f86b
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/node.js
@@ -0,0 +1,15 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+const index_1 = __importDefault(require("./index"));
+const memory_code_points_1 = require("./memory-code-points");
+const code_points_data_1 = __importDefault(require("./code-points-data"));
+const codePoints = (0, memory_code_points_1.createMemoryCodePoints)(code_points_data_1.default);
+function saslprep(input, opts) {
+ return (0, index_1.default)(codePoints, input, opts);
+}
+saslprep.saslprep = saslprep;
+saslprep.default = saslprep;
+module.exports = saslprep;
+//# sourceMappingURL=node.js.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/node.js.map b/node_modules/@mongodb-js/saslprep/dist/node.js.map
new file mode 100644
index 00000000..107ee648
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/node.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";;;;AAAA,oDAAgC;AAChC,6DAA8D;AAC9D,0EAAsC;AAEtC,MAAM,UAAU,GAAG,IAAA,2CAAsB,EAAC,0BAAI,CAAC,CAAC;AAEhD,SAAS,QAAQ,CAAC,KAAa,EAAE,IAAoC;IACnE,OAAO,IAAA,eAAS,EAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7B,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC;AAE5B,iBAAS,QAAQ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/util.d.ts b/node_modules/@mongodb-js/saslprep/dist/util.d.ts
new file mode 100644
index 00000000..3a0466ec
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/util.d.ts
@@ -0,0 +1,2 @@
+export declare function range(from: number, to: number): number[];
+//# sourceMappingURL=util.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/util.d.ts.map b/node_modules/@mongodb-js/saslprep/dist/util.d.ts.map
new file mode 100644
index 00000000..50c71678
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/util.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAGA,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAQxD"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/util.js b/node_modules/@mongodb-js/saslprep/dist/util.js
new file mode 100644
index 00000000..6db330a0
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/util.js
@@ -0,0 +1,11 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.range = range;
+function range(from, to) {
+ const list = new Array(to - from + 1);
+ for (let i = 0; i < list.length; i += 1) {
+ list[i] = from + i;
+ }
+ return list;
+}
+//# sourceMappingURL=util.js.map
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/dist/util.js.map b/node_modules/@mongodb-js/saslprep/dist/util.js.map
new file mode 100644
index 00000000..f08e43ad
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/dist/util.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;AAGA,sBAQC;AARD,SAAgB,KAAK,CAAC,IAAY,EAAE,EAAU;IAE5C,MAAM,IAAI,GAAG,IAAI,KAAK,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@mongodb-js/saslprep/package.json b/node_modules/@mongodb-js/saslprep/package.json
new file mode 100644
index 00000000..c1d21ccc
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/package.json
@@ -0,0 +1,87 @@
+{
+ "name": "@mongodb-js/saslprep",
+ "description": "SASLprep: Stringprep Profile for User Names and Passwords, rfc4013",
+ "keywords": [
+ "sasl",
+ "saslprep",
+ "stringprep",
+ "rfc4013",
+ "4013"
+ ],
+ "author": "Dmitry Tsvettsikh ",
+ "publishConfig": {
+ "access": "public"
+ },
+ "main": "dist/node.js",
+ "bugs": {
+ "url": "https://jira.mongodb.org/projects/COMPASS/issues",
+ "email": "compass@mongodb.com"
+ },
+ "homepage": "https://github.com/mongodb-js/devtools-shared/tree/main/packages/saslprep",
+ "version": "1.4.11",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mongodb-js/devtools-shared.git"
+ },
+ "files": [
+ "dist"
+ ],
+ "license": "MIT",
+ "exports": {
+ "browser": {
+ "types": "./dist/browser.d.ts",
+ "default": "./dist/browser.js"
+ },
+ "import": {
+ "types": "./dist/node.d.ts",
+ "default": "./dist/.esm-wrapper.mjs"
+ },
+ "require": {
+ "types": "./dist/node.d.ts",
+ "default": "./dist/node.js"
+ }
+ },
+ "types": "./dist/node.d.ts",
+ "scripts": {
+ "gen-code-points": "ts-node src/generate-code-points.ts src/code-points-data.ts src/code-points-data-browser.ts",
+ "bootstrap": "npm run compile",
+ "prepublishOnly": "npm run compile",
+ "compile": "npm run gen-code-points && tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
+ "typecheck": "tsc --noEmit",
+ "eslint": "eslint",
+ "prettier": "prettier",
+ "lint": "npm run eslint . && npm run prettier -- --check .",
+ "depcheck": "depcheck",
+ "check": "npm run typecheck && npm run lint && npm run depcheck",
+ "check-ci": "npm run check",
+ "test": "mocha",
+ "test-cov": "nyc -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",
+ "test-watch": "npm run test -- --watch",
+ "test-ci": "npm run test-cov",
+ "reformat": "npm run prettier -- --write ."
+ },
+ "dependencies": {
+ "sparse-bitfield": "^3.0.3"
+ },
+ "devDependencies": {
+ "@mongodb-js/eslint-config-devtools": "^0.11.7",
+ "@mongodb-js/mocha-config-devtools": "^1.1.2",
+ "@mongodb-js/prettier-config-devtools": "^1.0.3",
+ "@mongodb-js/tsconfig-devtools": "^1.1.2",
+ "@types/chai": "^4.2.21",
+ "@types/mocha": "^9.1.1",
+ "@types/node": "^22.15.30",
+ "@types/sinon-chai": "^4.0.0",
+ "@types/sparse-bitfield": "^3.0.4",
+ "chai": "^4.5.0",
+ "depcheck": "^1.4.7",
+ "eslint": "^7.25.0 || ^8.0.0",
+ "gen-esm-wrapper": "^1.1.3",
+ "mocha": "^8.4.0",
+ "nyc": "^15.1.0",
+ "prettier": "^3.8.1",
+ "sinon": "^9.2.3",
+ "typescript": "^5.9.3"
+ },
+ "gitHead": "93a690e491837611ddf25e0ca91d0169fcb8e7be"
+}
diff --git a/node_modules/@mongodb-js/saslprep/readme.md b/node_modules/@mongodb-js/saslprep/readme.md
new file mode 100644
index 00000000..28539eda
--- /dev/null
+++ b/node_modules/@mongodb-js/saslprep/readme.md
@@ -0,0 +1,29 @@
+# saslprep
+
+_Note: This is a fork of the original [`saslprep`](https://www.npmjs.com/package/saslprep) npm package
+and provides equivalent functionality._
+
+Stringprep Profile for User Names and Passwords, [rfc4013](https://tools.ietf.org/html/rfc4013)
+
+### Usage
+
+```js
+const saslprep = require('@mongodb-js/saslprep');
+
+saslprep('password\u00AD'); // password
+saslprep('password\u0007'); // Error: prohibited character
+```
+
+### API
+
+##### `saslprep(input: String, opts: Options): String`
+
+Normalize user name or password.
+
+##### `Options.allowUnassigned: bool`
+
+A special behavior for unassigned code points, see https://tools.ietf.org/html/rfc4013#section-2.5. Disabled by default.
+
+## License
+
+MIT, 2017-2019 (c) Dmitriy Tsvettsikh
diff --git a/node_modules/@types/webidl-conversions/LICENSE b/node_modules/@types/webidl-conversions/LICENSE
new file mode 100644
index 00000000..9e841e7a
--- /dev/null
+++ b/node_modules/@types/webidl-conversions/LICENSE
@@ -0,0 +1,21 @@
+ MIT License
+
+ Copyright (c) Microsoft Corporation.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
diff --git a/node_modules/@types/webidl-conversions/README.md b/node_modules/@types/webidl-conversions/README.md
new file mode 100644
index 00000000..7cd5c9d6
--- /dev/null
+++ b/node_modules/@types/webidl-conversions/README.md
@@ -0,0 +1,15 @@
+# Installation
+> `npm install --save @types/webidl-conversions`
+
+# Summary
+This package contains type definitions for webidl-conversions (https://github.com/jsdom/webidl-conversions#readme).
+
+# Details
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl-conversions.
+
+### Additional Details
+ * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
+ * Dependencies: none
+
+# Credits
+These definitions were written by [ExE Boss](https://github.com/ExE-Boss), and [BendingBender](https://github.com/BendingBender).
diff --git a/node_modules/@types/webidl-conversions/index.d.ts b/node_modules/@types/webidl-conversions/index.d.ts
new file mode 100644
index 00000000..bcf395ab
--- /dev/null
+++ b/node_modules/@types/webidl-conversions/index.d.ts
@@ -0,0 +1,91 @@
+declare namespace WebIDLConversions {
+ interface Globals {
+ [key: string]: unknown;
+
+ Number: (value?: unknown) => number;
+ String: (value?: unknown) => string;
+ TypeError: new(message?: string) => TypeError;
+ }
+
+ interface Options {
+ context?: string | undefined;
+ globals?: Globals | undefined;
+ }
+
+ interface IntegerOptions extends Options {
+ enforceRange?: boolean | undefined;
+ clamp?: boolean | undefined;
+ }
+
+ interface StringOptions extends Options {
+ treatNullAsEmptyString?: boolean | undefined;
+ }
+
+ interface BufferSourceOptions extends Options {
+ allowShared?: boolean | undefined;
+ }
+
+ type IntegerConversion = (V: unknown, opts?: IntegerOptions) => number;
+ type StringConversion = (V: unknown, opts?: StringOptions) => string;
+ type NumberConversion = (V: unknown, opts?: Options) => number;
+}
+
+declare const WebIDLConversions: {
+ any(V: V, opts?: WebIDLConversions.Options): V;
+ undefined(V?: unknown, opts?: WebIDLConversions.Options): void;
+ boolean(V: unknown, opts?: WebIDLConversions.Options): boolean;
+
+ byte(V: unknown, opts?: WebIDLConversions.IntegerOptions): number;
+ octet(V: unknown, opts?: WebIDLConversions.IntegerOptions): number;
+
+ short(V: unknown, opts?: WebIDLConversions.IntegerOptions): number;
+ ["unsigned short"](V: unknown, opts?: WebIDLConversions.IntegerOptions): number;
+
+ long(V: unknown, opts?: WebIDLConversions.IntegerOptions): number;
+ ["unsigned long"](V: unknown, opts?: WebIDLConversions.IntegerOptions): number;
+
+ ["long long"](V: unknown, opts?: WebIDLConversions.IntegerOptions): number;
+ ["unsigned long long"](V: unknown, opts?: WebIDLConversions.IntegerOptions): number;
+
+ double(V: unknown, opts?: WebIDLConversions.Options): number;
+ ["unrestricted double"](V: unknown, opts?: WebIDLConversions.Options): number;
+
+ float(V: unknown, opts?: WebIDLConversions.Options): number;
+ ["unrestricted float"](V: unknown, opts?: WebIDLConversions.Options): number;
+
+ DOMString(V: unknown, opts?: WebIDLConversions.StringOptions): string;
+ ByteString(V: unknown, opts?: WebIDLConversions.StringOptions): string;
+ USVString(V: unknown, opts?: WebIDLConversions.StringOptions): string;
+
+ object(V: V, opts?: WebIDLConversions.Options): V extends object ? V : V & object;
+ ArrayBuffer(
+ V: unknown,
+ opts?: WebIDLConversions.BufferSourceOptions & { allowShared?: false | undefined },
+ ): ArrayBuffer;
+ ArrayBuffer(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): ArrayBufferLike;
+ DataView(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): DataView;
+
+ Int8Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Int8Array;
+ Int16Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Int16Array;
+ Int32Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Int32Array;
+
+ Uint8Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Uint8Array;
+ Uint16Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Uint16Array;
+ Uint32Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Uint32Array;
+ Uint8ClampedArray(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Uint8ClampedArray;
+
+ Float32Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Float32Array;
+ Float64Array(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): Float64Array;
+
+ ArrayBufferView(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): ArrayBufferView;
+ BufferSource(
+ V: unknown,
+ opts?: WebIDLConversions.BufferSourceOptions & { allowShared?: false | undefined },
+ ): ArrayBuffer | ArrayBufferView;
+ BufferSource(V: unknown, opts?: WebIDLConversions.BufferSourceOptions): ArrayBufferLike | ArrayBufferView;
+
+ DOMTimeStamp(V: unknown, opts?: WebIDLConversions.Options): number;
+};
+
+// This can't use ES6 style exports, as those can't have spaces in export names.
+export = WebIDLConversions;
diff --git a/node_modules/@types/webidl-conversions/package.json b/node_modules/@types/webidl-conversions/package.json
new file mode 100644
index 00000000..21fdb958
--- /dev/null
+++ b/node_modules/@types/webidl-conversions/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "@types/webidl-conversions",
+ "version": "7.0.3",
+ "description": "TypeScript definitions for webidl-conversions",
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl-conversions",
+ "license": "MIT",
+ "contributors": [
+ {
+ "name": "ExE Boss",
+ "githubUsername": "ExE-Boss",
+ "url": "https://github.com/ExE-Boss"
+ },
+ {
+ "name": "BendingBender",
+ "githubUsername": "BendingBender",
+ "url": "https://github.com/BendingBender"
+ }
+ ],
+ "main": "",
+ "types": "index.d.ts",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
+ "directory": "types/webidl-conversions"
+ },
+ "scripts": {},
+ "dependencies": {},
+ "typesPublisherContentHash": "ff1514e10869784e8b7cca9c4099a4213d3f14b48c198b1bf116300df94bf608",
+ "typeScriptVersion": "4.5"
+}
\ No newline at end of file
diff --git a/node_modules/@types/whatwg-url/LICENSE b/node_modules/@types/whatwg-url/LICENSE
new file mode 100644
index 00000000..9e841e7a
--- /dev/null
+++ b/node_modules/@types/whatwg-url/LICENSE
@@ -0,0 +1,21 @@
+ MIT License
+
+ Copyright (c) Microsoft Corporation.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
diff --git a/node_modules/@types/whatwg-url/README.md b/node_modules/@types/whatwg-url/README.md
new file mode 100644
index 00000000..e78395bf
--- /dev/null
+++ b/node_modules/@types/whatwg-url/README.md
@@ -0,0 +1,15 @@
+# Installation
+> `npm install --save @types/whatwg-url`
+
+# Summary
+This package contains type definitions for whatwg-url (https://github.com/jsdom/whatwg-url#readme).
+
+# Details
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/whatwg-url.
+
+### Additional Details
+ * Last updated: Tue, 12 Nov 2024 00:46:36 GMT
+ * Dependencies: [@types/webidl-conversions](https://npmjs.com/package/@types/webidl-conversions)
+
+# Credits
+These definitions were written by [Alexander Marks](https://github.com/aomarks), [ExE Boss](https://github.com/ExE-Boss), and [BendingBender](https://github.com/BendingBender).
diff --git a/node_modules/@types/whatwg-url/index.d.ts b/node_modules/@types/whatwg-url/index.d.ts
new file mode 100644
index 00000000..e8921f84
--- /dev/null
+++ b/node_modules/@types/whatwg-url/index.d.ts
@@ -0,0 +1,172 @@
+///
+/** https://url.spec.whatwg.org/#url-representation */
+export interface URLRecord {
+ scheme: string;
+ username: string;
+ password: string;
+ host: string | number | IPv6Address | null;
+ port: number | null;
+ path: string | string[];
+ query: string | null;
+ fragment: string | null;
+}
+
+/** https://url.spec.whatwg.org/#concept-ipv6 */
+export type IPv6Address = [number, number, number, number, number, number, number, number];
+
+/** https://url.spec.whatwg.org/#url-class */
+export class URL {
+ constructor(url: string, base?: string | URL);
+
+ static canParse(url: string, base?: string): boolean;
+
+ get href(): string;
+ set href(V: string);
+
+ get origin(): string;
+
+ get protocol(): string;
+ set protocol(V: string);
+
+ get username(): string;
+ set username(V: string);
+
+ get password(): string;
+ set password(V: string);
+
+ get host(): string;
+ set host(V: string);
+
+ get hostname(): string;
+ set hostname(V: string);
+
+ get port(): string;
+ set port(V: string);
+
+ get pathname(): string;
+ set pathname(V: string);
+
+ get search(): string;
+ set search(V: string);
+
+ get searchParams(): URLSearchParams;
+
+ get hash(): string;
+ set hash(V: string);
+
+ toJSON(): string;
+
+ readonly [Symbol.toStringTag]: "URL";
+}
+
+/** https://url.spec.whatwg.org/#interface-urlsearchparams */
+export class URLSearchParams {
+ constructor(
+ init?:
+ | ReadonlyArray
+ | Iterable
+ | { readonly [name: string]: string }
+ | string,
+ );
+
+ get size(): number;
+ append(name: string, value: string): void;
+ delete(name: string, value?: string): void;
+ get(name: string): string | null;
+ getAll(name: string): string[];
+ has(name: string, value?: string): boolean;
+ set(name: string, value: string): void;
+ sort(): void;
+
+ keys(): IterableIterator;
+ values(): IterableIterator;
+ entries(): IterableIterator<[name: string, value: string]>;
+ forEach(
+ callback: (this: THIS_ARG, value: string, name: string, searchParams: this) => void,
+ thisArg?: THIS_ARG,
+ ): void;
+
+ readonly [Symbol.toStringTag]: "URLSearchParams";
+ [Symbol.iterator](): IterableIterator<[name: string, value: string]>;
+}
+
+/** https://url.spec.whatwg.org/#concept-url-parser */
+export function parseURL(input: string, options?: { readonly baseURL?: URLRecord | undefined }): URLRecord | null;
+
+/** https://url.spec.whatwg.org/#concept-basic-url-parser */
+export function basicURLParse(
+ input: string,
+ options?: {
+ baseURL?: URLRecord | undefined;
+ url?: URLRecord | undefined;
+ stateOverride?: StateOverride | undefined;
+ },
+): URLRecord | null;
+
+/** https://url.spec.whatwg.org/#scheme-start-state */
+export type StateOverride =
+ | "scheme start"
+ | "scheme"
+ | "no scheme"
+ | "special relative or authority"
+ | "path or authority"
+ | "relative"
+ | "relative slash"
+ | "special authority slashes"
+ | "special authority ignore slashes"
+ | "authority"
+ | "host"
+ | "hostname"
+ | "port"
+ | "file"
+ | "file slash"
+ | "file host"
+ | "path start"
+ | "path"
+ | "opaque path"
+ | "query"
+ | "fragment";
+
+/** https://url.spec.whatwg.org/#concept-url-serializer */
+export function serializeURL(urlRecord: URLRecord, excludeFragment?: boolean): string;
+
+/** https://url.spec.whatwg.org/#concept-host-serializer */
+export function serializeHost(host: string | number | IPv6Address): string;
+
+/** https://url.spec.whatwg.org/#url-path-serializer */
+export function serializePath(urlRecord: URLRecord): string;
+
+/** https://url.spec.whatwg.org/#serialize-an-integer */
+export function serializeInteger(number: number): string;
+
+/** https://html.spec.whatwg.org#ascii-serialisation-of-an-origin */
+export function serializeURLOrigin(urlRecord: URLRecord): string;
+
+/** https://url.spec.whatwg.org/#set-the-username */
+export function setTheUsername(urlRecord: URLRecord, username: string): void;
+
+/** https://url.spec.whatwg.org/#set-the-password */
+export function setThePassword(urlRecord: URLRecord, password: string): void;
+
+/** https://url.spec.whatwg.org/#url-opaque-path */
+export function hasAnOpaquePath(urlRecord: URLRecord): boolean;
+
+/** https://url.spec.whatwg.org/#cannot-have-a-username-password-port */
+export function cannotHaveAUsernamePasswordPort(urlRecord: URLRecord): boolean;
+
+/** https://url.spec.whatwg.org/#percent-decode */
+export function percentDecodeBytes(buffer: TypedArray): Uint8Array;
+
+/** https://url.spec.whatwg.org/#string-percent-decode */
+export function percentDecodeString(string: string): Uint8Array;
+
+export type TypedArray =
+ | Uint8Array
+ | Uint8ClampedArray
+ | Uint16Array
+ | Uint32Array
+ | Int8Array
+ | Int16Array
+ | Int32Array
+ | Float32Array
+ | Float64Array;
diff --git a/node_modules/@types/whatwg-url/lib/URL-impl.d.ts b/node_modules/@types/whatwg-url/lib/URL-impl.d.ts
new file mode 100644
index 00000000..c0bb5984
--- /dev/null
+++ b/node_modules/@types/whatwg-url/lib/URL-impl.d.ts
@@ -0,0 +1,22 @@
+import { Globals } from "webidl-conversions";
+import { implementation as URLSearchParamsImpl } from "./URLSearchParams-impl";
+
+declare class URLImpl {
+ constructor(globalObject: Globals, constructorArgs: readonly [url: string, base?: string]);
+
+ href: string;
+ readonly origin: string;
+ protocol: string;
+ username: string;
+ password: string;
+ host: string;
+ hostname: string;
+ port: string;
+ pathname: string;
+ search: string;
+ readonly searchParams: URLSearchParamsImpl;
+ hash: string;
+
+ toJSON(): string;
+}
+export { URLImpl as implementation };
diff --git a/node_modules/@types/whatwg-url/lib/URL.d.ts b/node_modules/@types/whatwg-url/lib/URL.d.ts
new file mode 100644
index 00000000..85474a70
--- /dev/null
+++ b/node_modules/@types/whatwg-url/lib/URL.d.ts
@@ -0,0 +1,66 @@
+import { URL } from "../index";
+import { implementation as URLImpl } from "./URL-impl";
+
+/**
+ * Checks whether `obj` is a `URL` object with an implementation
+ * provided by this package.
+ */
+export function is(obj: unknown): obj is URL;
+
+/**
+ * Checks whether `obj` is a `URLImpl` WebIDL2JS implementation object
+ * provided by this package.
+ */
+export function isImpl(obj: unknown): obj is URLImpl;
+
+/**
+ * Converts the `URL` wrapper into a `URLImpl` object.
+ *
+ * @throws {TypeError} If `obj` is not a `URL` wrapper instance provided by this package.
+ */
+export function convert(globalObject: object, obj: unknown, { context }?: { context: string }): URLImpl;
+
+/**
+ * Creates a new `URL` instance.
+ *
+ * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
+ * registry or a `URL` constructor provided by this package
+ * in the WebIDL2JS constructor registry.
+ */
+export function create(globalObject: object, constructorArgs: readonly [url: string, base?: string]): URL;
+
+/**
+ * Calls `create()` and returns the internal `URLImpl`.
+ *
+ * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
+ * registry or a `URL` constructor provided by this package
+ * in the WebIDL2JS constructor registry.
+ */
+export function createImpl(globalObject: object, constructorArgs: readonly [url: string, base?: string]): URLImpl;
+
+/**
+ * Initializes the `URL` instance, called by `create()`.
+ *
+ * Useful when manually sub-classing a non-constructable wrapper object.
+ */
+export function setup(
+ obj: T,
+ globalObject: object,
+ constructorArgs: readonly [url: string, base?: string],
+): T;
+
+/**
+ * Creates a new `URL` object without runing the constructor steps.
+ *
+ * Useful when implementing specifications that initialize objects
+ * in different ways than their constructors do.
+ */
+declare function _new(globalObject: object, newTarget?: new(url: string, base?: string) => URL): URLImpl;
+export { _new as new };
+
+/**
+ * Installs the `URL` constructor onto the `globalObject`.
+ *
+ * @throws {Error} If the target `globalObject` doesn't have an `Error` constructor.
+ */
+export function install(globalObject: object, globalNames: readonly string[]): void;
diff --git a/node_modules/@types/whatwg-url/lib/URLSearchParams-impl.d.ts b/node_modules/@types/whatwg-url/lib/URLSearchParams-impl.d.ts
new file mode 100644
index 00000000..cf507011
--- /dev/null
+++ b/node_modules/@types/whatwg-url/lib/URLSearchParams-impl.d.ts
@@ -0,0 +1,20 @@
+declare class URLSearchParamsImpl {
+ constructor(
+ globalObject: object,
+ constructorArgs: readonly [
+ init?: ReadonlyArray | { readonly [name: string]: string } | string,
+ ],
+ privateData: { readonly doNotStripQMark?: boolean | undefined },
+ );
+
+ append(name: string, value: string): void;
+ delete(name: string): void;
+ get(name: string): string | null;
+ getAll(name: string): string[];
+ has(name: string): boolean;
+ set(name: string, value: string): void;
+ sort(): void;
+
+ [Symbol.iterator](): IterableIterator<[name: string, value: string]>;
+}
+export { URLSearchParamsImpl as implementation };
diff --git a/node_modules/@types/whatwg-url/lib/URLSearchParams.d.ts b/node_modules/@types/whatwg-url/lib/URLSearchParams.d.ts
new file mode 100644
index 00000000..8b35d1d1
--- /dev/null
+++ b/node_modules/@types/whatwg-url/lib/URLSearchParams.d.ts
@@ -0,0 +1,92 @@
+import { URLSearchParams } from "../index";
+import { implementation as URLSearchParamsImpl } from "./URLSearchParams-impl";
+
+/**
+ * Checks whether `obj` is a `URLSearchParams` object with an implementation
+ * provided by this package.
+ */
+export function is(obj: unknown): obj is URLSearchParams;
+
+/**
+ * Checks whether `obj` is a `URLSearchParamsImpl` WebIDL2JS implementation object
+ * provided by this package.
+ */
+export function isImpl(obj: unknown): obj is URLSearchParamsImpl;
+
+/**
+ * Converts the `URLSearchParams` wrapper into a `URLSearchParamsImpl` object.
+ *
+ * @throws {TypeError} If `obj` is not a `URLSearchParams` wrapper instance provided by this package.
+ */
+export function convert(globalObject: object, obj: unknown, { context }?: { context: string }): URLSearchParamsImpl;
+
+export function createDefaultIterator(
+ globalObject: object,
+ target: URLSearchParamsImpl,
+ kind: TIteratorKind,
+): IterableIterator;
+
+/**
+ * Creates a new `URLSearchParams` instance.
+ *
+ * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
+ * registry or a `URLSearchParams` constructor provided by this package
+ * in the WebIDL2JS constructor registry.
+ */
+export function create(
+ globalObject: object,
+ constructorArgs?: readonly [
+ init: ReadonlyArray<[name: string, value: string]> | { readonly [name: string]: string } | string,
+ ],
+ privateData?: { doNotStripQMark?: boolean | undefined },
+): URLSearchParams;
+
+/**
+ * Calls `create()` and returns the internal `URLSearchParamsImpl`.
+ *
+ * @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
+ * registry or a `URLSearchParams` constructor provided by this package
+ * in the WebIDL2JS constructor registry.
+ */
+export function createImpl(
+ globalObject: object,
+ constructorArgs?: readonly [
+ init: ReadonlyArray<[name: string, value: string]> | { readonly [name: string]: string } | string,
+ ],
+ privateData?: { doNotStripQMark?: boolean | undefined },
+): URLSearchParamsImpl;
+
+/**
+ * Initializes the `URLSearchParams` instance, called by `create()`.
+ *
+ * Useful when manually sub-classing a non-constructable wrapper object.
+ */
+export function setup(
+ obj: T,
+ globalObject: object,
+ constructorArgs?: readonly [
+ init: ReadonlyArray<[name: string, value: string]> | { readonly [name: string]: string } | string,
+ ],
+ privateData?: { doNotStripQMark?: boolean | undefined },
+): T;
+
+/**
+ * Creates a new `URLSearchParams` object without runing the constructor steps.
+ *
+ * Useful when implementing specifications that initialize objects
+ * in different ways than their constructors do.
+ */
+declare function _new(
+ globalObject: object,
+ newTarget?: new(
+ init: ReadonlyArray<[name: string, value: string]> | { readonly [name: string]: string } | string,
+ ) => URLSearchParams,
+): URLSearchParamsImpl;
+export { _new as new };
+
+/**
+ * Installs the `URLSearchParams` constructor onto the `globalObject`.
+ *
+ * @throws {Error} If the target `globalObject` doesn't have an `Error` constructor.
+ */
+export function install(globalObject: object, globalNames: readonly string[]): void;
diff --git a/node_modules/@types/whatwg-url/package.json b/node_modules/@types/whatwg-url/package.json
new file mode 100644
index 00000000..0f1f317d
--- /dev/null
+++ b/node_modules/@types/whatwg-url/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "@types/whatwg-url",
+ "version": "13.0.0",
+ "description": "TypeScript definitions for whatwg-url",
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/whatwg-url",
+ "license": "MIT",
+ "contributors": [
+ {
+ "name": "Alexander Marks",
+ "githubUsername": "aomarks",
+ "url": "https://github.com/aomarks"
+ },
+ {
+ "name": "ExE Boss",
+ "githubUsername": "ExE-Boss",
+ "url": "https://github.com/ExE-Boss"
+ },
+ {
+ "name": "BendingBender",
+ "githubUsername": "BendingBender",
+ "url": "https://github.com/BendingBender"
+ }
+ ],
+ "main": "",
+ "types": "index.d.ts",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
+ "directory": "types/whatwg-url"
+ },
+ "scripts": {},
+ "dependencies": {
+ "@types/webidl-conversions": "*"
+ },
+ "peerDependencies": {},
+ "typesPublisherContentHash": "fd4818c1b74d8ef43c58e984d60d82658280822821b6ea5d4978f4007f29c39c",
+ "typeScriptVersion": "4.9"
+}
\ No newline at end of file
diff --git a/node_modules/@types/whatwg-url/webidl2js-wrapper.d.ts b/node_modules/@types/whatwg-url/webidl2js-wrapper.d.ts
new file mode 100644
index 00000000..96029b76
--- /dev/null
+++ b/node_modules/@types/whatwg-url/webidl2js-wrapper.d.ts
@@ -0,0 +1,4 @@
+import * as URL from "./lib/URL";
+import * as URLSearchParams from "./lib/URLSearchParams";
+
+export { URL, URLSearchParams };
diff --git a/node_modules/bson/LICENSE.md b/node_modules/bson/LICENSE.md
new file mode 100644
index 00000000..261eeb9e
--- /dev/null
+++ b/node_modules/bson/LICENSE.md
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/node_modules/bson/README.md b/node_modules/bson/README.md
new file mode 100644
index 00000000..8a942407
--- /dev/null
+++ b/node_modules/bson/README.md
@@ -0,0 +1,291 @@
+# BSON parser
+
+BSON is short for "Binary JSON," and is the binary-encoded serialization of JSON-like documents.
+You can learn more about it in [the specification](http://bsonspec.org).
+
+### Table of Contents
+
+- [Usage](#usage)
+- [Bugs/Feature Requests](#bugs--feature-requests)
+- [Installation](#installation)
+- [Documentation](#documentation)
+- [FAQ](#faq)
+
+
+### Release Integrity
+
+Releases are created automatically and signed using the [Node team's GPG key](https://pgp.mongodb.com/node-driver.asc). This applies to the git tag as well as all release packages provided as part of a GitHub release. To verify the provided packages, download the key and import it using gpg:
+
+```shell
+gpg --import node-driver.asc
+```
+
+The GitHub release contains a detached signature file for the NPM package (named
+`bson-X.Y.Z.tgz.sig`).
+
+The following command returns the link npm package.
+```shell
+npm view bson@vX.Y.Z dist.tarball
+```
+
+Using the result of the above command, a `curl` command can return the official npm package for the release.
+
+To verify the integrity of the downloaded package, run the following command:
+```shell
+gpg --verify bson-X.Y.Z.tgz.sig bson-X.Y.Z.tgz
+```
+
+>[!Note]
+No verification is done when using npm to install the package. The contents of the Github tarball and npm's tarball are identical.
+
+## Bugs / Feature Requests
+
+Think you've found a bug? Want to see a new feature in `bson`? Please open a case in our issue management tool, JIRA:
+
+1. Create an account and login: [jira.mongodb.org](https://jira.mongodb.org)
+2. Navigate to the NODE project: [jira.mongodb.org/browse/NODE](https://jira.mongodb.org/browse/NODE)
+3. Click **Create Issue** - Please provide as much information as possible about the issue and how to reproduce it.
+
+Bug reports in JIRA for the NODE driver project are **public**.
+
+## Usage
+
+To build a new version perform the following operations:
+
+```
+npm install
+npm run build
+```
+
+### Node.js or Bundling Usage
+
+When using a bundler or Node.js you can import bson using the package name:
+
+```js
+import { BSON, EJSON, ObjectId } from 'bson';
+// or:
+// const { BSON, EJSON, ObjectId } = require('bson');
+
+const bytes = BSON.serialize({ _id: new ObjectId() });
+console.log(bytes);
+const doc = BSON.deserialize(bytes);
+console.log(EJSON.stringify(doc));
+// {"_id":{"$oid":"..."}}
+```
+
+### Browser Usage
+
+If you are working directly in the browser without a bundler please use the `.mjs` bundle like so:
+
+```html
+
+```
+
+## Installation
+
+```sh
+npm install bson
+```
+
+### MongoDB Node.js Driver Version Compatibility
+
+Only the following version combinations with the [MongoDB Node.js Driver](https://github.com/mongodb/node-mongodb-native) are considered stable.
+
+| | `bson@1.x` | `bson@4.x` | `bson@5.x` | `bson@6.x` | `bson@7.x` |
+| ------------- | ---------- | ---------- | ---------- | ---------- | ---------- |
+| `mongodb@7.x` | N/A | N/A | N/A | N/A | ✓ |
+| `mongodb@6.x` | N/A | N/A | N/A | ✓ | N/A |
+| `mongodb@5.x` | N/A | N/A | ✓ | N/A | N/A |
+| `mongodb@4.x` | N/A | ✓ | N/A | N/A | N/A |
+| `mongodb@3.x` | ✓ | N/A | N/A | N/A | N/A |
+
+## Documentation
+
+### BSON
+
+[API documentation](https://mongodb.github.io/node-mongodb-native/Next/modules/BSON.html)
+
+
+
+### EJSON
+
+- [EJSON](#EJSON)
+
+ - [.parse(text, [options])](#EJSON.parse)
+
+ - [.stringify(value, [replacer], [space], [options])](#EJSON.stringify)
+
+ - [.serialize(bson, [options])](#EJSON.serialize)
+
+ - [.deserialize(ejson, [options])](#EJSON.deserialize)
+
+
+
+#### _EJSON_.parse(text, [options])
+
+| Param | Type | Default | Description |
+| ----------------- | -------------------- | ----------------- | ---------------------------------------------------------------------------------- |
+| text | string | | |
+| [options] | object | | Optional settings |
+| [options.relaxed] | boolean | true | Attempt to return native JS types where possible, rather than BSON types (if true) |
+
+Parse an Extended JSON string, constructing the JavaScript value or object described by that
+string.
+
+**Example**
+
+```js
+const { EJSON } = require('bson');
+const text = '{ "int32": { "$numberInt": "10" } }';
+
+// prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }
+console.log(EJSON.parse(text, { relaxed: false }));
+
+// prints { int32: 10 }
+console.log(EJSON.parse(text));
+```
+
+
+
+#### _EJSON_.stringify(value, [replacer], [space], [options])
+
+| Param | Type | Default | Description |
+| ----------------- | ------------------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| value | object | | The value to convert to extended JSON |
+| [replacer] | function \| array | | A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string |
+| [space] | string \| number | | A String or Number object that's used to insert white space into the output JSON string for readability purposes. |
+| [options] | object | | Optional settings |
+| [options.relaxed] | boolean | true | Enabled Extended JSON's `relaxed` mode |
+| [options.legacy] | boolean | true | Output in Extended JSON v1 |
+
+Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer
+function is specified or optionally including only the specified properties if a replacer array
+is specified.
+
+**Example**
+
+```js
+const { EJSON } = require('bson');
+const Int32 = require('mongodb').Int32;
+const doc = { int32: new Int32(10) };
+
+// prints '{"int32":{"$numberInt":"10"}}'
+console.log(EJSON.stringify(doc, { relaxed: false }));
+
+// prints '{"int32":10}'
+console.log(EJSON.stringify(doc));
+```
+
+
+
+#### _EJSON_.serialize(bson, [options])
+
+| Param | Type | Description |
+| --------- | ------------------- | ---------------------------------------------------- |
+| bson | object | The object to serialize |
+| [options] | object | Optional settings passed to the `stringify` function |
+
+Serializes an object to an Extended JSON string, and reparse it as a JavaScript object.
+
+
+
+#### _EJSON_.deserialize(ejson, [options])
+
+| Param | Type | Description |
+| --------- | ------------------- | -------------------------------------------- |
+| ejson | object | The Extended JSON object to deserialize |
+| [options] | object | Optional settings passed to the parse method |
+
+Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types
+
+## Error Handling
+
+It is our recommendation to use `BSONError.isBSONError()` checks on errors and to avoid relying on parsing `error.message` and `error.name` strings in your code. We guarantee `BSONError.isBSONError()` checks will pass according to semver guidelines, but errors may be sub-classed or their messages may change at any time, even patch releases, as we see fit to increase the helpfulness of the errors.
+
+Any new errors we add to the driver will directly extend an existing error class and no existing error will be moved to a different parent class outside of a major release.
+This means `BSONError.isBSONError()` will always be able to accurately capture the errors that our BSON library throws.
+
+Hypothetical example: A collection in our Db has an issue with UTF-8 data:
+
+```ts
+let documentCount = 0;
+const cursor = collection.find({}, { utf8Validation: true });
+try {
+ for await (const doc of cursor) documentCount += 1;
+} catch (error) {
+ if (BSONError.isBSONError(error)) {
+ console.log(`Found the troublemaker UTF-8!: ${documentCount} ${error.message}`);
+ return documentCount;
+ }
+ throw error;
+}
+```
+
+## React Native
+
+js-bson requires the `atob`, `btoa` and `TextEncoder` globals. Older versions of React Native did not support these global objects, and so
+[js-bson v5.4.0](https://github.com/mongodb/js-bson/releases/tag/v5.4.0) added support for bundled polyfills for these globals. Newer versions
+of Hermes includes these globals, and so the polyfills for are no longer needed in the js-bson package.
+
+If you find yourself on a version of React Native that does not have these globals, either:
+
+1. polyfill them yourself
+2. upgrade to a later version of hermes
+3. use a version of js-bson `>=5.4.0` and `<7.0.0`
+
+One additional polyfill, `crypto.getRandomValues` is recommended and can be installed with the following command:
+
+```sh
+npm install --save react-native-get-random-values
+```
+
+The following snippet should be placed at the top of the entrypoint (by default this is the root `index.js` file) for React Native projects using the BSON library. These lines must be placed for any code that imports `BSON`.
+
+```typescript
+// Required Polyfills For ReactNative
+import 'react-native-get-random-values';
+```
+
+Finally, import the `BSON` library like so:
+
+```typescript
+import { BSON, EJSON } from 'bson';
+```
+
+This will cause React Native to import the `node_modules/bson/lib/bson.rn.cjs` bundle (see the `"react-native"` setting we have in the `"exports"` section of our [package.json](./package.json).)
+
+### Technical Note about React Native module import
+
+The `"exports"` definition in our `package.json` will result in BSON's CommonJS bundle being imported in a React Native project instead of the ES module bundle. Importing the CommonJS bundle is necessary because BSON's ES module bundle of BSON uses top-level await, which is not supported syntax in [React Native's runtime hermes](https://hermesengine.dev/).
+
+## FAQ
+
+#### Why does `undefined` get converted to `null`?
+
+The `undefined` BSON type has been [deprecated for many years](http://bsonspec.org/spec.html), so this library has dropped support for it. Use the `ignoreUndefined` option (for example, from the [driver](http://mongodb.github.io/node-mongodb-native/2.2/api/MongoClient.html#connect) ) to instead remove `undefined` keys.
+
+#### How do I add custom serialization logic?
+
+This library looks for `toBSON()` functions on every path, and calls the `toBSON()` function to get the value to serialize.
+
+```javascript
+const BSON = require('bson');
+
+class CustomSerialize {
+ toBSON() {
+ return 42;
+ }
+}
+
+const obj = { answer: new CustomSerialize() };
+// "{ answer: 42 }"
+console.log(BSON.deserialize(BSON.serialize(obj)));
+```
diff --git a/node_modules/bson/bson.d.ts b/node_modules/bson/bson.d.ts
new file mode 100644
index 00000000..2e3f9649
--- /dev/null
+++ b/node_modules/bson/bson.d.ts
@@ -0,0 +1,1770 @@
+/**
+ * A class representation of the BSON Binary type.
+ * @public
+ * @category BSONType
+ */
+export declare class Binary extends BSONValue {
+ get _bsontype(): 'Binary';
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_DEFAULT */
+ /** Initial buffer default size */
+ static readonly BUFFER_SIZE = 256;
+ /** Default BSON type */
+ static readonly SUBTYPE_DEFAULT = 0;
+ /** Function BSON type */
+ static readonly SUBTYPE_FUNCTION = 1;
+ /**
+ * Legacy default BSON Binary type
+ * @deprecated BSON Binary subtype 2 is deprecated in the BSON specification
+ */
+ static readonly SUBTYPE_BYTE_ARRAY = 2;
+ /** Deprecated UUID BSON type @deprecated Please use SUBTYPE_UUID */
+ static readonly SUBTYPE_UUID_OLD = 3;
+ /** UUID BSON type */
+ static readonly SUBTYPE_UUID = 4;
+ /** MD5 BSON type */
+ static readonly SUBTYPE_MD5 = 5;
+ /** Encrypted BSON type */
+ static readonly SUBTYPE_ENCRYPTED = 6;
+ /** Column BSON type */
+ static readonly SUBTYPE_COLUMN = 7;
+ /** Sensitive BSON type */
+ static readonly SUBTYPE_SENSITIVE = 8;
+ /** Vector BSON type */
+ static readonly SUBTYPE_VECTOR = 9;
+ /** User BSON type */
+ static readonly SUBTYPE_USER_DEFINED = 128;
+ /** datatype of a Binary Vector (subtype: 9) */
+ static readonly VECTOR_TYPE: Readonly<{
+ readonly Int8: 3;
+ readonly Float32: 39;
+ readonly PackedBit: 16;
+ }>;
+ /**
+ * The bytes of the Binary value.
+ *
+ * The format of a Binary value in BSON is defined as:
+ * ```txt
+ * binary ::= int32 subtype (byte*)
+ * ```
+ *
+ * This `buffer` is the "(byte*)" segment.
+ *
+ * Unless the value is subtype 2, then deserialize will read the first 4 bytes as an int32 and set this to the remaining bytes.
+ *
+ * ```txt
+ * binary ::= int32 unsigned_byte(2) int32 (byte*)
+ * ```
+ *
+ * @see https://bsonspec.org/spec.html
+ */
+ buffer: Uint8Array;
+ /**
+ * The binary subtype.
+ *
+ * Current defined values are:
+ *
+ * - `unsigned_byte(0)` Generic binary subtype
+ * - `unsigned_byte(1)` Function
+ * - `unsigned_byte(2)` Binary (Deprecated)
+ * - `unsigned_byte(3)` UUID (Deprecated)
+ * - `unsigned_byte(4)` UUID
+ * - `unsigned_byte(5)` MD5
+ * - `unsigned_byte(6)` Encrypted BSON value
+ * - `unsigned_byte(7)` Compressed BSON column
+ * - `unsigned_byte(8)` Sensitive
+ * - `unsigned_byte(9)` Vector
+ * - `unsigned_byte(128)` - `unsigned_byte(255)` User defined
+ */
+ sub_type: number;
+ /**
+ * The Binary's `buffer` can be larger than the Binary's content.
+ * This property is used to determine where the content ends in the buffer.
+ */
+ position: number;
+ /**
+ * Create a new Binary instance.
+ * @param buffer - a buffer object containing the binary data.
+ * @param subType - the option binary type.
+ */
+ constructor(buffer?: BinarySequence, subType?: number);
+ /**
+ * Updates this binary with byte_value.
+ *
+ * @param byteValue - a single byte we wish to write.
+ */
+ put(byteValue: string | number | Uint8Array | number[]): void;
+ /**
+ * Writes a buffer to the binary.
+ *
+ * @param sequence - a string or buffer to be written to the Binary BSON object.
+ * @param offset - specify the binary of where to write the content.
+ */
+ write(sequence: BinarySequence, offset: number): void;
+ /**
+ * Returns a view of **length** bytes starting at **position**.
+ *
+ * @param position - read from the given position in the Binary.
+ * @param length - the number of bytes to read.
+ */
+ read(position: number, length: number): Uint8Array;
+ /** returns a view of the binary value as a Uint8Array */
+ value(): Uint8Array;
+ /** the length of the binary sequence */
+ length(): number;
+ toJSON(): string;
+ toString(encoding?: 'hex' | 'base64' | 'utf8' | 'utf-8'): string;
+ /* Excluded from this release type: toExtendedJSON */
+ toUUID(): UUID;
+ /** Creates an Binary instance from a hex digit string */
+ static createFromHexString(hex: string, subType?: number): Binary;
+ /** Creates an Binary instance from a base64 string */
+ static createFromBase64(base64: string, subType?: number): Binary;
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+ /**
+ * If this Binary represents a Int8 Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.Int8`),
+ * returns a copy of the bytes in a new Int8Array.
+ *
+ * If the Binary is not a Vector, or the datatype is not Int8, an error is thrown.
+ */
+ toInt8Array(): Int8Array;
+ /**
+ * If this Binary represents a Float32 Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.Float32`),
+ * returns a copy of the bytes in a new Float32Array.
+ *
+ * If the Binary is not a Vector, or the datatype is not Float32, an error is thrown.
+ */
+ toFloat32Array(): Float32Array;
+ /**
+ * If this Binary represents packed bit Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit`),
+ * returns a copy of the bytes that are packed bits.
+ *
+ * Use `toBits` to get the unpacked bits.
+ *
+ * If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown.
+ */
+ toPackedBits(): Uint8Array;
+ /**
+ * If this Binary represents a Packed bit Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit`),
+ * returns a copy of the bit unpacked into a new Int8Array.
+ *
+ * Use `toPackedBits` to get the bits still in packed form.
+ *
+ * If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown.
+ */
+ toBits(): Int8Array;
+ /**
+ * Constructs a Binary representing an Int8 Vector.
+ * @param array - The array to store as a view on the Binary class
+ */
+ static fromInt8Array(array: Int8Array): Binary;
+ /** Constructs a Binary representing an Float32 Vector. */
+ static fromFloat32Array(array: Float32Array): Binary;
+ /**
+ * Constructs a Binary representing a packed bit Vector.
+ *
+ * Use `fromBits` to pack an array of 1s and 0s.
+ */
+ static fromPackedBits(array: Uint8Array, padding?: number): Binary;
+ /**
+ * Constructs a Binary representing an Packed Bit Vector.
+ * @param array - The array of 1s and 0s to pack into the Binary instance
+ */
+ static fromBits(bits: ArrayLike): Binary;
+}
+
+/** @public */
+export declare interface BinaryExtended {
+ $binary: {
+ subType: string;
+ base64: string;
+ };
+}
+
+/** @public */
+export declare interface BinaryExtendedLegacy {
+ $type: string;
+ $binary: string;
+}
+
+/** @public */
+export declare type BinarySequence = Uint8Array | number[];
+
+declare namespace BSON {
+ export {
+ setInternalBufferSize,
+ serialize,
+ serializeWithBufferAndIndex,
+ deserialize,
+ calculateObjectSize,
+ deserializeStream,
+ UUIDExtended,
+ BinaryExtended,
+ BinaryExtendedLegacy,
+ BinarySequence,
+ CodeExtended,
+ DBRefLike,
+ Decimal128Extended,
+ DoubleExtended,
+ EJSONOptions,
+ EJSONOptionsBase,
+ EJSONSerializeOptions,
+ EJSONParseOptions,
+ Int32Extended,
+ LongExtended,
+ MaxKeyExtended,
+ MinKeyExtended,
+ ObjectIdExtended,
+ ObjectIdLike,
+ BSONRegExpExtended,
+ BSONRegExpExtendedLegacy,
+ BSONSymbolExtended,
+ LongWithoutOverrides,
+ TimestampExtended,
+ TimestampOverrides,
+ LongWithoutOverridesClass,
+ SerializeOptions,
+ DeserializeOptions,
+ Code,
+ BSONSymbol,
+ DBRef,
+ Binary,
+ ObjectId,
+ UUID,
+ Long,
+ Timestamp,
+ Double,
+ Int32,
+ MinKey,
+ MaxKey,
+ BSONRegExp,
+ Decimal128,
+ NumberUtils,
+ ByteUtils,
+ BSONValue,
+ bsonType,
+ BSONTypeTag,
+ BSONError,
+ BSONVersionError,
+ BSONRuntimeError,
+ BSONOffsetError,
+ BSONType,
+ EJSON,
+ onDemand,
+ OnDemand,
+ Document,
+ CalculateObjectSizeOptions
+ }
+}
+export { BSON }
+
+/* Excluded from this release type: BSON_MAJOR_VERSION */
+
+/* Excluded from this release type: BSON_VERSION_SYMBOL */
+
+/**
+ * @public
+ * @experimental
+ */
+declare type BSONElement = [
+type: number,
+nameOffset: number,
+nameLength: number,
+offset: number,
+length: number
+];
+
+/**
+ * @public
+ * @category Error
+ *
+ * `BSONError` objects are thrown when BSON encounters an error.
+ *
+ * This is the parent class for all the other errors thrown by this library.
+ */
+export declare class BSONError extends Error {
+ /* Excluded from this release type: bsonError */
+ get name(): string;
+ constructor(message: string, options?: {
+ cause?: unknown;
+ });
+ /**
+ * @public
+ *
+ * All errors thrown from the BSON library inherit from `BSONError`.
+ * This method can assist with determining if an error originates from the BSON library
+ * even if it does not pass an `instanceof` check against this class' constructor.
+ *
+ * @param value - any javascript value that needs type checking
+ */
+ static isBSONError(value: unknown): value is BSONError;
+}
+
+/**
+ * @public
+ * @category Error
+ *
+ * @experimental
+ *
+ * An error generated when BSON bytes are invalid.
+ * Reports the offset the parser was able to reach before encountering the error.
+ */
+export declare class BSONOffsetError extends BSONError {
+ get name(): 'BSONOffsetError';
+ offset: number;
+ constructor(message: string, offset: number, options?: {
+ cause?: unknown;
+ });
+}
+
+/**
+ * A class representation of the BSON RegExp type.
+ * @public
+ * @category BSONType
+ */
+export declare class BSONRegExp extends BSONValue {
+ get _bsontype(): 'BSONRegExp';
+ pattern: string;
+ options: string;
+ /**
+ * @param pattern - The regular expression pattern to match
+ * @param options - The regular expression options
+ */
+ constructor(pattern: string, options?: string);
+ static parseOptions(options?: string): string;
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface BSONRegExpExtended {
+ $regularExpression: {
+ pattern: string;
+ options: string;
+ };
+}
+
+/** @public */
+export declare interface BSONRegExpExtendedLegacy {
+ $regex: string | BSONRegExp;
+ $options: string;
+}
+
+/**
+ * @public
+ * @category Error
+ *
+ * An error generated when BSON functions encounter an unexpected input
+ * or reaches an unexpected/invalid internal state
+ *
+ */
+export declare class BSONRuntimeError extends BSONError {
+ get name(): 'BSONRuntimeError';
+ constructor(message: string);
+}
+
+/**
+ * A class representation of the BSON Symbol type.
+ * @public
+ * @category BSONType
+ */
+export declare class BSONSymbol extends BSONValue {
+ get _bsontype(): 'BSONSymbol';
+ value: string;
+ /**
+ * @param value - the string representing the symbol.
+ */
+ constructor(value: string);
+ /** Access the wrapped string value. */
+ valueOf(): string;
+ toString(): string;
+ toJSON(): string;
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface BSONSymbolExtended {
+ $symbol: string;
+}
+
+/** @public */
+export declare const BSONType: Readonly<{
+ readonly double: 1;
+ readonly string: 2;
+ readonly object: 3;
+ readonly array: 4;
+ readonly binData: 5;
+ readonly undefined: 6;
+ readonly objectId: 7;
+ readonly bool: 8;
+ readonly date: 9;
+ readonly null: 10;
+ readonly regex: 11;
+ readonly dbPointer: 12;
+ readonly javascript: 13;
+ readonly symbol: 14;
+ readonly javascriptWithScope: 15;
+ readonly int: 16;
+ readonly timestamp: 17;
+ readonly long: 18;
+ readonly decimal: 19;
+ readonly minKey: -1;
+ readonly maxKey: 127;
+}>;
+
+/** @public */
+export declare type BSONType = (typeof BSONType)[keyof typeof BSONType];
+
+/** @public */
+export declare const bsonType: unique symbol;
+
+/** @public */
+export declare type BSONTypeTag = 'BSONRegExp' | 'BSONSymbol' | 'ObjectId' | 'Binary' | 'Decimal128' | 'Double' | 'Int32' | 'Long' | 'MaxKey' | 'MinKey' | 'Timestamp' | 'Code' | 'DBRef';
+
+/** @public */
+export declare abstract class BSONValue {
+ /** @public */
+ abstract get _bsontype(): BSONTypeTag;
+ get [bsonType](): this['_bsontype'];
+ /* Excluded from this release type: [BSON_VERSION_SYMBOL] */
+ /**
+ * @public
+ * Prints a human-readable string of BSON value information
+ * If invoked manually without node.js.inspect function, this will default to a modified JSON.stringify
+ */
+ abstract inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+ /* Excluded from this release type: toExtendedJSON */
+}
+
+/**
+ * @public
+ * @category Error
+ */
+export declare class BSONVersionError extends BSONError {
+ get name(): 'BSONVersionError';
+ constructor();
+}
+
+/**
+ * @public
+ * @experimental
+ *
+ * A collection of functions that help work with data in a Uint8Array.
+ * ByteUtils is configured at load time to use Node.js or Web based APIs for the internal implementations.
+ */
+export declare type ByteUtils = {
+ /** Checks if the given value is a Uint8Array. */
+ isUint8Array: (value: unknown) => value is Uint8Array;
+ /** Transforms the input to an instance of Buffer if running on node, otherwise Uint8Array */
+ toLocalBufferType: (buffer: Uint8Array | ArrayBufferView | ArrayBuffer) => Uint8Array;
+ /** Create empty space of size */
+ allocate: (size: number) => Uint8Array;
+ /** Create empty space of size, use pooled memory when available */
+ allocateUnsafe: (size: number) => Uint8Array;
+ /** Compare 2 Uint8Arrays lexicographically */
+ compare: (buffer1: Uint8Array, buffer2: Uint8Array) => -1 | 0 | 1;
+ /** Concatenating all the Uint8Arrays in new Uint8Array. */
+ concat: (list: Uint8Array[]) => Uint8Array;
+ /** Copy bytes from source Uint8Array to target Uint8Array */
+ copy: (source: Uint8Array, target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number) => number;
+ /** Check if two Uint8Arrays are deep equal */
+ equals: (a: Uint8Array, b: Uint8Array) => boolean;
+ /** Create a Uint8Array from an array of numbers */
+ fromNumberArray: (array: number[]) => Uint8Array;
+ /** Create a Uint8Array from a base64 string */
+ fromBase64: (base64: string) => Uint8Array;
+ /** Create a Uint8Array from a UTF8 string */
+ fromUTF8: (utf8: string) => Uint8Array;
+ /** Create a base64 string from bytes */
+ toBase64: (buffer: Uint8Array) => string;
+ /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
+ fromISO88591: (codePoints: string) => Uint8Array;
+ /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
+ toISO88591: (buffer: Uint8Array) => string;
+ /** Create a Uint8Array from a hex string */
+ fromHex: (hex: string) => Uint8Array;
+ /** Create a lowercase hex string from bytes */
+ toHex: (buffer: Uint8Array) => string;
+ /** Create a string from utf8 code units, fatal=true will throw an error if UTF-8 bytes are invalid, fatal=false will insert replacement characters */
+ toUTF8: (buffer: Uint8Array, start: number, end: number, fatal: boolean) => string;
+ /** Get the utf8 code unit count from a string if it were to be transformed to utf8 */
+ utf8ByteLength: (input: string) => number;
+ /** Encode UTF8 bytes generated from `source` string into `destination` at byteOffset. Returns the number of bytes encoded. */
+ encodeUTF8Into: (destination: Uint8Array, source: string, byteOffset: number) => number;
+ /** Generate a Uint8Array filled with random bytes with byteLength */
+ randomBytes: (byteLength: number) => Uint8Array;
+ /** Interprets `buffer` as an array of 32-bit values and swaps the byte order in-place. */
+ swap32: (buffer: Uint8Array) => Uint8Array;
+};
+
+/**
+ * This is the only ByteUtils that should be used across the rest of the BSON library.
+ *
+ * The type annotation is important here, it asserts that each of the platform specific
+ * utils implementations are compatible with the common one.
+ *
+ * @public
+ * @experimental
+ */
+export declare const ByteUtils: ByteUtils;
+
+/**
+ * Calculate the bson size for a passed in Javascript object.
+ *
+ * @param object - the Javascript object to calculate the BSON byte size for
+ * @returns size of BSON object in bytes
+ * @public
+ */
+export declare function calculateObjectSize(object: Document, options?: CalculateObjectSizeOptions): number;
+
+/** @public */
+export declare type CalculateObjectSizeOptions = Pick;
+
+/**
+ * A class representation of the BSON Code type.
+ * @public
+ * @category BSONType
+ */
+export declare class Code extends BSONValue {
+ get _bsontype(): 'Code';
+ code: string;
+ scope: Document | null;
+ /**
+ * @param code - a string or function.
+ * @param scope - an optional scope for the function.
+ */
+ constructor(code: string | Function, scope?: Document | null);
+ toJSON(): {
+ code: string;
+ scope?: Document;
+ };
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface CodeExtended {
+ $code: string;
+ $scope?: Document;
+}
+
+/**
+ * A class representation of the BSON DBRef type.
+ * @public
+ * @category BSONType
+ */
+export declare class DBRef extends BSONValue {
+ get _bsontype(): 'DBRef';
+ collection: string;
+ oid: ObjectId;
+ db?: string;
+ fields: Document;
+ /**
+ * @param collection - the collection name.
+ * @param oid - the reference ObjectId.
+ * @param db - optional db name, if omitted the reference is local to the current db.
+ */
+ constructor(collection: string, oid: ObjectId, db?: string, fields?: Document);
+ /* Excluded from this release type: namespace */
+ /* Excluded from this release type: namespace */
+ toJSON(): DBRefLike & Document;
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface DBRefLike {
+ $ref: string;
+ $id: ObjectId;
+ $db?: string;
+}
+
+/**
+ * A class representation of the BSON Decimal128 type.
+ * @public
+ * @category BSONType
+ */
+export declare class Decimal128 extends BSONValue {
+ get _bsontype(): 'Decimal128';
+ readonly bytes: Uint8Array;
+ /**
+ * @param bytes - a buffer containing the raw Decimal128 bytes in little endian order,
+ * or a string representation as returned by .toString()
+ */
+ constructor(bytes: Uint8Array | string);
+ /**
+ * Create a Decimal128 instance from a string representation
+ *
+ * @param representation - a numeric string representation.
+ */
+ static fromString(representation: string): Decimal128;
+ /**
+ * Create a Decimal128 instance from a string representation, allowing for rounding to 34
+ * significant digits
+ *
+ * @example Example of a number that will be rounded
+ * ```ts
+ * > let d = Decimal128.fromString('37.499999999999999196428571428571375')
+ * Uncaught:
+ * BSONError: "37.499999999999999196428571428571375" is not a valid Decimal128 string - inexact rounding
+ * at invalidErr (/home/wajames/js-bson/lib/bson.cjs:1402:11)
+ * at Decimal128.fromStringInternal (/home/wajames/js-bson/lib/bson.cjs:1633:25)
+ * at Decimal128.fromString (/home/wajames/js-bson/lib/bson.cjs:1424:27)
+ *
+ * > d = Decimal128.fromStringWithRounding('37.499999999999999196428571428571375')
+ * new Decimal128("37.49999999999999919642857142857138")
+ * ```
+ * @param representation - a numeric string representation.
+ */
+ static fromStringWithRounding(representation: string): Decimal128;
+ private static _fromString;
+ /** Create a string representation of the raw Decimal128 value */
+ toString(): string;
+ toJSON(): Decimal128Extended;
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface Decimal128Extended {
+ $numberDecimal: string;
+}
+
+/**
+ * Deserialize data as BSON.
+ *
+ * @param buffer - the buffer containing the serialized set of BSON documents.
+ * @returns returns the deserialized Javascript Object.
+ * @public
+ */
+export declare function deserialize(buffer: Uint8Array, options?: DeserializeOptions): Document;
+
+/** @public */
+export declare interface DeserializeOptions {
+ /**
+ * when deserializing a Long return as a BigInt.
+ * @defaultValue `false`
+ */
+ useBigInt64?: boolean;
+ /**
+ * when deserializing a Long will fit it into a Number if it's smaller than 53 bits.
+ * @defaultValue `true`
+ */
+ promoteLongs?: boolean;
+ /**
+ * when deserializing a Binary will return it as a node.js Buffer instance.
+ * @defaultValue `false`
+ */
+ promoteBuffers?: boolean;
+ /**
+ * when deserializing will promote BSON values to their Node.js closest equivalent types.
+ * @defaultValue `true`
+ */
+ promoteValues?: boolean;
+ /**
+ * allow to specify if there what fields we wish to return as unserialized raw buffer.
+ * @defaultValue `null`
+ */
+ fieldsAsRaw?: Document;
+ /**
+ * return BSON regular expressions as BSONRegExp instances.
+ * @defaultValue `false`
+ */
+ bsonRegExp?: boolean;
+ /**
+ * allows the buffer to be larger than the parsed BSON object.
+ * @defaultValue `false`
+ */
+ allowObjectSmallerThanBufferSize?: boolean;
+ /**
+ * Offset into buffer to begin reading document from
+ * @defaultValue `0`
+ */
+ index?: number;
+ raw?: boolean;
+ /** Allows for opt-out utf-8 validation for all keys or
+ * specified keys. Must be all true or all false.
+ *
+ * @example
+ * ```js
+ * // disables validation on all keys
+ * validation: { utf8: false }
+ *
+ * // enables validation only on specified keys a, b, and c
+ * validation: { utf8: { a: true, b: true, c: true } }
+ *
+ * // disables validation only on specified keys a, b
+ * validation: { utf8: { a: false, b: false } }
+ * ```
+ */
+ validation?: {
+ utf8: boolean | Record | Record;
+ };
+}
+
+/**
+ * Deserialize stream data as BSON documents.
+ *
+ * @param data - the buffer containing the serialized set of BSON documents.
+ * @param startIndex - the start index in the data Buffer where the deserialization is to start.
+ * @param numberOfDocuments - number of documents to deserialize.
+ * @param documents - an array where to store the deserialized documents.
+ * @param docStartIndex - the index in the documents array from where to start inserting documents.
+ * @param options - additional options used for the deserialization.
+ * @returns next index in the buffer after deserialization **x** numbers of documents.
+ * @public
+ */
+export declare function deserializeStream(data: Uint8Array | ArrayBuffer, startIndex: number, numberOfDocuments: number, documents: Document[], docStartIndex: number, options: DeserializeOptions): number;
+
+/** @public */
+export declare interface Document {
+ [key: string]: any;
+}
+
+/**
+ * A class representation of the BSON Double type.
+ * @public
+ * @category BSONType
+ */
+export declare class Double extends BSONValue {
+ get _bsontype(): 'Double';
+ value: number;
+ /**
+ * Create a Double type
+ *
+ * @param value - the number we want to represent as a double.
+ */
+ constructor(value: number);
+ /**
+ * Attempt to create an double type from string.
+ *
+ * This method will throw a BSONError on any string input that is not representable as a IEEE-754 64-bit double.
+ * Notably, this method will also throw on the following string formats:
+ * - Strings in non-decimal and non-exponential formats (binary, hex, or octal digits)
+ * - Strings with characters other than numeric, floating point, or leading sign characters (Note: 'Infinity', '-Infinity', and 'NaN' input strings are still allowed)
+ * - Strings with leading and/or trailing whitespace
+ *
+ * Strings with leading zeros, however, are also allowed
+ *
+ * @param value - the string we want to represent as a double.
+ */
+ static fromString(value: string): Double;
+ /**
+ * Access the number value.
+ *
+ * @returns returns the wrapped double number.
+ */
+ valueOf(): number;
+ toJSON(): number;
+ toString(radix?: number): string;
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface DoubleExtended {
+ $numberDouble: string;
+}
+
+/** @public */
+export declare const EJSON: {
+ parse: typeof parse;
+ stringify: typeof stringify;
+ serialize: typeof EJSONserialize;
+ deserialize: typeof EJSONdeserialize;
+};
+
+/**
+ * Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types
+ *
+ * @param ejson - The Extended JSON object to deserialize
+ * @param options - Optional settings passed to the parse method
+ */
+declare function EJSONdeserialize(ejson: Document, options?: EJSONParseOptions): any;
+
+/** @public */
+export declare type EJSONOptions = EJSONSerializeOptions & EJSONParseOptions;
+
+/** @public */
+export declare type EJSONOptionsBase = {
+ /**
+ * Output using the Extended JSON v1 spec
+ * @defaultValue `false`
+ */
+ legacy?: boolean;
+ /**
+ * Enable Extended JSON's `relaxed` mode, which attempts to return native JS types where possible, rather than BSON types
+ * @defaultValue `false`
+ */
+ relaxed?: boolean;
+};
+
+/** @public */
+export declare type EJSONParseOptions = EJSONOptionsBase & {
+ /**
+ * Enable native bigint support
+ * @defaultValue `false`
+ */
+ useBigInt64?: boolean;
+};
+
+/**
+ * Serializes an object to an Extended JSON string, and reparse it as a JavaScript object.
+ *
+ * @param value - The object to serialize
+ * @param options - Optional settings passed to the `stringify` function
+ */
+declare function EJSONserialize(value: any, options?: EJSONSerializeOptions): Document;
+
+/** @public */
+export declare type EJSONSerializeOptions = EJSONOptionsBase & {
+ /**
+ * Omits undefined values from the output instead of converting them to null
+ * @defaultValue `false`
+ */
+ ignoreUndefined?: boolean;
+};
+
+declare type InspectFn = (x: unknown, options?: unknown) => string;
+
+/**
+ * A class representation of a BSON Int32 type.
+ * @public
+ * @category BSONType
+ */
+export declare class Int32 extends BSONValue {
+ get _bsontype(): 'Int32';
+ value: number;
+ /**
+ * Create an Int32 type
+ *
+ * @param value - the number we want to represent as an int32.
+ */
+ constructor(value: number | string);
+ /**
+ * Attempt to create an Int32 type from string.
+ *
+ * This method will throw a BSONError on any string input that is not representable as an Int32.
+ * Notably, this method will also throw on the following string formats:
+ * - Strings in non-decimal formats (exponent notation, binary, hex, or octal digits)
+ * - Strings non-numeric and non-leading sign characters (ex: '2.0', '24,000')
+ * - Strings with leading and/or trailing whitespace
+ *
+ * Strings with leading zeros, however, are allowed.
+ *
+ * @param value - the string we want to represent as an int32.
+ */
+ static fromString(value: string): Int32;
+ /**
+ * Access the number value.
+ *
+ * @returns returns the wrapped int32 number.
+ */
+ valueOf(): number;
+ toString(radix?: number): string;
+ toJSON(): number;
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface Int32Extended {
+ $numberInt: string;
+}
+
+/**
+ * A class representing a 64-bit integer
+ * @public
+ * @category BSONType
+ * @remarks
+ * The internal representation of a long is the two given signed, 32-bit values.
+ * We use 32-bit pieces because these are the size of integers on which
+ * Javascript performs bit-operations. For operations like addition and
+ * multiplication, we split each number into 16 bit pieces, which can easily be
+ * multiplied within Javascript's floating-point representation without overflow
+ * or change in sign.
+ * In the algorithms below, we frequently reduce the negative case to the
+ * positive case by negating the input(s) and then post-processing the result.
+ * Note that we must ALWAYS check specially whether those values are MIN_VALUE
+ * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
+ * a positive number, it overflows back into a negative). Not handling this
+ * case would often result in infinite recursion.
+ * Common constant values ZERO, ONE, NEG_ONE, etc. are found as static properties on this class.
+ */
+export declare class Long extends BSONValue {
+ get _bsontype(): 'Long';
+ /** An indicator used to reliably determine if an object is a Long or not. */
+ get __isLong__(): boolean;
+ /**
+ * The high 32 bits as a signed value.
+ */
+ high: number;
+ /**
+ * The low 32 bits as a signed value.
+ */
+ low: number;
+ /**
+ * Whether unsigned or not.
+ */
+ unsigned: boolean;
+ /**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
+ *
+ * @param low - The low (signed) 32 bits of the long
+ * @param high - The high (signed) 32 bits of the long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ */
+ constructor(low: number, high?: number, unsigned?: boolean);
+ /**
+ * Constructs a 64 bit two's-complement integer, given a bigint representation.
+ *
+ * @param value - BigInt representation of the long value
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ */
+ constructor(value: bigint, unsigned?: boolean);
+ /**
+ * Constructs a 64 bit two's-complement integer, given a string representation.
+ *
+ * @param value - String representation of the long value
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ */
+ constructor(value: string, unsigned?: boolean);
+ static TWO_PWR_24: Long;
+ /** Maximum unsigned value. */
+ static MAX_UNSIGNED_VALUE: Long;
+ /** Signed zero */
+ static ZERO: Long;
+ /** Unsigned zero. */
+ static UZERO: Long;
+ /** Signed one. */
+ static ONE: Long;
+ /** Unsigned one. */
+ static UONE: Long;
+ /** Signed negative one. */
+ static NEG_ONE: Long;
+ /** Maximum signed value. */
+ static MAX_VALUE: Long;
+ /** Minimum signed value. */
+ static MIN_VALUE: Long;
+ /**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits.
+ * Each is assumed to use 32 bits.
+ * @param lowBits - The low 32 bits
+ * @param highBits - The high 32 bits
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
+ /**
+ * Returns a Long representing the given 32 bit integer value.
+ * @param value - The 32 bit integer in question
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromInt(value: number, unsigned?: boolean): Long;
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ * @param value - The number in question
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromNumber(value: number, unsigned?: boolean): Long;
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ * @param value - The number in question
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromBigInt(value: bigint, unsigned?: boolean): Long;
+ /* Excluded from this release type: _fromString */
+ /**
+ * Returns a signed Long representation of the given string, written using radix 10.
+ * Will throw an error if the given text is not exactly representable as a Long.
+ * Throws an error if any of the following conditions are true:
+ * - the string contains invalid characters for the radix 10
+ * - the string contains whitespace
+ * - the value the string represents is too large or too small to be a Long
+ * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero
+ * @param str - The textual representation of the Long
+ * @returns The corresponding Long value
+ */
+ static fromStringStrict(str: string): Long;
+ /**
+ * Returns a Long representation of the given string, written using the radix 10.
+ * Will throw an error if the given parameters are not exactly representable as a Long.
+ * Throws an error if any of the following conditions are true:
+ * - the string contains invalid characters for the given radix
+ * - the string contains whitespace
+ * - the value the string represents is too large or too small to be a Long
+ * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero
+ * @param str - The textual representation of the Long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromStringStrict(str: string, unsigned?: boolean): Long;
+ /**
+ * Returns a signed Long representation of the given string, written using the specified radix.
+ * Will throw an error if the given parameters are not exactly representable as a Long.
+ * Throws an error if any of the following conditions are true:
+ * - the string contains invalid characters for the given radix
+ * - the string contains whitespace
+ * - the value the string represents is too large or too small to be a Long
+ * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero
+ * @param str - The textual representation of the Long
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ * @returns The corresponding Long value
+ */
+ static fromStringStrict(str: string, radix?: boolean): Long;
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ * Will throw an error if the given parameters are not exactly representable as a Long.
+ * Throws an error if any of the following conditions are true:
+ * - the string contains invalid characters for the given radix
+ * - the string contains whitespace
+ * - the value the string represents is too large or too small to be a Long
+ * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero
+ * @param str - The textual representation of the Long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ * @returns The corresponding Long value
+ */
+ static fromStringStrict(str: string, unsigned?: boolean, radix?: number): Long;
+ /**
+ * Returns a signed Long representation of the given string, written using radix 10.
+ *
+ * If the input string is empty, this function will throw a BSONError.
+ *
+ * If input string does not have valid signed 64-bit Long representation, this method will return a coerced value:
+ * - inputs that overflow 64-bit signed long will be coerced to Long.MAX_VALUE and Long.MIN_VALUE respectively
+ * - 'NaN' or '+/-Infinity' are coerced to Long.ZERO
+ * - other invalid characters sequences have variable behavior
+ *
+ * @param str - The textual representation of the Long
+ * @returns The corresponding Long value
+ */
+ static fromString(str: string): Long;
+ /**
+ * Returns a signed Long representation of the given string, written using the provided radix.
+ *
+ * If the input string is empty or a provided radix is not within (2-36), this function will throw a BSONError.
+ *
+ * If input parameters do not have valid signed 64-bit Long representation, this method will return a coerced value:
+ * - inputs that overflow 64-bit signed long will be coerced to Long.MAX_VALUE and Long.MIN_VALUE respectively
+ * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO
+ * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO
+ * - other invalid characters sequences have variable behavior
+ * @param str - The textual representation of the Long
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ * @returns The corresponding Long value
+ */
+ static fromString(str: string, radix?: number): Long;
+ /**
+ * Returns a Long representation of the given string, written using radix 10.
+ *
+ * If the input string is empty, this function will throw a BSONError.
+ *
+ * If input parameters do not have a valid 64-bit Long representation, this method will return a coerced value:
+ * - inputs that overflow 64-bit long will be coerced to max or min (if signed) values
+ * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO
+ * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO
+ * - other invalid characters sequences have variable behavior
+ * @param str - The textual representation of the Long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromString(str: string, unsigned?: boolean): Long;
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ *
+ * If the input string is empty or a provided radix is not within (2-36), this function will throw a BSONError.
+ *
+ * If input parameters do not have a valid 64-bit Long representation, this method will return a coerced value:
+ * - inputs that overflow 64-bit long will be coerced to max or min (if signed) values
+ * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO
+ * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO
+ * - other invalid characters sequences have variable behavior
+ * @param str - The textual representation of the Long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ * @returns The corresponding Long value
+ */
+ static fromString(str: string, unsigned?: boolean, radix?: number): Long;
+ /**
+ * Creates a Long from its byte representation.
+ * @param bytes - Byte representation
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @param le - Whether little or big endian, defaults to big endian
+ * @returns The corresponding Long value
+ */
+ static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long;
+ /**
+ * Creates a Long from its little endian byte representation.
+ * @param bytes - Little endian byte representation
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromBytesLE(bytes: number[], unsigned?: boolean): Long;
+ /**
+ * Creates a Long from its big endian byte representation.
+ * @param bytes - Big endian byte representation
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromBytesBE(bytes: number[], unsigned?: boolean): Long;
+ /**
+ * Tests if the specified object is a Long.
+ */
+ static isLong(value: unknown): value is Long;
+ /**
+ * Converts the specified value to a Long.
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ */
+ static fromValue(val: number | string | {
+ low: number;
+ high: number;
+ unsigned?: boolean;
+ }, unsigned?: boolean): Long;
+ /** Returns the sum of this and the specified Long. */
+ add(addend: string | number | Long | Timestamp): Long;
+ /**
+ * Returns the sum of this and the specified Long.
+ * @returns Sum
+ */
+ and(other: string | number | Long | Timestamp): Long;
+ /**
+ * Compares this Long's value with the specified's.
+ * @returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
+ */
+ compare(other: string | number | Long | Timestamp): 0 | 1 | -1;
+ /** This is an alias of {@link Long.compare} */
+ comp(other: string | number | Long | Timestamp): 0 | 1 | -1;
+ /**
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned.
+ * @returns Quotient
+ */
+ divide(divisor: string | number | Long | Timestamp): Long;
+ /**This is an alias of {@link Long.divide} */
+ div(divisor: string | number | Long | Timestamp): Long;
+ /**
+ * Tests if this Long's value equals the specified's.
+ * @param other - Other value
+ */
+ equals(other: string | number | Long | Timestamp): boolean;
+ /** This is an alias of {@link Long.equals} */
+ eq(other: string | number | Long | Timestamp): boolean;
+ /** Gets the high 32 bits as a signed integer. */
+ getHighBits(): number;
+ /** Gets the high 32 bits as an unsigned integer. */
+ getHighBitsUnsigned(): number;
+ /** Gets the low 32 bits as a signed integer. */
+ getLowBits(): number;
+ /** Gets the low 32 bits as an unsigned integer. */
+ getLowBitsUnsigned(): number;
+ /** Gets the number of bits needed to represent the absolute value of this Long. */
+ getNumBitsAbs(): number;
+ /** Tests if this Long's value is greater than the specified's. */
+ greaterThan(other: string | number | Long | Timestamp): boolean;
+ /** This is an alias of {@link Long.greaterThan} */
+ gt(other: string | number | Long | Timestamp): boolean;
+ /** Tests if this Long's value is greater than or equal the specified's. */
+ greaterThanOrEqual(other: string | number | Long | Timestamp): boolean;
+ /** This is an alias of {@link Long.greaterThanOrEqual} */
+ gte(other: string | number | Long | Timestamp): boolean;
+ /** This is an alias of {@link Long.greaterThanOrEqual} */
+ ge(other: string | number | Long | Timestamp): boolean;
+ /** Tests if this Long's value is even. */
+ isEven(): boolean;
+ /** Tests if this Long's value is negative. */
+ isNegative(): boolean;
+ /** Tests if this Long's value is odd. */
+ isOdd(): boolean;
+ /** Tests if this Long's value is positive. */
+ isPositive(): boolean;
+ /** Tests if this Long's value equals zero. */
+ isZero(): boolean;
+ /** Tests if this Long's value is less than the specified's. */
+ lessThan(other: string | number | Long | Timestamp): boolean;
+ /** This is an alias of {@link Long#lessThan}. */
+ lt(other: string | number | Long | Timestamp): boolean;
+ /** Tests if this Long's value is less than or equal the specified's. */
+ lessThanOrEqual(other: string | number | Long | Timestamp): boolean;
+ /** This is an alias of {@link Long.lessThanOrEqual} */
+ lte(other: string | number | Long | Timestamp): boolean;
+ /** Returns this Long modulo the specified. */
+ modulo(divisor: string | number | Long | Timestamp): Long;
+ /** This is an alias of {@link Long.modulo} */
+ mod(divisor: string | number | Long | Timestamp): Long;
+ /** This is an alias of {@link Long.modulo} */
+ rem(divisor: string | number | Long | Timestamp): Long;
+ /**
+ * Returns the product of this and the specified Long.
+ * @param multiplier - Multiplier
+ * @returns Product
+ */
+ multiply(multiplier: string | number | Long | Timestamp): Long;
+ /** This is an alias of {@link Long.multiply} */
+ mul(multiplier: string | number | Long | Timestamp): Long;
+ /** Returns the Negation of this Long's value. */
+ negate(): Long;
+ /** This is an alias of {@link Long.negate} */
+ neg(): Long;
+ /** Returns the bitwise NOT of this Long. */
+ not(): Long;
+ /** Tests if this Long's value differs from the specified's. */
+ notEquals(other: string | number | Long | Timestamp): boolean;
+ /** This is an alias of {@link Long.notEquals} */
+ neq(other: string | number | Long | Timestamp): boolean;
+ /** This is an alias of {@link Long.notEquals} */
+ ne(other: string | number | Long | Timestamp): boolean;
+ /**
+ * Returns the bitwise OR of this Long and the specified.
+ */
+ or(other: number | string | Long): Long;
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ * @param numBits - Number of bits
+ * @returns Shifted Long
+ */
+ shiftLeft(numBits: number | Long): Long;
+ /** This is an alias of {@link Long.shiftLeft} */
+ shl(numBits: number | Long): Long;
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ * @param numBits - Number of bits
+ * @returns Shifted Long
+ */
+ shiftRight(numBits: number | Long): Long;
+ /** This is an alias of {@link Long.shiftRight} */
+ shr(numBits: number | Long): Long;
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ * @param numBits - Number of bits
+ * @returns Shifted Long
+ */
+ shiftRightUnsigned(numBits: Long | number): Long;
+ /** This is an alias of {@link Long.shiftRightUnsigned} */
+ shr_u(numBits: number | Long): Long;
+ /** This is an alias of {@link Long.shiftRightUnsigned} */
+ shru(numBits: number | Long): Long;
+ /**
+ * Returns the difference of this and the specified Long.
+ * @param subtrahend - Subtrahend
+ * @returns Difference
+ */
+ subtract(subtrahend: string | number | Long | Timestamp): Long;
+ /** This is an alias of {@link Long.subtract} */
+ sub(subtrahend: string | number | Long | Timestamp): Long;
+ /** Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. */
+ toInt(): number;
+ /** Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). */
+ toNumber(): number;
+ /** Converts the Long to a BigInt (arbitrary precision). */
+ toBigInt(): bigint;
+ /**
+ * Converts this Long to its byte representation.
+ * @param le - Whether little or big endian, defaults to big endian
+ * @returns Byte representation
+ */
+ toBytes(le?: boolean): number[];
+ /**
+ * Converts this Long to its little endian byte representation.
+ * @returns Little endian byte representation
+ */
+ toBytesLE(): number[];
+ /**
+ * Converts this Long to its big endian byte representation.
+ * @returns Big endian byte representation
+ */
+ toBytesBE(): number[];
+ /**
+ * Converts this Long to signed.
+ */
+ toSigned(): Long;
+ /**
+ * Converts the Long to a string written in the specified radix.
+ * @param radix - Radix (2-36), defaults to 10
+ * @throws RangeError If `radix` is out of range
+ */
+ toString(radix?: number): string;
+ /** Converts this Long to unsigned. */
+ toUnsigned(): Long;
+ /** Returns the bitwise XOR of this Long and the given one. */
+ xor(other: Long | number | string): Long;
+ /** This is an alias of {@link Long.isZero} */
+ eqz(): boolean;
+ /** This is an alias of {@link Long.lessThanOrEqual} */
+ le(other: string | number | Long | Timestamp): boolean;
+ toExtendedJSON(options?: EJSONOptions): number | LongExtended;
+ static fromExtendedJSON(doc: {
+ $numberLong: string;
+ }, options?: EJSONOptions): number | Long | bigint;
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface LongExtended {
+ $numberLong: string;
+}
+
+/** @public */
+export declare type LongWithoutOverrides = new (low: unknown, high?: number | boolean, unsigned?: boolean) => {
+ [P in Exclude]: Long[P];
+};
+
+/** @public */
+export declare const LongWithoutOverridesClass: LongWithoutOverrides;
+
+/**
+ * A class representation of the BSON MaxKey type.
+ * @public
+ * @category BSONType
+ */
+export declare class MaxKey extends BSONValue {
+ get _bsontype(): 'MaxKey';
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(): string;
+}
+
+/** @public */
+export declare interface MaxKeyExtended {
+ $maxKey: 1;
+}
+
+/**
+ * A class representation of the BSON MinKey type.
+ * @public
+ * @category BSONType
+ */
+export declare class MinKey extends BSONValue {
+ get _bsontype(): 'MinKey';
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(): string;
+}
+
+/** @public */
+export declare interface MinKeyExtended {
+ $minKey: 1;
+}
+
+/**
+ * @experimental
+ * @public
+ *
+ * A collection of functions that get or set various numeric types and bit widths from a Uint8Array.
+ */
+export declare type NumberUtils = {
+ /** Is true if the current system is big endian. */
+ isBigEndian: boolean;
+ /**
+ * Parses a signed int32 at offset. Throws a `RangeError` if value is negative.
+ */
+ getNonnegativeInt32LE: (source: Uint8Array, offset: number) => number;
+ getInt32LE: (source: Uint8Array, offset: number) => number;
+ getUint32LE: (source: Uint8Array, offset: number) => number;
+ getUint32BE: (source: Uint8Array, offset: number) => number;
+ getBigInt64LE: (source: Uint8Array, offset: number) => bigint;
+ getFloat64LE: (source: Uint8Array, offset: number) => number;
+ setInt32BE: (destination: Uint8Array, offset: number, value: number) => 4;
+ setInt32LE: (destination: Uint8Array, offset: number, value: number) => 4;
+ setBigInt64LE: (destination: Uint8Array, offset: number, value: bigint) => 8;
+ setFloat64LE: (destination: Uint8Array, offset: number, value: number) => 8;
+};
+
+/**
+ * Number parsing and serializing utilities.
+ *
+ * @experimental
+ * @public
+ */
+export declare const NumberUtils: NumberUtils;
+
+/**
+ * A class representation of the BSON ObjectId type.
+ * @public
+ * @category BSONType
+ */
+export declare class ObjectId extends BSONValue {
+ get _bsontype(): 'ObjectId';
+ /* Excluded from this release type: index */
+ static cacheHexString: boolean;
+ /* Excluded from this release type: buffer */
+ /** To generate a new ObjectId, use ObjectId() with no argument. */
+ constructor();
+ /**
+ * Create ObjectId from a 24 character hex string.
+ *
+ * @param inputId - A 24 character hex string.
+ */
+ constructor(inputId: string);
+ /**
+ * Create ObjectId from the BSON ObjectId type.
+ *
+ * @param inputId - The BSON ObjectId type.
+ */
+ constructor(inputId: ObjectId);
+ /**
+ * Create ObjectId from the object type that has the toHexString method.
+ *
+ * @param inputId - The ObjectIdLike type.
+ */
+ constructor(inputId: ObjectIdLike);
+ /**
+ * Create ObjectId from a 12 byte binary Buffer.
+ *
+ * @param inputId - A 12 byte binary Buffer.
+ */
+ constructor(inputId: Uint8Array);
+ /**
+ * Implementation overload.
+ *
+ * @param inputId - All input types that are used in the constructor implementation.
+ */
+ constructor(inputId?: string | ObjectId | ObjectIdLike | Uint8Array);
+ /**
+ * The ObjectId bytes
+ * @readonly
+ */
+ get id(): Uint8Array;
+ set id(value: Uint8Array);
+ /* Excluded from this release type: validateHexString */
+ /** Returns the ObjectId id as a 24 lowercase character hex string representation */
+ toHexString(): string;
+ /* Excluded from this release type: getInc */
+ /**
+ * Generate a 12 byte id buffer used in ObjectId's
+ *
+ * @param time - pass in a second based timestamp.
+ */
+ static generate(time?: number): Uint8Array;
+ /**
+ * Converts the id into a 24 character hex string for printing, unless encoding is provided.
+ * @param encoding - hex or base64
+ */
+ toString(encoding?: 'hex' | 'base64'): string;
+ /** Converts to its JSON the 24 character hex string representation. */
+ toJSON(): string;
+ /* Excluded from this release type: is */
+ /**
+ * Compares the equality of this ObjectId with `otherID`.
+ *
+ * @param otherId - ObjectId instance to compare against.
+ */
+ equals(otherId: string | ObjectId | ObjectIdLike | undefined | null): boolean;
+ /** Returns the generation date (accurate up to the second) that this ID was generated. */
+ getTimestamp(): Date;
+ /* Excluded from this release type: createPk */
+ /* Excluded from this release type: serializeInto */
+ /**
+ * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
+ *
+ * @param time - an integer number representing a number of seconds.
+ */
+ static createFromTime(time: number): ObjectId;
+ /**
+ * Creates an ObjectId from a hex string representation of an ObjectId.
+ *
+ * @param hexString - create a ObjectId from a passed in 24 character hexstring.
+ */
+ static createFromHexString(hexString: string): ObjectId;
+ /** Creates an ObjectId instance from a base64 string */
+ static createFromBase64(base64: string): ObjectId;
+ /**
+ * Checks if a value can be used to create a valid bson ObjectId
+ * @param id - any JS value
+ */
+ static isValid(id: string | ObjectId | ObjectIdLike | Uint8Array): boolean;
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ /* Excluded from this release type: isCached */
+ /**
+ * Converts to a string representation of this Id.
+ *
+ * @returns return the 24 character hex string representation.
+ */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface ObjectIdExtended {
+ $oid: string;
+}
+
+/** @public */
+export declare interface ObjectIdLike {
+ id: string | Uint8Array;
+ __id?: string;
+ toHexString(): string;
+}
+
+/**
+ * @experimental
+ * @public
+ *
+ * A new set of BSON APIs that are currently experimental and not intended for production use.
+ */
+export declare type OnDemand = {
+ parseToElements: (this: void, bytes: Uint8Array, startOffset?: number) => Iterable;
+ BSONElement: BSONElement;
+ ByteUtils: ByteUtils;
+ NumberUtils: NumberUtils;
+};
+
+/**
+ * @experimental
+ * @public
+ */
+export declare const onDemand: OnDemand;
+
+/**
+ * Parse an Extended JSON string, constructing the JavaScript value or object described by that
+ * string.
+ *
+ * @example
+ * ```js
+ * const { EJSON } = require('bson');
+ * const text = '{ "int32": { "$numberInt": "10" } }';
+ *
+ * // prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }
+ * console.log(EJSON.parse(text, { relaxed: false }));
+ *
+ * // prints { int32: 10 }
+ * console.log(EJSON.parse(text));
+ * ```
+ */
+declare function parse(text: string, options?: EJSONParseOptions): any;
+
+/**
+ * Serialize a Javascript object.
+ *
+ * @param object - the Javascript object to serialize.
+ * @returns Buffer object containing the serialized object.
+ * @public
+ */
+export declare function serialize(object: Document, options?: SerializeOptions): Uint8Array;
+
+/** @public */
+export declare interface SerializeOptions {
+ /**
+ * the serializer will check if keys are valid.
+ * @defaultValue `false`
+ */
+ checkKeys?: boolean;
+ /**
+ * serialize the javascript functions
+ * @defaultValue `false`
+ */
+ serializeFunctions?: boolean;
+ /**
+ * serialize will not emit undefined fields
+ * note that the driver sets this to `false`
+ * @defaultValue `true`
+ */
+ ignoreUndefined?: boolean;
+ /* Excluded from this release type: minInternalBufferSize */
+ /**
+ * the index in the buffer where we wish to start serializing into
+ * @defaultValue `0`
+ */
+ index?: number;
+}
+
+/**
+ * Serialize a Javascript object using a predefined Buffer and index into the buffer,
+ * useful when pre-allocating the space for serialization.
+ *
+ * @param object - the Javascript object to serialize.
+ * @param finalBuffer - the Buffer you pre-allocated to store the serialized BSON object.
+ * @returns the index pointing to the last written byte in the buffer.
+ * @public
+ */
+export declare function serializeWithBufferAndIndex(object: Document, finalBuffer: Uint8Array, options?: SerializeOptions): number;
+
+/**
+ * Sets the size of the internal serialization buffer.
+ *
+ * @param size - The desired size for the internal serialization buffer in bytes
+ * @public
+ */
+export declare function setInternalBufferSize(size: number): void;
+
+/**
+ * Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer
+ * function is specified or optionally including only the specified properties if a replacer array
+ * is specified.
+ *
+ * @param value - The value to convert to extended JSON
+ * @param replacer - A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string
+ * @param space - A String or Number object that's used to insert white space into the output JSON string for readability purposes.
+ * @param options - Optional settings
+ *
+ * @example
+ * ```js
+ * const { EJSON } = require('bson');
+ * const Int32 = require('mongodb').Int32;
+ * const doc = { int32: new Int32(10) };
+ *
+ * // prints '{"int32":{"$numberInt":"10"}}'
+ * console.log(EJSON.stringify(doc, { relaxed: false }));
+ *
+ * // prints '{"int32":10}'
+ * console.log(EJSON.stringify(doc));
+ * ```
+ */
+declare function stringify(value: any, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | EJSONSerializeOptions, space?: string | number, options?: EJSONSerializeOptions): string;
+
+/**
+ * @public
+ * @category BSONType
+ *
+ * A special type for _internal_ MongoDB use and is **not** associated with the regular Date type.
+ */
+export declare class Timestamp extends LongWithoutOverridesClass {
+ get _bsontype(): 'Timestamp';
+ get [bsonType](): 'Timestamp';
+ static readonly MAX_VALUE: Long;
+ /**
+ * An incrementing ordinal for operations within a given second.
+ */
+ get i(): number;
+ /**
+ * A `time_t` value measuring seconds since the Unix epoch
+ */
+ get t(): number;
+ /**
+ * @param int - A 64-bit bigint representing the Timestamp.
+ */
+ constructor(int: bigint);
+ /**
+ * @param long - A 64-bit Long representing the Timestamp.
+ */
+ constructor(long: Long);
+ /**
+ * @param value - A pair of two values indicating timestamp and increment.
+ */
+ constructor(value: {
+ t: number;
+ i: number;
+ });
+ toJSON(): {
+ $timestamp: string;
+ };
+ /** Returns a Timestamp represented by the given (32-bit) integer value. */
+ static fromInt(value: number): Timestamp;
+ /** Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned. */
+ static fromNumber(value: number): Timestamp;
+ /**
+ * Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits.
+ *
+ * @param lowBits - the low 32-bits.
+ * @param highBits - the high 32-bits.
+ */
+ static fromBits(lowBits: number, highBits: number): Timestamp;
+ /**
+ * Returns a Timestamp from the given string, optionally using the given radix.
+ *
+ * @param str - the textual representation of the Timestamp.
+ * @param optRadix - the radix in which the text is written.
+ */
+ static fromString(str: string, optRadix: number): Timestamp;
+ /* Excluded from this release type: toExtendedJSON */
+ /* Excluded from this release type: fromExtendedJSON */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare interface TimestampExtended {
+ $timestamp: {
+ t: number;
+ i: number;
+ };
+}
+
+/** @public */
+export declare type TimestampOverrides = '_bsontype' | 'toExtendedJSON' | 'fromExtendedJSON' | 'inspect' | typeof bsonType;
+
+/**
+ * A class representation of the BSON UUID type.
+ * @public
+ */
+export declare class UUID extends Binary {
+ /**
+ * Create a UUID type
+ *
+ * When the argument to the constructor is omitted a random v4 UUID will be generated.
+ *
+ * @param input - Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer.
+ */
+ constructor(input?: string | Uint8Array | UUID);
+ /**
+ * The UUID bytes
+ * @readonly
+ */
+ get id(): Uint8Array;
+ set id(value: Uint8Array);
+ /**
+ * Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)
+ * @param includeDashes - should the string exclude dash-separators.
+ */
+ toHexString(includeDashes?: boolean): string;
+ /**
+ * Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified.
+ */
+ toString(encoding?: 'hex' | 'base64'): string;
+ /**
+ * Converts the id into its JSON string representation.
+ * A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ */
+ toJSON(): string;
+ /**
+ * Compares the equality of this UUID with `otherID`.
+ *
+ * @param otherId - UUID instance to compare against.
+ */
+ equals(otherId: string | Uint8Array | UUID): boolean;
+ /**
+ * Creates a Binary instance from the current UUID.
+ */
+ toBinary(): Binary;
+ /**
+ * Generates a populated buffer containing a v4 uuid
+ */
+ static generate(): Uint8Array;
+ /**
+ * Checks if a value is a valid bson UUID
+ * @param input - UUID, string or Buffer to validate.
+ */
+ static isValid(input: string | Uint8Array | UUID | Binary): boolean;
+ /**
+ * Creates an UUID from a hex string representation of an UUID.
+ * @param hexString - 32 or 36 character hex string (dashes excluded/included).
+ */
+ static createFromHexString(hexString: string): UUID;
+ /** Creates an UUID from a base64 string representation of an UUID. */
+ static createFromBase64(base64: string): UUID;
+ /* Excluded from this release type: bytesFromString */
+ /* Excluded from this release type: isValidUUIDString */
+ /**
+ * Converts to a string representation of this Id.
+ *
+ * @returns return the 36 character hex string representation.
+ *
+ */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+}
+
+/** @public */
+export declare type UUIDExtended = {
+ $uuid: string;
+};
+
+export { }
diff --git a/node_modules/bson/etc/prepare.js b/node_modules/bson/etc/prepare.js
new file mode 100755
index 00000000..91e6f3a9
--- /dev/null
+++ b/node_modules/bson/etc/prepare.js
@@ -0,0 +1,19 @@
+#! /usr/bin/env node
+var cp = require('child_process');
+var fs = require('fs');
+
+var nodeMajorVersion = +process.version.match(/^v(\d+)\.\d+/)[1];
+
+if (fs.existsSync('src') && nodeMajorVersion >= 10) {
+ cp.spawnSync('npm', ['run', 'build'], { stdio: 'inherit', shell: true });
+} else {
+ if (!fs.existsSync('lib')) {
+ console.warn('BSON: No compiled javascript present, the library is not installed correctly.');
+ if (nodeMajorVersion < 10) {
+ console.warn(
+ 'This library can only be compiled in nodejs version 10 or later, currently running: ' +
+ nodeMajorVersion
+ );
+ }
+ }
+}
diff --git a/node_modules/bson/lib/bson.bundle.js b/node_modules/bson/lib/bson.bundle.js
new file mode 100644
index 00000000..e483659f
--- /dev/null
+++ b/node_modules/bson/lib/bson.bundle.js
@@ -0,0 +1,4750 @@
+var BSON = (function (exports) {
+'use strict';
+
+const TypedArrayPrototypeGetSymbolToStringTag = (() => {
+ const g = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get;
+ return (value) => g.call(value);
+})();
+function isUint8Array(value) {
+ return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array';
+}
+function isAnyArrayBuffer(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ (value[Symbol.toStringTag] === 'ArrayBuffer' ||
+ value[Symbol.toStringTag] === 'SharedArrayBuffer'));
+}
+function isRegExp(regexp) {
+ return regexp instanceof RegExp || Object.prototype.toString.call(regexp) === '[object RegExp]';
+}
+function isMap(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ value[Symbol.toStringTag] === 'Map');
+}
+function isDate(date) {
+ return date instanceof Date || Object.prototype.toString.call(date) === '[object Date]';
+}
+function defaultInspect(x, _options) {
+ return JSON.stringify(x, (k, v) => {
+ if (typeof v === 'bigint') {
+ return { $numberLong: `${v}` };
+ }
+ else if (isMap(v)) {
+ return Object.fromEntries(v);
+ }
+ return v;
+ });
+}
+function getStylizeFunction(options) {
+ const stylizeExists = options != null &&
+ typeof options === 'object' &&
+ 'stylize' in options &&
+ typeof options.stylize === 'function';
+ if (stylizeExists) {
+ return options.stylize;
+ }
+}
+
+const BSON_MAJOR_VERSION = 7;
+const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version');
+const BSON_INT32_MAX = 0x7fffffff;
+const BSON_INT32_MIN = -2147483648;
+const BSON_INT64_MAX = Math.pow(2, 63) - 1;
+const BSON_INT64_MIN = -Math.pow(2, 63);
+const JS_INT_MAX = Math.pow(2, 53);
+const JS_INT_MIN = -Math.pow(2, 53);
+const BSON_DATA_NUMBER = 1;
+const BSON_DATA_STRING = 2;
+const BSON_DATA_OBJECT = 3;
+const BSON_DATA_ARRAY = 4;
+const BSON_DATA_BINARY = 5;
+const BSON_DATA_UNDEFINED = 6;
+const BSON_DATA_OID = 7;
+const BSON_DATA_BOOLEAN = 8;
+const BSON_DATA_DATE = 9;
+const BSON_DATA_NULL = 10;
+const BSON_DATA_REGEXP = 11;
+const BSON_DATA_DBPOINTER = 12;
+const BSON_DATA_CODE = 13;
+const BSON_DATA_SYMBOL = 14;
+const BSON_DATA_CODE_W_SCOPE = 15;
+const BSON_DATA_INT = 16;
+const BSON_DATA_TIMESTAMP = 17;
+const BSON_DATA_LONG = 18;
+const BSON_DATA_DECIMAL128 = 19;
+const BSON_DATA_MIN_KEY = 0xff;
+const BSON_DATA_MAX_KEY = 0x7f;
+const BSON_BINARY_SUBTYPE_DEFAULT = 0;
+const BSON_BINARY_SUBTYPE_UUID_NEW = 4;
+const BSONType = Object.freeze({
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: -1,
+ maxKey: 127
+});
+
+class BSONError extends Error {
+ get bsonError() {
+ return true;
+ }
+ get name() {
+ return 'BSONError';
+ }
+ constructor(message, options) {
+ super(message, options);
+ }
+ static isBSONError(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ 'bsonError' in value &&
+ value.bsonError === true &&
+ 'name' in value &&
+ 'message' in value &&
+ 'stack' in value);
+ }
+}
+class BSONVersionError extends BSONError {
+ get name() {
+ return 'BSONVersionError';
+ }
+ constructor() {
+ super(`Unsupported BSON version, bson types must be from bson ${BSON_MAJOR_VERSION}.x.x`);
+ }
+}
+class BSONRuntimeError extends BSONError {
+ get name() {
+ return 'BSONRuntimeError';
+ }
+ constructor(message) {
+ super(message);
+ }
+}
+class BSONOffsetError extends BSONError {
+ get name() {
+ return 'BSONOffsetError';
+ }
+ offset;
+ constructor(message, offset, options) {
+ super(`${message}. offset: ${offset}`, options);
+ this.offset = offset;
+ }
+}
+
+let TextDecoderFatal;
+let TextDecoderNonFatal;
+function parseUtf8(buffer, start, end, fatal) {
+ if (fatal) {
+ TextDecoderFatal ??= new TextDecoder('utf8', { fatal: true });
+ try {
+ return TextDecoderFatal.decode(buffer.subarray(start, end));
+ }
+ catch (cause) {
+ throw new BSONError('Invalid UTF-8 string in BSON document', { cause });
+ }
+ }
+ TextDecoderNonFatal ??= new TextDecoder('utf8', { fatal: false });
+ return TextDecoderNonFatal.decode(buffer.subarray(start, end));
+}
+
+function tryReadBasicLatin(uint8array, start, end) {
+ if (uint8array.length === 0) {
+ return '';
+ }
+ const stringByteLength = end - start;
+ if (stringByteLength === 0) {
+ return '';
+ }
+ if (stringByteLength > 20) {
+ return null;
+ }
+ if (stringByteLength === 1 && uint8array[start] < 128) {
+ return String.fromCharCode(uint8array[start]);
+ }
+ if (stringByteLength === 2 && uint8array[start] < 128 && uint8array[start + 1] < 128) {
+ return String.fromCharCode(uint8array[start]) + String.fromCharCode(uint8array[start + 1]);
+ }
+ if (stringByteLength === 3 &&
+ uint8array[start] < 128 &&
+ uint8array[start + 1] < 128 &&
+ uint8array[start + 2] < 128) {
+ return (String.fromCharCode(uint8array[start]) +
+ String.fromCharCode(uint8array[start + 1]) +
+ String.fromCharCode(uint8array[start + 2]));
+ }
+ const latinBytes = [];
+ for (let i = start; i < end; i++) {
+ const byte = uint8array[i];
+ if (byte > 127) {
+ return null;
+ }
+ latinBytes.push(byte);
+ }
+ return String.fromCharCode(...latinBytes);
+}
+function tryWriteBasicLatin(destination, source, offset) {
+ if (source.length === 0)
+ return 0;
+ if (source.length > 25)
+ return null;
+ if (destination.length - offset < source.length)
+ return null;
+ for (let charOffset = 0, destinationOffset = offset; charOffset < source.length; charOffset++, destinationOffset++) {
+ const char = source.charCodeAt(charOffset);
+ if (char > 127)
+ return null;
+ destination[destinationOffset] = char;
+ }
+ return source.length;
+}
+
+function nodejsMathRandomBytes(byteLength) {
+ return nodeJsByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+function nodejsSecureRandomBytes(byteLength) {
+ return crypto.getRandomValues(nodeJsByteUtils.allocate(byteLength));
+}
+const nodejsRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return nodejsSecureRandomBytes;
+ }
+ else {
+ return nodejsMathRandomBytes;
+ }
+})();
+const nodeJsByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialBuffer) {
+ if (Buffer.isBuffer(potentialBuffer)) {
+ return potentialBuffer;
+ }
+ if (ArrayBuffer.isView(potentialBuffer)) {
+ return Buffer.from(potentialBuffer.buffer, potentialBuffer.byteOffset, potentialBuffer.byteLength);
+ }
+ const stringTag = potentialBuffer?.[Symbol.toStringTag] ?? Object.prototype.toString.call(potentialBuffer);
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return Buffer.from(potentialBuffer);
+ }
+ throw new BSONError(`Cannot create Buffer from the passed potentialBuffer.`);
+ },
+ allocate(size) {
+ return Buffer.alloc(size);
+ },
+ allocateUnsafe(size) {
+ return Buffer.allocUnsafe(size);
+ },
+ compare(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).compare(b);
+ },
+ concat(list) {
+ return Buffer.concat(list);
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ return nodeJsByteUtils
+ .toLocalBufferType(source)
+ .copy(target, targetStart ?? 0, sourceStart ?? 0, sourceEnd ?? source.length);
+ },
+ equals(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).equals(b);
+ },
+ fromNumberArray(array) {
+ return Buffer.from(array);
+ },
+ fromBase64(base64) {
+ return Buffer.from(base64, 'base64');
+ },
+ fromUTF8(utf8) {
+ return Buffer.from(utf8, 'utf8');
+ },
+ toBase64(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('base64');
+ },
+ fromISO88591(codePoints) {
+ return Buffer.from(codePoints, 'binary');
+ },
+ toISO88591(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('binary');
+ },
+ fromHex(hex) {
+ return Buffer.from(hex, 'hex');
+ },
+ toHex(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('hex');
+ },
+ toUTF8(buffer, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(buffer, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ const string = nodeJsByteUtils.toLocalBufferType(buffer).toString('utf8', start, end);
+ if (fatal) {
+ for (let i = 0; i < string.length; i++) {
+ if (string.charCodeAt(i) === 0xfffd) {
+ parseUtf8(buffer, start, end, true);
+ break;
+ }
+ }
+ }
+ return string;
+ },
+ utf8ByteLength(input) {
+ return Buffer.byteLength(input, 'utf8');
+ },
+ encodeUTF8Into(buffer, source, byteOffset) {
+ const latinBytesWritten = tryWriteBasicLatin(buffer, source, byteOffset);
+ if (latinBytesWritten != null) {
+ return latinBytesWritten;
+ }
+ return nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8');
+ },
+ randomBytes: nodejsRandomBytes,
+ swap32(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).swap32();
+ }
+};
+
+function isReactNative() {
+ const { navigator } = globalThis;
+ return typeof navigator === 'object' && navigator.product === 'ReactNative';
+}
+function webMathRandomBytes(byteLength) {
+ if (byteLength < 0) {
+ throw new RangeError(`The argument 'byteLength' is invalid. Received ${byteLength}`);
+ }
+ return webByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+const webRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return (byteLength) => {
+ return crypto.getRandomValues(webByteUtils.allocate(byteLength));
+ };
+ }
+ else {
+ if (isReactNative()) {
+ const { console } = globalThis;
+ console?.warn?.('BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.');
+ }
+ return webMathRandomBytes;
+ }
+})();
+const HEX_DIGIT = /(\d|[a-f])/i;
+const webByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialUint8array) {
+ const stringTag = potentialUint8array?.[Symbol.toStringTag] ??
+ Object.prototype.toString.call(potentialUint8array);
+ if (stringTag === 'Uint8Array') {
+ return potentialUint8array;
+ }
+ if (ArrayBuffer.isView(potentialUint8array)) {
+ return new Uint8Array(potentialUint8array.buffer.slice(potentialUint8array.byteOffset, potentialUint8array.byteOffset + potentialUint8array.byteLength));
+ }
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return new Uint8Array(potentialUint8array);
+ }
+ throw new BSONError(`Cannot make a Uint8Array from passed potentialBuffer.`);
+ },
+ allocate(size) {
+ if (typeof size !== 'number') {
+ throw new TypeError(`The "size" argument must be of type number. Received ${String(size)}`);
+ }
+ return new Uint8Array(size);
+ },
+ allocateUnsafe(size) {
+ return webByteUtils.allocate(size);
+ },
+ compare(uint8Array, otherUint8Array) {
+ if (uint8Array === otherUint8Array)
+ return 0;
+ const len = Math.min(uint8Array.length, otherUint8Array.length);
+ for (let i = 0; i < len; i++) {
+ if (uint8Array[i] < otherUint8Array[i])
+ return -1;
+ if (uint8Array[i] > otherUint8Array[i])
+ return 1;
+ }
+ if (uint8Array.length < otherUint8Array.length)
+ return -1;
+ if (uint8Array.length > otherUint8Array.length)
+ return 1;
+ return 0;
+ },
+ concat(uint8Arrays) {
+ if (uint8Arrays.length === 0)
+ return webByteUtils.allocate(0);
+ let totalLength = 0;
+ for (const uint8Array of uint8Arrays) {
+ totalLength += uint8Array.length;
+ }
+ const result = webByteUtils.allocate(totalLength);
+ let offset = 0;
+ for (const uint8Array of uint8Arrays) {
+ result.set(uint8Array, offset);
+ offset += uint8Array.length;
+ }
+ return result;
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ if (sourceEnd !== undefined && sourceEnd < 0) {
+ throw new RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${sourceEnd}`);
+ }
+ sourceEnd = sourceEnd ?? source.length;
+ if (sourceStart !== undefined && (sourceStart < 0 || sourceStart > sourceEnd)) {
+ throw new RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${sourceEnd}. Received ${sourceStart}`);
+ }
+ sourceStart = sourceStart ?? 0;
+ if (targetStart !== undefined && targetStart < 0) {
+ throw new RangeError(`The value of "targetStart" is out of range. It must be >= 0. Received ${targetStart}`);
+ }
+ targetStart = targetStart ?? 0;
+ const srcSlice = source.subarray(sourceStart, sourceEnd);
+ const maxLen = Math.min(srcSlice.length, target.length - targetStart);
+ if (maxLen <= 0) {
+ return 0;
+ }
+ target.set(srcSlice.subarray(0, maxLen), targetStart);
+ return maxLen;
+ },
+ equals(uint8Array, otherUint8Array) {
+ if (uint8Array.byteLength !== otherUint8Array.byteLength) {
+ return false;
+ }
+ for (let i = 0; i < uint8Array.byteLength; i++) {
+ if (uint8Array[i] !== otherUint8Array[i]) {
+ return false;
+ }
+ }
+ return true;
+ },
+ fromNumberArray(array) {
+ return Uint8Array.from(array);
+ },
+ fromBase64(base64) {
+ return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
+ },
+ fromUTF8(utf8) {
+ return new TextEncoder().encode(utf8);
+ },
+ toBase64(uint8array) {
+ return btoa(webByteUtils.toISO88591(uint8array));
+ },
+ fromISO88591(codePoints) {
+ return Uint8Array.from(codePoints, c => c.charCodeAt(0) & 0xff);
+ },
+ toISO88591(uint8array) {
+ return Array.from(Uint16Array.from(uint8array), b => String.fromCharCode(b)).join('');
+ },
+ fromHex(hex) {
+ const evenLengthHex = hex.length % 2 === 0 ? hex : hex.slice(0, hex.length - 1);
+ const buffer = [];
+ for (let i = 0; i < evenLengthHex.length; i += 2) {
+ const firstDigit = evenLengthHex[i];
+ const secondDigit = evenLengthHex[i + 1];
+ if (!HEX_DIGIT.test(firstDigit)) {
+ break;
+ }
+ if (!HEX_DIGIT.test(secondDigit)) {
+ break;
+ }
+ const hexDigit = Number.parseInt(`${firstDigit}${secondDigit}`, 16);
+ buffer.push(hexDigit);
+ }
+ return Uint8Array.from(buffer);
+ },
+ toHex(uint8array) {
+ return Array.from(uint8array, byte => byte.toString(16).padStart(2, '0')).join('');
+ },
+ toUTF8(uint8array, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(uint8array, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ return parseUtf8(uint8array, start, end, fatal);
+ },
+ utf8ByteLength(input) {
+ return new TextEncoder().encode(input).byteLength;
+ },
+ encodeUTF8Into(uint8array, source, byteOffset) {
+ const bytes = new TextEncoder().encode(source);
+ uint8array.set(bytes, byteOffset);
+ return bytes.byteLength;
+ },
+ randomBytes: webRandomBytes,
+ swap32(buffer) {
+ if (buffer.length % 4 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 32-bits');
+ }
+ for (let i = 0; i < buffer.length; i += 4) {
+ const byte0 = buffer[i];
+ const byte1 = buffer[i + 1];
+ const byte2 = buffer[i + 2];
+ const byte3 = buffer[i + 3];
+ buffer[i] = byte3;
+ buffer[i + 1] = byte2;
+ buffer[i + 2] = byte1;
+ buffer[i + 3] = byte0;
+ }
+ return buffer;
+ }
+};
+
+const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true;
+const ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
+
+const bsonType = Symbol.for('@@mdb.bson.type');
+class BSONValue {
+ get [bsonType]() {
+ return this._bsontype;
+ }
+ get [BSON_VERSION_SYMBOL]() {
+ return BSON_MAJOR_VERSION;
+ }
+ [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {
+ return this.inspect(depth, options, inspect);
+ }
+}
+
+const FLOAT = new Float64Array(1);
+const FLOAT_BYTES = new Uint8Array(FLOAT.buffer, 0, 8);
+FLOAT[0] = -1;
+const isBigEndian = FLOAT_BYTES[7] === 0;
+const NumberUtils = {
+ isBigEndian,
+ getNonnegativeInt32LE(source, offset) {
+ if (source[offset + 3] > 127) {
+ throw new RangeError(`Size cannot be negative at offset: ${offset}`);
+ }
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getInt32LE(source, offset) {
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getUint32LE(source, offset) {
+ return (source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ },
+ getUint32BE(source, offset) {
+ return (source[offset + 3] +
+ source[offset + 2] * 256 +
+ source[offset + 1] * 65536 +
+ source[offset] * 16777216);
+ },
+ getBigInt64LE(source, offset) {
+ const hi = BigInt(source[offset + 4] +
+ source[offset + 5] * 256 +
+ source[offset + 6] * 65536 +
+ (source[offset + 7] << 24));
+ const lo = BigInt(source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ return (hi << 32n) + lo;
+ },
+ getFloat64LE: isBigEndian
+ ? (source, offset) => {
+ FLOAT_BYTES[7] = source[offset];
+ FLOAT_BYTES[6] = source[offset + 1];
+ FLOAT_BYTES[5] = source[offset + 2];
+ FLOAT_BYTES[4] = source[offset + 3];
+ FLOAT_BYTES[3] = source[offset + 4];
+ FLOAT_BYTES[2] = source[offset + 5];
+ FLOAT_BYTES[1] = source[offset + 6];
+ FLOAT_BYTES[0] = source[offset + 7];
+ return FLOAT[0];
+ }
+ : (source, offset) => {
+ FLOAT_BYTES[0] = source[offset];
+ FLOAT_BYTES[1] = source[offset + 1];
+ FLOAT_BYTES[2] = source[offset + 2];
+ FLOAT_BYTES[3] = source[offset + 3];
+ FLOAT_BYTES[4] = source[offset + 4];
+ FLOAT_BYTES[5] = source[offset + 5];
+ FLOAT_BYTES[6] = source[offset + 6];
+ FLOAT_BYTES[7] = source[offset + 7];
+ return FLOAT[0];
+ },
+ setInt32BE(destination, offset, value) {
+ destination[offset + 3] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset] = value;
+ return 4;
+ },
+ setInt32LE(destination, offset, value) {
+ destination[offset] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 3] = value;
+ return 4;
+ },
+ setBigInt64LE(destination, offset, value) {
+ const mask32bits = 0xffffffffn;
+ let lo = Number(value & mask32bits);
+ destination[offset] = lo;
+ lo >>= 8;
+ destination[offset + 1] = lo;
+ lo >>= 8;
+ destination[offset + 2] = lo;
+ lo >>= 8;
+ destination[offset + 3] = lo;
+ let hi = Number((value >> 32n) & mask32bits);
+ destination[offset + 4] = hi;
+ hi >>= 8;
+ destination[offset + 5] = hi;
+ hi >>= 8;
+ destination[offset + 6] = hi;
+ hi >>= 8;
+ destination[offset + 7] = hi;
+ return 8;
+ },
+ setFloat64LE: isBigEndian
+ ? (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[7];
+ destination[offset + 1] = FLOAT_BYTES[6];
+ destination[offset + 2] = FLOAT_BYTES[5];
+ destination[offset + 3] = FLOAT_BYTES[4];
+ destination[offset + 4] = FLOAT_BYTES[3];
+ destination[offset + 5] = FLOAT_BYTES[2];
+ destination[offset + 6] = FLOAT_BYTES[1];
+ destination[offset + 7] = FLOAT_BYTES[0];
+ return 8;
+ }
+ : (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[0];
+ destination[offset + 1] = FLOAT_BYTES[1];
+ destination[offset + 2] = FLOAT_BYTES[2];
+ destination[offset + 3] = FLOAT_BYTES[3];
+ destination[offset + 4] = FLOAT_BYTES[4];
+ destination[offset + 5] = FLOAT_BYTES[5];
+ destination[offset + 6] = FLOAT_BYTES[6];
+ destination[offset + 7] = FLOAT_BYTES[7];
+ return 8;
+ }
+};
+
+class Binary extends BSONValue {
+ get _bsontype() {
+ return 'Binary';
+ }
+ static BSON_BINARY_SUBTYPE_DEFAULT = 0;
+ static BUFFER_SIZE = 256;
+ static SUBTYPE_DEFAULT = 0;
+ static SUBTYPE_FUNCTION = 1;
+ static SUBTYPE_BYTE_ARRAY = 2;
+ static SUBTYPE_UUID_OLD = 3;
+ static SUBTYPE_UUID = 4;
+ static SUBTYPE_MD5 = 5;
+ static SUBTYPE_ENCRYPTED = 6;
+ static SUBTYPE_COLUMN = 7;
+ static SUBTYPE_SENSITIVE = 8;
+ static SUBTYPE_VECTOR = 9;
+ static SUBTYPE_USER_DEFINED = 128;
+ static VECTOR_TYPE = Object.freeze({
+ Int8: 0x03,
+ Float32: 0x27,
+ PackedBit: 0x10
+ });
+ buffer;
+ sub_type;
+ position;
+ constructor(buffer, subType) {
+ super();
+ if (!(buffer == null) &&
+ typeof buffer === 'string' &&
+ !ArrayBuffer.isView(buffer) &&
+ !isAnyArrayBuffer(buffer) &&
+ !Array.isArray(buffer)) {
+ throw new BSONError('Binary can only be constructed from Uint8Array or number[]');
+ }
+ this.sub_type = subType ?? Binary.BSON_BINARY_SUBTYPE_DEFAULT;
+ if (buffer == null) {
+ this.buffer = ByteUtils.allocate(Binary.BUFFER_SIZE);
+ this.position = 0;
+ }
+ else {
+ this.buffer = Array.isArray(buffer)
+ ? ByteUtils.fromNumberArray(buffer)
+ : ByteUtils.toLocalBufferType(buffer);
+ this.position = this.buffer.byteLength;
+ }
+ }
+ put(byteValue) {
+ if (typeof byteValue === 'string' && byteValue.length !== 1) {
+ throw new BSONError('only accepts single character String');
+ }
+ else if (typeof byteValue !== 'number' && byteValue.length !== 1)
+ throw new BSONError('only accepts single character Uint8Array or Array');
+ let decodedByte;
+ if (typeof byteValue === 'string') {
+ decodedByte = byteValue.charCodeAt(0);
+ }
+ else if (typeof byteValue === 'number') {
+ decodedByte = byteValue;
+ }
+ else {
+ decodedByte = byteValue[0];
+ }
+ if (decodedByte < 0 || decodedByte > 255) {
+ throw new BSONError('only accepts number in a valid unsigned byte range 0-255');
+ }
+ if (this.buffer.byteLength > this.position) {
+ this.buffer[this.position++] = decodedByte;
+ }
+ else {
+ const newSpace = ByteUtils.allocate(Binary.BUFFER_SIZE + this.buffer.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ this.buffer[this.position++] = decodedByte;
+ }
+ }
+ write(sequence, offset) {
+ offset = typeof offset === 'number' ? offset : this.position;
+ if (this.buffer.byteLength < offset + sequence.length) {
+ const newSpace = ByteUtils.allocate(this.buffer.byteLength + sequence.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ }
+ if (ArrayBuffer.isView(sequence)) {
+ this.buffer.set(ByteUtils.toLocalBufferType(sequence), offset);
+ this.position =
+ offset + sequence.byteLength > this.position ? offset + sequence.length : this.position;
+ }
+ else if (typeof sequence === 'string') {
+ throw new BSONError('input cannot be string');
+ }
+ }
+ read(position, length) {
+ length = length && length > 0 ? length : this.position;
+ const end = position + length;
+ return this.buffer.subarray(position, end > this.position ? this.position : end);
+ }
+ value() {
+ return this.buffer.length === this.position
+ ? this.buffer
+ : this.buffer.subarray(0, this.position);
+ }
+ length() {
+ return this.position;
+ }
+ toJSON() {
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.buffer.subarray(0, this.position));
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ if (encoding === 'utf8' || encoding === 'utf-8')
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (this.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(this);
+ }
+ const base64String = ByteUtils.toBase64(this.buffer);
+ const subType = Number(this.sub_type).toString(16);
+ if (options.legacy) {
+ return {
+ $binary: base64String,
+ $type: subType.length === 1 ? '0' + subType : subType
+ };
+ }
+ return {
+ $binary: {
+ base64: base64String,
+ subType: subType.length === 1 ? '0' + subType : subType
+ }
+ };
+ }
+ toUUID() {
+ if (this.sub_type === Binary.SUBTYPE_UUID) {
+ return new UUID(this.buffer.subarray(0, this.position));
+ }
+ throw new BSONError(`Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${Binary.SUBTYPE_UUID}" is currently supported.`);
+ }
+ static createFromHexString(hex, subType) {
+ return new Binary(ByteUtils.fromHex(hex), subType);
+ }
+ static createFromBase64(base64, subType) {
+ return new Binary(ByteUtils.fromBase64(base64), subType);
+ }
+ static fromExtendedJSON(doc, options) {
+ options = options || {};
+ let data;
+ let type;
+ if ('$binary' in doc) {
+ if (options.legacy && typeof doc.$binary === 'string' && '$type' in doc) {
+ type = doc.$type ? parseInt(doc.$type, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary);
+ }
+ else {
+ if (typeof doc.$binary !== 'string') {
+ type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary.base64);
+ }
+ }
+ }
+ else if ('$uuid' in doc) {
+ type = 4;
+ data = UUID.bytesFromString(doc.$uuid);
+ }
+ if (!data) {
+ throw new BSONError(`Unexpected Binary Extended JSON format ${JSON.stringify(doc)}`);
+ }
+ return type === BSON_BINARY_SUBTYPE_UUID_NEW ? new UUID(data) : new Binary(data, type);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const base64 = ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ const base64Arg = inspect(base64, options);
+ const subTypeArg = inspect(this.sub_type, options);
+ return `Binary.createFromBase64(${base64Arg}, ${subTypeArg})`;
+ }
+ toInt8Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Int8) {
+ throw new BSONError('Binary datatype field is not Int8');
+ }
+ validateBinaryVector(this);
+ return new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toFloat32Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Float32) {
+ throw new BSONError('Binary datatype field is not Float32');
+ }
+ validateBinaryVector(this);
+ const floatBytes = new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(floatBytes);
+ return new Float32Array(floatBytes.buffer);
+ }
+ toPackedBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ return new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ const byteCount = this.length() - 2;
+ const bitCount = byteCount * 8 - this.buffer[1];
+ const bits = new Int8Array(bitCount);
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = (bitOffset / 8) | 0;
+ const byte = this.buffer[byteOffset + 2];
+ const shift = 7 - (bitOffset % 8);
+ const bit = (byte >> shift) & 1;
+ bits[bitOffset] = bit;
+ }
+ return bits;
+ }
+ static fromInt8Array(array) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.Int8;
+ buffer[1] = 0;
+ const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ buffer.set(intBytes, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromFloat32Array(array) {
+ const binaryBytes = ByteUtils.allocate(array.byteLength + 2);
+ binaryBytes[0] = Binary.VECTOR_TYPE.Float32;
+ binaryBytes[1] = 0;
+ const floatBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ binaryBytes.set(floatBytes, 2);
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(new Uint8Array(binaryBytes.buffer, 2));
+ const bin = new this(binaryBytes, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromPackedBits(array, padding = 0) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.PackedBit;
+ buffer[1] = padding;
+ buffer.set(array, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromBits(bits) {
+ const byteLength = (bits.length + 7) >>> 3;
+ const bytes = new Uint8Array(byteLength + 2);
+ bytes[0] = Binary.VECTOR_TYPE.PackedBit;
+ const remainder = bits.length % 8;
+ bytes[1] = remainder === 0 ? 0 : 8 - remainder;
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = bitOffset >>> 3;
+ const bit = bits[bitOffset];
+ if (bit !== 0 && bit !== 1) {
+ throw new BSONError(`Invalid bit value at ${bitOffset}: must be 0 or 1, found ${bits[bitOffset]}`);
+ }
+ if (bit === 0)
+ continue;
+ const shift = 7 - (bitOffset % 8);
+ bytes[byteOffset + 2] |= bit << shift;
+ }
+ return new this(bytes, Binary.SUBTYPE_VECTOR);
+ }
+}
+function validateBinaryVector(vector) {
+ if (vector.sub_type !== Binary.SUBTYPE_VECTOR)
+ return;
+ const size = vector.position;
+ const datatype = vector.buffer[0];
+ const padding = vector.buffer[1];
+ if ((datatype === Binary.VECTOR_TYPE.Float32 || datatype === Binary.VECTOR_TYPE.Int8) &&
+ padding !== 0) {
+ throw new BSONError('Invalid Vector: padding must be zero for int8 and float32 vectors');
+ }
+ if (datatype === Binary.VECTOR_TYPE.Float32) {
+ if (size !== 0 && size - 2 !== 0 && (size - 2) % 4 !== 0) {
+ throw new BSONError('Invalid Vector: Float32 vector must contain a multiple of 4 bytes');
+ }
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding !== 0 && size === 2) {
+ throw new BSONError('Invalid Vector: padding must be zero for packed bit vectors that are empty');
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding > 7) {
+ throw new BSONError(`Invalid Vector: padding must be a value between 0 and 7. found: ${padding}`);
+ }
+}
+const UUID_BYTE_LENGTH = 16;
+const UUID_WITHOUT_DASHES = /^[0-9A-F]{32}$/i;
+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;
+class UUID extends Binary {
+ constructor(input) {
+ let bytes;
+ if (input == null) {
+ bytes = UUID.generate();
+ }
+ else if (input instanceof UUID) {
+ bytes = ByteUtils.toLocalBufferType(new Uint8Array(input.buffer));
+ }
+ else if (ArrayBuffer.isView(input) && input.byteLength === UUID_BYTE_LENGTH) {
+ bytes = ByteUtils.toLocalBufferType(input);
+ }
+ else if (typeof input === 'string') {
+ bytes = UUID.bytesFromString(input);
+ }
+ else {
+ 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).');
+ }
+ super(bytes, BSON_BINARY_SUBTYPE_UUID_NEW);
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ }
+ toHexString(includeDashes = true) {
+ if (includeDashes) {
+ return [
+ ByteUtils.toHex(this.buffer.subarray(0, 4)),
+ ByteUtils.toHex(this.buffer.subarray(4, 6)),
+ ByteUtils.toHex(this.buffer.subarray(6, 8)),
+ ByteUtils.toHex(this.buffer.subarray(8, 10)),
+ ByteUtils.toHex(this.buffer.subarray(10, 16))
+ ].join('-');
+ }
+ return ByteUtils.toHex(this.buffer);
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.id);
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ equals(otherId) {
+ if (!otherId) {
+ return false;
+ }
+ if (otherId instanceof UUID) {
+ return ByteUtils.equals(otherId.id, this.id);
+ }
+ try {
+ return ByteUtils.equals(new UUID(otherId).id, this.id);
+ }
+ catch {
+ return false;
+ }
+ }
+ toBinary() {
+ return new Binary(this.id, Binary.SUBTYPE_UUID);
+ }
+ static generate() {
+ const bytes = ByteUtils.randomBytes(UUID_BYTE_LENGTH);
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
+ return bytes;
+ }
+ static isValid(input) {
+ if (!input) {
+ return false;
+ }
+ if (typeof input === 'string') {
+ return UUID.isValidUUIDString(input);
+ }
+ if (isUint8Array(input)) {
+ return input.byteLength === UUID_BYTE_LENGTH;
+ }
+ return (input._bsontype === 'Binary' &&
+ input.sub_type === this.SUBTYPE_UUID &&
+ input.buffer.byteLength === 16);
+ }
+ static createFromHexString(hexString) {
+ const buffer = UUID.bytesFromString(hexString);
+ return new UUID(buffer);
+ }
+ static createFromBase64(base64) {
+ return new UUID(ByteUtils.fromBase64(base64));
+ }
+ static bytesFromString(representation) {
+ if (!UUID.isValidUUIDString(representation)) {
+ throw new BSONError('UUID string representation must be 32 hex digits or canonical hyphenated representation');
+ }
+ return ByteUtils.fromHex(representation.replace(/-/g, ''));
+ }
+ static isValidUUIDString(representation) {
+ return UUID_WITHOUT_DASHES.test(representation) || UUID_WITH_DASHES.test(representation);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new UUID(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+class Code extends BSONValue {
+ get _bsontype() {
+ return 'Code';
+ }
+ code;
+ scope;
+ constructor(code, scope) {
+ super();
+ this.code = code.toString();
+ this.scope = scope ?? null;
+ }
+ toJSON() {
+ if (this.scope != null) {
+ return { code: this.code, scope: this.scope };
+ }
+ return { code: this.code };
+ }
+ toExtendedJSON() {
+ if (this.scope) {
+ return { $code: this.code, $scope: this.scope };
+ }
+ return { $code: this.code };
+ }
+ static fromExtendedJSON(doc) {
+ return new Code(doc.$code, doc.$scope);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ let parametersString = inspect(this.code, options);
+ const multiLineFn = parametersString.includes('\n');
+ if (this.scope != null) {
+ parametersString += `,${multiLineFn ? '\n' : ' '}${inspect(this.scope, options)}`;
+ }
+ const endingNewline = multiLineFn && this.scope === null;
+ return `new Code(${multiLineFn ? '\n' : ''}${parametersString}${endingNewline ? '\n' : ''})`;
+ }
+}
+
+function isDBRefLike(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '$id' in value &&
+ value.$id != null &&
+ '$ref' in value &&
+ typeof value.$ref === 'string' &&
+ (!('$db' in value) || ('$db' in value && typeof value.$db === 'string')));
+}
+class DBRef extends BSONValue {
+ get _bsontype() {
+ return 'DBRef';
+ }
+ collection;
+ oid;
+ db;
+ fields;
+ constructor(collection, oid, db, fields) {
+ super();
+ const parts = collection.split('.');
+ if (parts.length === 2) {
+ db = parts.shift();
+ collection = parts.shift();
+ }
+ this.collection = collection;
+ this.oid = oid;
+ this.db = db;
+ this.fields = fields || {};
+ }
+ get namespace() {
+ return this.collection;
+ }
+ set namespace(value) {
+ this.collection = value;
+ }
+ toJSON() {
+ const o = Object.assign({
+ $ref: this.collection,
+ $id: this.oid
+ }, this.fields);
+ if (this.db != null)
+ o.$db = this.db;
+ return o;
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ let o = {
+ $ref: this.collection,
+ $id: this.oid
+ };
+ if (options.legacy) {
+ return o;
+ }
+ if (this.db)
+ o.$db = this.db;
+ o = Object.assign(o, this.fields);
+ return o;
+ }
+ static fromExtendedJSON(doc) {
+ const copy = Object.assign({}, doc);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(doc.$ref, doc.$id, doc.$db, copy);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const args = [
+ inspect(this.namespace, options),
+ inspect(this.oid, options),
+ ...(this.db ? [inspect(this.db, options)] : []),
+ ...(Object.keys(this.fields).length > 0 ? [inspect(this.fields, options)] : [])
+ ];
+ args[1] = inspect === defaultInspect ? `new ObjectId(${args[1]})` : args[1];
+ return `new DBRef(${args.join(', ')})`;
+ }
+}
+
+function removeLeadingZerosAndExplicitPlus(str) {
+ if (str === '') {
+ return str;
+ }
+ let startIndex = 0;
+ const isNegative = str[startIndex] === '-';
+ const isExplicitlyPositive = str[startIndex] === '+';
+ if (isExplicitlyPositive || isNegative) {
+ startIndex += 1;
+ }
+ let foundInsignificantZero = false;
+ for (; startIndex < str.length && str[startIndex] === '0'; ++startIndex) {
+ foundInsignificantZero = true;
+ }
+ if (!foundInsignificantZero) {
+ return isExplicitlyPositive ? str.slice(1) : str;
+ }
+ return `${isNegative ? '-' : ''}${str.length === startIndex ? '0' : str.slice(startIndex)}`;
+}
+function validateStringCharacters(str, radix) {
+ radix = radix ?? 10;
+ const validCharacters = '0123456789abcdefghijklmnopqrstuvwxyz'.slice(0, radix);
+ const regex = new RegExp(`[^-+${validCharacters}]`, 'i');
+ return regex.test(str) ? false : str;
+}
+
+let wasm = undefined;
+try {
+ 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;
+}
+catch {
+}
+const TWO_PWR_16_DBL = 1 << 16;
+const TWO_PWR_24_DBL = 1 << 24;
+const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+const TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+const TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+const INT_CACHE = {};
+const UINT_CACHE = {};
+const MAX_INT64_STRING_LENGTH = 20;
+const DECIMAL_REG_EX = /^(\+?0|(\+|-)?[1-9][0-9]*)$/;
+class Long extends BSONValue {
+ get _bsontype() {
+ return 'Long';
+ }
+ get __isLong__() {
+ return true;
+ }
+ high;
+ low;
+ unsigned;
+ constructor(lowOrValue = 0, highOrUnsigned, unsigned) {
+ super();
+ const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
+ const high = typeof highOrUnsigned === 'number' ? highOrUnsigned : 0;
+ const res = typeof lowOrValue === 'string'
+ ? Long.fromString(lowOrValue, unsignedBool)
+ : typeof lowOrValue === 'bigint'
+ ? Long.fromBigInt(lowOrValue, unsignedBool)
+ : { low: lowOrValue | 0, high: high | 0, unsigned: unsignedBool };
+ this.low = res.low;
+ this.high = res.high;
+ this.unsigned = res.unsigned;
+ }
+ static TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
+ static MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true);
+ static ZERO = Long.fromInt(0);
+ static UZERO = Long.fromInt(0, true);
+ static ONE = Long.fromInt(1);
+ static UONE = Long.fromInt(1, true);
+ static NEG_ONE = Long.fromInt(-1);
+ static MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
+ static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false);
+ static fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+ }
+ static fromInt(value, unsigned) {
+ let obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if ((cache = 0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, (value | 0) < 0 ? -1 : 0, true);
+ if (cache)
+ UINT_CACHE[value] = obj;
+ return obj;
+ }
+ else {
+ value |= 0;
+ if ((cache = -128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache)
+ INT_CACHE[value] = obj;
+ return obj;
+ }
+ }
+ static fromNumber(value, unsigned) {
+ if (isNaN(value))
+ return unsigned ? Long.UZERO : Long.ZERO;
+ if (unsigned) {
+ if (value < 0)
+ return Long.UZERO;
+ if (value >= TWO_PWR_64_DBL)
+ return Long.MAX_UNSIGNED_VALUE;
+ }
+ else {
+ if (value <= -TWO_PWR_63_DBL)
+ return Long.MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL)
+ return Long.MAX_VALUE;
+ }
+ if (value < 0)
+ return Long.fromNumber(-value, unsigned).neg();
+ return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
+ }
+ static fromBigInt(value, unsigned) {
+ const FROM_BIGINT_BIT_MASK = 0xffffffffn;
+ const FROM_BIGINT_BIT_SHIFT = 32n;
+ return new Long(Number(value & FROM_BIGINT_BIT_MASK), Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK), unsigned);
+ }
+ static _fromString(str, unsigned, radix) {
+ if (str.length === 0)
+ throw new BSONError('empty string');
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ let p;
+ if ((p = str.indexOf('-')) > 0)
+ throw new BSONError('interior hyphen');
+ else if (p === 0) {
+ return Long._fromString(str.substring(1), unsigned, radix).neg();
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 8));
+ let result = Long.ZERO;
+ for (let i = 0; i < str.length; i += 8) {
+ const size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ const power = Long.fromNumber(Math.pow(radix, size));
+ result = result.mul(power).add(Long.fromNumber(value));
+ }
+ else {
+ result = result.mul(radixToPower);
+ result = result.add(Long.fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+ }
+ static fromStringStrict(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str.trim() !== str) {
+ throw new BSONError(`Input: '${str}' contains leading and/or trailing whitespace`);
+ }
+ if (!validateStringCharacters(str, radix)) {
+ throw new BSONError(`Input: '${str}' contains invalid characters for radix: ${radix}`);
+ }
+ const cleanedStr = removeLeadingZerosAndExplicitPlus(str);
+ const result = Long._fromString(cleanedStr, unsigned, radix);
+ if (result.toString(radix).toLowerCase() !== cleanedStr.toLowerCase()) {
+ throw new BSONError(`Input: ${str} is not representable as ${result.unsigned ? 'an unsigned' : 'a signed'} 64-bit Long ${radix != null ? `with radix: ${radix}` : ''}`);
+ }
+ return result;
+ }
+ static fromString(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str === 'NaN' && radix < 24) {
+ return Long.ZERO;
+ }
+ else if ((str === 'Infinity' || str === '+Infinity' || str === '-Infinity') && radix < 35) {
+ return Long.ZERO;
+ }
+ return Long._fromString(str, unsigned, radix);
+ }
+ static fromBytes(bytes, unsigned, le) {
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
+ }
+ static fromBytesLE(bytes, unsigned) {
+ 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);
+ }
+ static fromBytesBE(bytes, unsigned) {
+ 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);
+ }
+ static isLong(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '__isLong__' in value &&
+ value.__isLong__ === true);
+ }
+ static fromValue(val, unsigned) {
+ if (typeof val === 'number')
+ return Long.fromNumber(val, unsigned);
+ if (typeof val === 'string')
+ return Long.fromString(val, unsigned);
+ return Long.fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
+ }
+ add(addend) {
+ if (!Long.isLong(addend))
+ addend = Long.fromValue(addend);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = addend.high >>> 16;
+ const b32 = addend.high & 0xffff;
+ const b16 = addend.low >>> 16;
+ const b00 = addend.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 + b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ and(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+ }
+ compare(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.eq(other))
+ return 0;
+ const thisNeg = this.isNegative(), otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg)
+ return -1;
+ if (!thisNeg && otherNeg)
+ return 1;
+ if (!this.unsigned)
+ return this.sub(other).isNegative() ? -1 : 1;
+ return other.high >>> 0 > this.high >>> 0 ||
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
+ ? -1
+ : 1;
+ }
+ comp(other) {
+ return this.compare(other);
+ }
+ divide(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (divisor.isZero())
+ throw new BSONError('division by zero');
+ if (wasm) {
+ if (!this.unsigned &&
+ this.high === -2147483648 &&
+ divisor.low === -1 &&
+ divisor.high === -1) {
+ return this;
+ }
+ const low = (this.unsigned ? wasm.div_u : wasm.div_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (this.isZero())
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ let approx, rem, res;
+ if (!this.unsigned) {
+ if (this.eq(Long.MIN_VALUE)) {
+ if (divisor.eq(Long.ONE) || divisor.eq(Long.NEG_ONE))
+ return Long.MIN_VALUE;
+ else if (divisor.eq(Long.MIN_VALUE))
+ return Long.ONE;
+ else {
+ const halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(Long.ZERO)) {
+ return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
+ }
+ else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ }
+ else if (divisor.eq(Long.MIN_VALUE))
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative())
+ return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ }
+ else if (divisor.isNegative())
+ return this.div(divisor.neg()).neg();
+ res = Long.ZERO;
+ }
+ else {
+ if (!divisor.unsigned)
+ divisor = divisor.toUnsigned();
+ if (divisor.gt(this))
+ return Long.UZERO;
+ if (divisor.gt(this.shru(1)))
+ return Long.UONE;
+ res = Long.UZERO;
+ }
+ rem = this;
+ while (rem.gte(divisor)) {
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+ const log2 = Math.ceil(Math.log(approx) / Math.LN2);
+ const delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);
+ let approxRes = Long.fromNumber(approx);
+ let approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = Long.fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+ if (approxRes.isZero())
+ approxRes = Long.ONE;
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+ }
+ div(divisor) {
+ return this.divide(divisor);
+ }
+ equals(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
+ return false;
+ return this.high === other.high && this.low === other.low;
+ }
+ eq(other) {
+ return this.equals(other);
+ }
+ getHighBits() {
+ return this.high;
+ }
+ getHighBitsUnsigned() {
+ return this.high >>> 0;
+ }
+ getLowBits() {
+ return this.low;
+ }
+ getLowBitsUnsigned() {
+ return this.low >>> 0;
+ }
+ getNumBitsAbs() {
+ if (this.isNegative()) {
+ return this.eq(Long.MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ }
+ const val = this.high !== 0 ? this.high : this.low;
+ let bit;
+ for (bit = 31; bit > 0; bit--)
+ if ((val & (1 << bit)) !== 0)
+ break;
+ return this.high !== 0 ? bit + 33 : bit + 1;
+ }
+ greaterThan(other) {
+ return this.comp(other) > 0;
+ }
+ gt(other) {
+ return this.greaterThan(other);
+ }
+ greaterThanOrEqual(other) {
+ return this.comp(other) >= 0;
+ }
+ gte(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ ge(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ isEven() {
+ return (this.low & 1) === 0;
+ }
+ isNegative() {
+ return !this.unsigned && this.high < 0;
+ }
+ isOdd() {
+ return (this.low & 1) === 1;
+ }
+ isPositive() {
+ return this.unsigned || this.high >= 0;
+ }
+ isZero() {
+ return this.high === 0 && this.low === 0;
+ }
+ lessThan(other) {
+ return this.comp(other) < 0;
+ }
+ lt(other) {
+ return this.lessThan(other);
+ }
+ lessThanOrEqual(other) {
+ return this.comp(other) <= 0;
+ }
+ lte(other) {
+ return this.lessThanOrEqual(other);
+ }
+ modulo(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (wasm) {
+ const low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ return this.sub(this.div(divisor).mul(divisor));
+ }
+ mod(divisor) {
+ return this.modulo(divisor);
+ }
+ rem(divisor) {
+ return this.modulo(divisor);
+ }
+ multiply(multiplier) {
+ if (this.isZero())
+ return Long.ZERO;
+ if (!Long.isLong(multiplier))
+ multiplier = Long.fromValue(multiplier);
+ if (wasm) {
+ const low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (multiplier.isZero())
+ return Long.ZERO;
+ if (this.eq(Long.MIN_VALUE))
+ return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (multiplier.eq(Long.MIN_VALUE))
+ return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (this.isNegative()) {
+ if (multiplier.isNegative())
+ return this.neg().mul(multiplier.neg());
+ else
+ return this.neg().mul(multiplier).neg();
+ }
+ else if (multiplier.isNegative())
+ return this.mul(multiplier.neg()).neg();
+ if (this.lt(Long.TWO_PWR_24) && multiplier.lt(Long.TWO_PWR_24))
+ return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = multiplier.high >>> 16;
+ const b32 = multiplier.high & 0xffff;
+ const b16 = multiplier.low >>> 16;
+ const b00 = multiplier.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ mul(multiplier) {
+ return this.multiply(multiplier);
+ }
+ negate() {
+ if (!this.unsigned && this.eq(Long.MIN_VALUE))
+ return Long.MIN_VALUE;
+ return this.not().add(Long.ONE);
+ }
+ neg() {
+ return this.negate();
+ }
+ not() {
+ return Long.fromBits(~this.low, ~this.high, this.unsigned);
+ }
+ notEquals(other) {
+ return !this.equals(other);
+ }
+ neq(other) {
+ return this.notEquals(other);
+ }
+ ne(other) {
+ return this.notEquals(other);
+ }
+ or(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+ }
+ shiftLeft(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
+ else
+ return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
+ }
+ shl(numBits) {
+ return this.shiftLeft(numBits);
+ }
+ shiftRight(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
+ else
+ return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
+ }
+ shr(numBits) {
+ return this.shiftRight(numBits);
+ }
+ shiftRightUnsigned(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ numBits &= 63;
+ if (numBits === 0)
+ return this;
+ else {
+ const high = this.high;
+ if (numBits < 32) {
+ const low = this.low;
+ return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
+ }
+ else if (numBits === 32)
+ return Long.fromBits(high, 0, this.unsigned);
+ else
+ return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
+ }
+ }
+ shr_u(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ shru(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ subtract(subtrahend) {
+ if (!Long.isLong(subtrahend))
+ subtrahend = Long.fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+ }
+ sub(subtrahend) {
+ return this.subtract(subtrahend);
+ }
+ toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+ }
+ toNumber() {
+ if (this.unsigned)
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+ }
+ toBigInt() {
+ return BigInt(this.toString());
+ }
+ toBytes(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+ }
+ toBytesLE() {
+ const hi = this.high, lo = this.low;
+ return [
+ lo & 0xff,
+ (lo >>> 8) & 0xff,
+ (lo >>> 16) & 0xff,
+ lo >>> 24,
+ hi & 0xff,
+ (hi >>> 8) & 0xff,
+ (hi >>> 16) & 0xff,
+ hi >>> 24
+ ];
+ }
+ toBytesBE() {
+ const hi = this.high, lo = this.low;
+ return [
+ hi >>> 24,
+ (hi >>> 16) & 0xff,
+ (hi >>> 8) & 0xff,
+ hi & 0xff,
+ lo >>> 24,
+ (lo >>> 16) & 0xff,
+ (lo >>> 8) & 0xff,
+ lo & 0xff
+ ];
+ }
+ toSigned() {
+ if (!this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, false);
+ }
+ toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ if (this.isZero())
+ return '0';
+ if (this.isNegative()) {
+ if (this.eq(Long.MIN_VALUE)) {
+ const radixLong = Long.fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ }
+ else
+ return '-' + this.neg().toString(radix);
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
+ let rem = this;
+ let result = '';
+ while (true) {
+ const remDiv = rem.div(radixToPower);
+ const intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0;
+ let digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero()) {
+ return digits + result;
+ }
+ else {
+ while (digits.length < 6)
+ digits = '0' + digits;
+ result = '' + digits + result;
+ }
+ }
+ }
+ toUnsigned() {
+ if (this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, true);
+ }
+ xor(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+ }
+ eqz() {
+ return this.isZero();
+ }
+ le(other) {
+ return this.lessThanOrEqual(other);
+ }
+ toExtendedJSON(options) {
+ if (options && options.relaxed)
+ return this.toNumber();
+ return { $numberLong: this.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ const { useBigInt64 = false, relaxed = true } = { ...options };
+ if (doc.$numberLong.length > MAX_INT64_STRING_LENGTH) {
+ throw new BSONError('$numberLong string is too long');
+ }
+ if (!DECIMAL_REG_EX.test(doc.$numberLong)) {
+ throw new BSONError(`$numberLong string "${doc.$numberLong}" is in an invalid format`);
+ }
+ if (useBigInt64) {
+ const bigIntResult = BigInt(doc.$numberLong);
+ return BigInt.asIntN(64, bigIntResult);
+ }
+ const longResult = Long.fromString(doc.$numberLong);
+ if (relaxed) {
+ return longResult.toNumber();
+ }
+ return longResult;
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const longVal = inspect(this.toString(), options);
+ const unsignedVal = this.unsigned ? `, ${inspect(this.unsigned, options)}` : '';
+ return `new Long(${longVal}${unsignedVal})`;
+ }
+}
+
+const PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/;
+const PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i;
+const PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i;
+const EXPONENT_MAX = 6111;
+const EXPONENT_MIN = -6176;
+const EXPONENT_BIAS = 6176;
+const MAX_DIGITS = 34;
+const NAN_BUFFER = ByteUtils.fromNumberArray([
+ 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_NEGATIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_POSITIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const EXPONENT_REGEX = /^([-+])?(\d+)?$/;
+const COMBINATION_MASK = 0x1f;
+const EXPONENT_MASK = 0x3fff;
+const COMBINATION_INFINITY = 30;
+const COMBINATION_NAN = 31;
+function isDigit(value) {
+ return !isNaN(parseInt(value, 10));
+}
+function divideu128(value) {
+ const DIVISOR = Long.fromNumber(1000 * 1000 * 1000);
+ let _rem = Long.fromNumber(0);
+ if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) {
+ return { quotient: value, rem: _rem };
+ }
+ for (let i = 0; i <= 3; i++) {
+ _rem = _rem.shiftLeft(32);
+ _rem = _rem.add(new Long(value.parts[i], 0));
+ value.parts[i] = _rem.div(DIVISOR).low;
+ _rem = _rem.modulo(DIVISOR);
+ }
+ return { quotient: value, rem: _rem };
+}
+function multiply64x2(left, right) {
+ if (!left && !right) {
+ return { high: Long.fromNumber(0), low: Long.fromNumber(0) };
+ }
+ const leftHigh = left.shiftRightUnsigned(32);
+ const leftLow = new Long(left.getLowBits(), 0);
+ const rightHigh = right.shiftRightUnsigned(32);
+ const rightLow = new Long(right.getLowBits(), 0);
+ let productHigh = leftHigh.multiply(rightHigh);
+ let productMid = leftHigh.multiply(rightLow);
+ const productMid2 = leftLow.multiply(rightHigh);
+ let productLow = leftLow.multiply(rightLow);
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productMid = new Long(productMid.getLowBits(), 0)
+ .add(productMid2)
+ .add(productLow.shiftRightUnsigned(32));
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));
+ return { high: productHigh, low: productLow };
+}
+function lessThan(left, right) {
+ const uhleft = left.high >>> 0;
+ const uhright = right.high >>> 0;
+ if (uhleft < uhright) {
+ return true;
+ }
+ else if (uhleft === uhright) {
+ const ulleft = left.low >>> 0;
+ const ulright = right.low >>> 0;
+ if (ulleft < ulright)
+ return true;
+ }
+ return false;
+}
+function invalidErr(string, message) {
+ throw new BSONError(`"${string}" is not a valid Decimal128 string - ${message}`);
+}
+class Decimal128 extends BSONValue {
+ get _bsontype() {
+ return 'Decimal128';
+ }
+ bytes;
+ constructor(bytes) {
+ super();
+ if (typeof bytes === 'string') {
+ this.bytes = Decimal128.fromString(bytes).bytes;
+ }
+ else if (bytes instanceof Uint8Array || isUint8Array(bytes)) {
+ if (bytes.byteLength !== 16) {
+ throw new BSONError('Decimal128 must take a Buffer of 16 bytes');
+ }
+ this.bytes = bytes;
+ }
+ else {
+ throw new BSONError('Decimal128 must take a Buffer or string');
+ }
+ }
+ static fromString(representation) {
+ return Decimal128._fromString(representation, { allowRounding: false });
+ }
+ static fromStringWithRounding(representation) {
+ return Decimal128._fromString(representation, { allowRounding: true });
+ }
+ static _fromString(representation, options) {
+ let isNegative = false;
+ let sawSign = false;
+ let sawRadix = false;
+ let foundNonZero = false;
+ let significantDigits = 0;
+ let nDigitsRead = 0;
+ let nDigits = 0;
+ let radixPosition = 0;
+ let firstNonZero = 0;
+ const digits = [0];
+ let nDigitsStored = 0;
+ let digitsInsert = 0;
+ let lastDigit = 0;
+ let exponent = 0;
+ let significandHigh = new Long(0, 0);
+ let significandLow = new Long(0, 0);
+ let biasedExponent = 0;
+ let index = 0;
+ if (representation.length >= 7000) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ const stringMatch = representation.match(PARSE_STRING_REGEXP);
+ const infMatch = representation.match(PARSE_INF_REGEXP);
+ const nanMatch = representation.match(PARSE_NAN_REGEXP);
+ if ((!stringMatch && !infMatch && !nanMatch) || representation.length === 0) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ if (stringMatch) {
+ const unsignedNumber = stringMatch[2];
+ const e = stringMatch[4];
+ const expSign = stringMatch[5];
+ const expNumber = stringMatch[6];
+ if (e && expNumber === undefined)
+ invalidErr(representation, 'missing exponent power');
+ if (e && unsignedNumber === undefined)
+ invalidErr(representation, 'missing exponent base');
+ if (e === undefined && (expSign || expNumber)) {
+ invalidErr(representation, 'missing e before exponent');
+ }
+ }
+ if (representation[index] === '+' || representation[index] === '-') {
+ sawSign = true;
+ isNegative = representation[index++] === '-';
+ }
+ if (!isDigit(representation[index]) && representation[index] !== '.') {
+ if (representation[index] === 'i' || representation[index] === 'I') {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ else if (representation[index] === 'N') {
+ return new Decimal128(NAN_BUFFER);
+ }
+ }
+ while (isDigit(representation[index]) || representation[index] === '.') {
+ if (representation[index] === '.') {
+ if (sawRadix)
+ invalidErr(representation, 'contains multiple periods');
+ sawRadix = true;
+ index = index + 1;
+ continue;
+ }
+ if (nDigitsStored < MAX_DIGITS) {
+ if (representation[index] !== '0' || foundNonZero) {
+ if (!foundNonZero) {
+ firstNonZero = nDigitsRead;
+ }
+ foundNonZero = true;
+ digits[digitsInsert++] = parseInt(representation[index], 10);
+ nDigitsStored = nDigitsStored + 1;
+ }
+ }
+ if (foundNonZero)
+ nDigits = nDigits + 1;
+ if (sawRadix)
+ radixPosition = radixPosition + 1;
+ nDigitsRead = nDigitsRead + 1;
+ index = index + 1;
+ }
+ if (sawRadix && !nDigitsRead)
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ if (representation[index] === 'e' || representation[index] === 'E') {
+ const match = representation.substr(++index).match(EXPONENT_REGEX);
+ if (!match || !match[2])
+ return new Decimal128(NAN_BUFFER);
+ exponent = parseInt(match[0], 10);
+ index = index + match[0].length;
+ }
+ if (representation[index])
+ return new Decimal128(NAN_BUFFER);
+ if (!nDigitsStored) {
+ digits[0] = 0;
+ nDigits = 1;
+ nDigitsStored = 1;
+ significantDigits = 0;
+ }
+ else {
+ lastDigit = nDigitsStored - 1;
+ significantDigits = nDigits;
+ if (significantDigits !== 1) {
+ while (representation[firstNonZero + significantDigits - 1 + Number(sawSign) + Number(sawRadix)] === '0') {
+ significantDigits = significantDigits - 1;
+ }
+ }
+ }
+ if (exponent <= radixPosition && radixPosition > exponent + (1 << 14)) {
+ exponent = EXPONENT_MIN;
+ }
+ else {
+ exponent = exponent - radixPosition;
+ }
+ while (exponent > EXPONENT_MAX) {
+ lastDigit = lastDigit + 1;
+ if (lastDigit >= MAX_DIGITS) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ exponent = exponent - 1;
+ }
+ if (options.allowRounding) {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0 && significantDigits < nDigitsStored) {
+ exponent = EXPONENT_MIN;
+ significantDigits = 0;
+ break;
+ }
+ if (nDigitsStored < nDigits) {
+ nDigits = nDigits - 1;
+ }
+ else {
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ const digitsString = digits.join('');
+ if (digitsString.match(/^0+$/)) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ let endOfString = nDigitsRead;
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ let roundBit = 0;
+ if (roundDigit >= 5) {
+ roundBit = 1;
+ if (roundDigit === 5) {
+ roundBit = digits[lastDigit] % 2 === 1 ? 1 : 0;
+ for (let i = firstNonZero + lastDigit + 2; i < endOfString; i++) {
+ if (parseInt(representation[i], 10)) {
+ roundBit = 1;
+ break;
+ }
+ }
+ }
+ }
+ if (roundBit) {
+ let dIdx = lastDigit;
+ for (; dIdx >= 0; dIdx--) {
+ if (++digits[dIdx] > 9) {
+ digits[dIdx] = 0;
+ if (dIdx === 0) {
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ digits[dIdx] = 1;
+ }
+ else {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ }
+ }
+ else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ else {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MIN;
+ break;
+ }
+ invalidErr(representation, 'exponent underflow');
+ }
+ if (nDigitsStored < nDigits) {
+ if (representation[nDigits - 1 + Number(sawSign) + Number(sawRadix)] !== '0' &&
+ significantDigits !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ nDigits = nDigits - 1;
+ }
+ else {
+ if (digits[lastDigit] !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ if (roundDigit !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ }
+ }
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ if (significantDigits === 0) {
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ }
+ else if (lastDigit < 17) {
+ let dIdx = 0;
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ significandHigh = new Long(0, 0);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ else {
+ let dIdx = 0;
+ significandHigh = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit - 17; dIdx++) {
+ significandHigh = significandHigh.multiply(Long.fromNumber(10));
+ significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));
+ }
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ const significand = multiply64x2(significandHigh, Long.fromString('100000000000000000'));
+ significand.low = significand.low.add(significandLow);
+ if (lessThan(significand.low, significandLow)) {
+ significand.high = significand.high.add(Long.fromNumber(1));
+ }
+ biasedExponent = exponent + EXPONENT_BIAS;
+ const dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };
+ if (significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1))) {
+ dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));
+ }
+ else {
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));
+ }
+ dec.low = significand.low;
+ if (isNegative) {
+ dec.high = dec.high.or(Long.fromString('9223372036854775808'));
+ }
+ const buffer = ByteUtils.allocateUnsafe(16);
+ index = 0;
+ buffer[index++] = dec.low.low & 0xff;
+ buffer[index++] = (dec.low.low >> 8) & 0xff;
+ buffer[index++] = (dec.low.low >> 16) & 0xff;
+ buffer[index++] = (dec.low.low >> 24) & 0xff;
+ buffer[index++] = dec.low.high & 0xff;
+ buffer[index++] = (dec.low.high >> 8) & 0xff;
+ buffer[index++] = (dec.low.high >> 16) & 0xff;
+ buffer[index++] = (dec.low.high >> 24) & 0xff;
+ buffer[index++] = dec.high.low & 0xff;
+ buffer[index++] = (dec.high.low >> 8) & 0xff;
+ buffer[index++] = (dec.high.low >> 16) & 0xff;
+ buffer[index++] = (dec.high.low >> 24) & 0xff;
+ buffer[index++] = dec.high.high & 0xff;
+ buffer[index++] = (dec.high.high >> 8) & 0xff;
+ buffer[index++] = (dec.high.high >> 16) & 0xff;
+ buffer[index++] = (dec.high.high >> 24) & 0xff;
+ return new Decimal128(buffer);
+ }
+ toString() {
+ let biased_exponent;
+ let significand_digits = 0;
+ const significand = new Array(36);
+ for (let i = 0; i < significand.length; i++)
+ significand[i] = 0;
+ let index = 0;
+ let is_zero = false;
+ let significand_msb;
+ let significand128 = { parts: [0, 0, 0, 0] };
+ let j, k;
+ const string = [];
+ index = 0;
+ const buffer = this.bytes;
+ const low = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midl = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midh = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const high = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ index = 0;
+ const dec = {
+ low: new Long(low, midl),
+ high: new Long(midh, high)
+ };
+ if (dec.high.lessThan(Long.ZERO)) {
+ string.push('-');
+ }
+ const combination = (high >> 26) & COMBINATION_MASK;
+ if (combination >> 3 === 3) {
+ if (combination === COMBINATION_INFINITY) {
+ return string.join('') + 'Infinity';
+ }
+ else if (combination === COMBINATION_NAN) {
+ return 'NaN';
+ }
+ else {
+ biased_exponent = (high >> 15) & EXPONENT_MASK;
+ significand_msb = 0x08 + ((high >> 14) & 0x01);
+ }
+ }
+ else {
+ significand_msb = (high >> 14) & 0x07;
+ biased_exponent = (high >> 17) & EXPONENT_MASK;
+ }
+ const exponent = biased_exponent - EXPONENT_BIAS;
+ significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);
+ significand128.parts[1] = midh;
+ significand128.parts[2] = midl;
+ significand128.parts[3] = low;
+ if (significand128.parts[0] === 0 &&
+ significand128.parts[1] === 0 &&
+ significand128.parts[2] === 0 &&
+ significand128.parts[3] === 0) {
+ is_zero = true;
+ }
+ else {
+ for (k = 3; k >= 0; k--) {
+ let least_digits = 0;
+ const result = divideu128(significand128);
+ significand128 = result.quotient;
+ least_digits = result.rem.low;
+ if (!least_digits)
+ continue;
+ for (j = 8; j >= 0; j--) {
+ significand[k * 9 + j] = least_digits % 10;
+ least_digits = Math.floor(least_digits / 10);
+ }
+ }
+ }
+ if (is_zero) {
+ significand_digits = 1;
+ significand[index] = 0;
+ }
+ else {
+ significand_digits = 36;
+ while (!significand[index]) {
+ significand_digits = significand_digits - 1;
+ index = index + 1;
+ }
+ }
+ const scientific_exponent = significand_digits - 1 + exponent;
+ if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) {
+ if (significand_digits > 34) {
+ string.push(`${0}`);
+ if (exponent > 0)
+ string.push(`E+${exponent}`);
+ else if (exponent < 0)
+ string.push(`E${exponent}`);
+ return string.join('');
+ }
+ string.push(`${significand[index++]}`);
+ significand_digits = significand_digits - 1;
+ if (significand_digits) {
+ string.push('.');
+ }
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ string.push('E');
+ if (scientific_exponent > 0) {
+ string.push(`+${scientific_exponent}`);
+ }
+ else {
+ string.push(`${scientific_exponent}`);
+ }
+ }
+ else {
+ if (exponent >= 0) {
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ let radix_position = significand_digits + exponent;
+ if (radix_position > 0) {
+ for (let i = 0; i < radix_position; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ string.push('0');
+ }
+ string.push('.');
+ while (radix_position++ < 0) {
+ string.push('0');
+ }
+ for (let i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ }
+ return string.join('');
+ }
+ toJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ toExtendedJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ static fromExtendedJSON(doc) {
+ return Decimal128.fromString(doc.$numberDecimal);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const d128string = inspect(this.toString(), options);
+ return `new Decimal128(${d128string})`;
+ }
+}
+
+class Double extends BSONValue {
+ get _bsontype() {
+ return 'Double';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value;
+ }
+ static fromString(value) {
+ const coercedValue = Number(value);
+ if (value === 'NaN')
+ return new Double(NaN);
+ if (value === 'Infinity')
+ return new Double(Infinity);
+ if (value === '-Infinity')
+ return new Double(-Infinity);
+ if (!Number.isFinite(coercedValue)) {
+ throw new BSONError(`Input: ${value} is not representable as a Double`);
+ }
+ if (value.trim() !== value) {
+ throw new BSONError(`Input: '${value}' contains whitespace`);
+ }
+ if (value === '') {
+ throw new BSONError(`Input is an empty string`);
+ }
+ if (/[^-0-9.+eE]/.test(value)) {
+ throw new BSONError(`Input: '${value}' is not in decimal or exponential notation`);
+ }
+ return new Double(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toExtendedJSON(options) {
+ if (options && (options.legacy || (options.relaxed && isFinite(this.value)))) {
+ return this.value;
+ }
+ if (Object.is(Math.sign(this.value), -0)) {
+ return { $numberDouble: '-0.0' };
+ }
+ return {
+ $numberDouble: Number.isInteger(this.value) ? this.value.toFixed(1) : this.value.toString()
+ };
+ }
+ static fromExtendedJSON(doc, options) {
+ const doubleValue = parseFloat(doc.$numberDouble);
+ return options && options.relaxed ? doubleValue : new Double(doubleValue);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Double(${inspect(this.value, options)})`;
+ }
+}
+
+class Int32 extends BSONValue {
+ get _bsontype() {
+ return 'Int32';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value | 0;
+ }
+ static fromString(value) {
+ const cleanedValue = removeLeadingZerosAndExplicitPlus(value);
+ const coercedValue = Number(value);
+ if (BSON_INT32_MAX < coercedValue) {
+ throw new BSONError(`Input: '${value}' is larger than the maximum value for Int32`);
+ }
+ else if (BSON_INT32_MIN > coercedValue) {
+ throw new BSONError(`Input: '${value}' is smaller than the minimum value for Int32`);
+ }
+ else if (!Number.isSafeInteger(coercedValue)) {
+ throw new BSONError(`Input: '${value}' is not a safe integer`);
+ }
+ else if (coercedValue.toString() !== cleanedValue) {
+ throw new BSONError(`Input: '${value}' is not a valid Int32 string`);
+ }
+ return new Int32(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON(options) {
+ if (options && (options.relaxed || options.legacy))
+ return this.value;
+ return { $numberInt: this.value.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new Int32(doc.$numberInt);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Int32(${inspect(this.value, options)})`;
+ }
+}
+
+class MaxKey extends BSONValue {
+ get _bsontype() {
+ return 'MaxKey';
+ }
+ toExtendedJSON() {
+ return { $maxKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MaxKey();
+ }
+ inspect() {
+ return 'new MaxKey()';
+ }
+}
+
+class MinKey extends BSONValue {
+ get _bsontype() {
+ return 'MinKey';
+ }
+ toExtendedJSON() {
+ return { $minKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MinKey();
+ }
+ inspect() {
+ return 'new MinKey()';
+ }
+}
+
+let PROCESS_UNIQUE = null;
+const __idCache = new WeakMap();
+class ObjectId extends BSONValue {
+ get _bsontype() {
+ return 'ObjectId';
+ }
+ static index = Math.floor(Math.random() * 0xffffff);
+ static cacheHexString;
+ buffer;
+ constructor(inputId) {
+ super();
+ let workingId;
+ if (typeof inputId === 'object' && inputId && 'id' in inputId) {
+ if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
+ throw new BSONError('Argument passed in must have an id that is of type string or Buffer');
+ }
+ if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
+ workingId = ByteUtils.fromHex(inputId.toHexString());
+ }
+ else {
+ workingId = inputId.id;
+ }
+ }
+ else {
+ workingId = inputId;
+ }
+ if (workingId == null) {
+ this.buffer = ObjectId.generate();
+ }
+ else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
+ this.buffer = ByteUtils.toLocalBufferType(workingId);
+ }
+ else if (typeof workingId === 'string') {
+ if (ObjectId.validateHexString(workingId)) {
+ this.buffer = ByteUtils.fromHex(workingId);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, workingId);
+ }
+ }
+ else {
+ throw new BSONError('input must be a 24 character hex string, 12 byte Uint8Array, or an integer');
+ }
+ }
+ else {
+ throw new BSONError('Argument passed in does not match the accepted types');
+ }
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, ByteUtils.toHex(value));
+ }
+ }
+ static validateHexString(string) {
+ if (string?.length !== 24)
+ return false;
+ for (let i = 0; i < 24; i++) {
+ const char = string.charCodeAt(i);
+ if ((char >= 48 && char <= 57) ||
+ (char >= 97 && char <= 102) ||
+ (char >= 65 && char <= 70)) {
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+ toHexString() {
+ if (ObjectId.cacheHexString) {
+ const __id = __idCache.get(this);
+ if (__id)
+ return __id;
+ }
+ const hexString = ByteUtils.toHex(this.id);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, hexString);
+ }
+ return hexString;
+ }
+ static getInc() {
+ return (ObjectId.index = (ObjectId.index + 1) % 0xffffff);
+ }
+ static generate(time) {
+ if ('number' !== typeof time) {
+ time = Math.floor(Date.now() / 1000);
+ }
+ const inc = ObjectId.getInc();
+ const buffer = ByteUtils.allocateUnsafe(12);
+ NumberUtils.setInt32BE(buffer, 0, time);
+ if (PROCESS_UNIQUE === null) {
+ PROCESS_UNIQUE = ByteUtils.randomBytes(5);
+ }
+ buffer[4] = PROCESS_UNIQUE[0];
+ buffer[5] = PROCESS_UNIQUE[1];
+ buffer[6] = PROCESS_UNIQUE[2];
+ buffer[7] = PROCESS_UNIQUE[3];
+ buffer[8] = PROCESS_UNIQUE[4];
+ buffer[11] = inc & 0xff;
+ buffer[10] = (inc >> 8) & 0xff;
+ buffer[9] = (inc >> 16) & 0xff;
+ return buffer;
+ }
+ toString(encoding) {
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ if (encoding === 'hex')
+ return this.toHexString();
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ static is(variable) {
+ return (variable != null &&
+ typeof variable === 'object' &&
+ '_bsontype' in variable &&
+ variable._bsontype === 'ObjectId');
+ }
+ equals(otherId) {
+ if (otherId === undefined || otherId === null) {
+ return false;
+ }
+ if (ObjectId.is(otherId)) {
+ return (this.buffer[11] === otherId.buffer[11] && ByteUtils.equals(this.buffer, otherId.buffer));
+ }
+ if (typeof otherId === 'string') {
+ return otherId.toLowerCase() === this.toHexString();
+ }
+ if (typeof otherId === 'object' && typeof otherId.toHexString === 'function') {
+ const otherIdString = otherId.toHexString();
+ const thisIdString = this.toHexString();
+ return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
+ }
+ return false;
+ }
+ getTimestamp() {
+ const timestamp = new Date();
+ const time = NumberUtils.getUint32BE(this.buffer, 0);
+ timestamp.setTime(Math.floor(time) * 1000);
+ return timestamp;
+ }
+ static createPk() {
+ return new ObjectId();
+ }
+ serializeInto(uint8array, index) {
+ uint8array[index] = this.buffer[0];
+ uint8array[index + 1] = this.buffer[1];
+ uint8array[index + 2] = this.buffer[2];
+ uint8array[index + 3] = this.buffer[3];
+ uint8array[index + 4] = this.buffer[4];
+ uint8array[index + 5] = this.buffer[5];
+ uint8array[index + 6] = this.buffer[6];
+ uint8array[index + 7] = this.buffer[7];
+ uint8array[index + 8] = this.buffer[8];
+ uint8array[index + 9] = this.buffer[9];
+ uint8array[index + 10] = this.buffer[10];
+ uint8array[index + 11] = this.buffer[11];
+ return 12;
+ }
+ static createFromTime(time) {
+ const buffer = ByteUtils.allocate(12);
+ for (let i = 11; i >= 4; i--)
+ buffer[i] = 0;
+ NumberUtils.setInt32BE(buffer, 0, time);
+ return new ObjectId(buffer);
+ }
+ static createFromHexString(hexString) {
+ if (hexString?.length !== 24) {
+ throw new BSONError('hex string must be 24 characters');
+ }
+ return new ObjectId(ByteUtils.fromHex(hexString));
+ }
+ static createFromBase64(base64) {
+ if (base64?.length !== 16) {
+ throw new BSONError('base64 string must be 16 characters');
+ }
+ return new ObjectId(ByteUtils.fromBase64(base64));
+ }
+ static isValid(id) {
+ if (id == null)
+ return false;
+ if (typeof id === 'string')
+ return ObjectId.validateHexString(id);
+ try {
+ new ObjectId(id);
+ return true;
+ }
+ catch {
+ return false;
+ }
+ }
+ toExtendedJSON() {
+ if (this.toHexString)
+ return { $oid: this.toHexString() };
+ return { $oid: this.toString('hex') };
+ }
+ static fromExtendedJSON(doc) {
+ return new ObjectId(doc.$oid);
+ }
+ isCached() {
+ return ObjectId.cacheHexString && __idCache.has(this);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new ObjectId(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+function internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined) {
+ let totalLength = 4 + 1;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined);
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ }
+ for (const key of Object.keys(object)) {
+ totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined);
+ }
+ }
+ return totalLength;
+}
+function calculateElement(name, value, serializeFunctions = false, isArray = false, ignoreUndefined = false) {
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ switch (typeof value) {
+ case 'string':
+ return 1 + ByteUtils.utf8ByteLength(name) + 1 + 4 + ByteUtils.utf8ByteLength(value) + 1;
+ case 'number':
+ if (Math.floor(value) === value &&
+ value >= JS_INT_MIN &&
+ value <= JS_INT_MAX) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (4 + 1);
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ case 'undefined':
+ if (isArray || !ignoreUndefined)
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ return 0;
+ case 'boolean':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 1);
+ case 'object':
+ if (value != null &&
+ typeof value._bsontype === 'string' &&
+ value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value == null || value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ }
+ else if (value._bsontype === 'ObjectId') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (12 + 1);
+ }
+ else if (value instanceof Date || isDate(value)) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (ArrayBuffer.isView(value) ||
+ value instanceof ArrayBuffer ||
+ isAnyArrayBuffer(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 4 + 1) + value.byteLength);
+ }
+ else if (value._bsontype === 'Long' ||
+ value._bsontype === 'Double' ||
+ value._bsontype === 'Timestamp') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (16 + 1);
+ }
+ else if (value._bsontype === 'Code') {
+ if (value.scope != null && Object.keys(value.scope).length > 0) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1 +
+ internalCalculateObjectSize(value.scope, serializeFunctions, ignoreUndefined));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1);
+ }
+ }
+ else if (value._bsontype === 'Binary') {
+ const binary = value;
+ if (binary.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ (binary.position + 1 + 4 + 1 + 4));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (binary.position + 1 + 4 + 1));
+ }
+ }
+ else if (value._bsontype === 'Symbol') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ ByteUtils.utf8ByteLength(value.value) +
+ 4 +
+ 1 +
+ 1);
+ }
+ else if (value._bsontype === 'DBRef') {
+ const ordered_values = Object.assign({
+ $ref: value.collection,
+ $id: value.oid
+ }, value.fields);
+ if (value.db != null) {
+ ordered_values['$db'] = value.db;
+ }
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ internalCalculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined));
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.source) +
+ 1 +
+ (value.global ? 1 : 0) +
+ (value.ignoreCase ? 1 : 0) +
+ (value.multiline ? 1 : 0) +
+ 1);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.pattern) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.options) +
+ 1);
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ internalCalculateObjectSize(value, serializeFunctions, ignoreUndefined) +
+ 1);
+ }
+ case 'function':
+ if (serializeFunctions) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.toString()) +
+ 1);
+ }
+ return 0;
+ case 'bigint':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ case 'symbol':
+ return 0;
+ default:
+ throw new BSONError(`Unrecognized JS type: ${typeof value}`);
+ }
+}
+
+function alphabetize(str) {
+ return str.split('').sort().join('');
+}
+class BSONRegExp extends BSONValue {
+ get _bsontype() {
+ return 'BSONRegExp';
+ }
+ pattern;
+ options;
+ constructor(pattern, options) {
+ super();
+ this.pattern = pattern;
+ this.options = alphabetize(options ?? '');
+ if (this.pattern.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}`);
+ }
+ if (this.options.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex options cannot contain null bytes, found: ${JSON.stringify(this.options)}`);
+ }
+ for (let i = 0; i < this.options.length; i++) {
+ if (!(this.options[i] === 'i' ||
+ this.options[i] === 'm' ||
+ this.options[i] === 'x' ||
+ this.options[i] === 'l' ||
+ this.options[i] === 's' ||
+ this.options[i] === 'u')) {
+ throw new BSONError(`The regular expression option [${this.options[i]}] is not supported`);
+ }
+ }
+ }
+ static parseOptions(options) {
+ return options ? options.split('').sort().join('') : '';
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (options.legacy) {
+ return { $regex: this.pattern, $options: this.options };
+ }
+ return { $regularExpression: { pattern: this.pattern, options: this.options } };
+ }
+ static fromExtendedJSON(doc) {
+ if ('$regex' in doc) {
+ if (typeof doc.$regex !== 'string') {
+ if (doc.$regex._bsontype === 'BSONRegExp') {
+ return doc;
+ }
+ }
+ else {
+ return new BSONRegExp(doc.$regex, BSONRegExp.parseOptions(doc.$options));
+ }
+ }
+ if ('$regularExpression' in doc) {
+ return new BSONRegExp(doc.$regularExpression.pattern, BSONRegExp.parseOptions(doc.$regularExpression.options));
+ }
+ throw new BSONError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(doc)}`);
+ }
+ inspect(depth, options, inspect) {
+ const stylize = getStylizeFunction(options) ?? (v => v);
+ inspect ??= defaultInspect;
+ const pattern = stylize(inspect(this.pattern), 'regexp');
+ const flags = stylize(inspect(this.options), 'regexp');
+ return `new BSONRegExp(${pattern}, ${flags})`;
+ }
+}
+
+class BSONSymbol extends BSONValue {
+ get _bsontype() {
+ return 'BSONSymbol';
+ }
+ value;
+ constructor(value) {
+ super();
+ this.value = value;
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON() {
+ return { $symbol: this.value };
+ }
+ static fromExtendedJSON(doc) {
+ return new BSONSymbol(doc.$symbol);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new BSONSymbol(${inspect(this.value, options)})`;
+ }
+}
+
+const LongWithoutOverridesClass = Long;
+class Timestamp extends LongWithoutOverridesClass {
+ get _bsontype() {
+ return 'Timestamp';
+ }
+ get [bsonType]() {
+ return 'Timestamp';
+ }
+ static MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
+ get i() {
+ return this.low >>> 0;
+ }
+ get t() {
+ return this.high >>> 0;
+ }
+ constructor(low) {
+ if (low == null) {
+ super(0, 0, true);
+ }
+ else if (typeof low === 'bigint') {
+ super(low, true);
+ }
+ else if (Long.isLong(low)) {
+ super(low.low, low.high, true);
+ }
+ else if (typeof low === 'object' && 't' in low && 'i' in low) {
+ if (typeof low.t !== 'number' && (typeof low.t !== 'object' || low.t._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t as a number');
+ }
+ if (typeof low.i !== 'number' && (typeof low.i !== 'object' || low.i._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i as a number');
+ }
+ const t = Number(low.t);
+ const i = Number(low.i);
+ if (t < 0 || Number.isNaN(t)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive t');
+ }
+ if (i < 0 || Number.isNaN(i)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive i');
+ }
+ if (t > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t equal or less than uint32 max');
+ }
+ if (i > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i equal or less than uint32 max');
+ }
+ super(i, t, true);
+ }
+ else {
+ throw new BSONError('A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }');
+ }
+ }
+ toJSON() {
+ return {
+ $timestamp: this.toString()
+ };
+ }
+ static fromInt(value) {
+ return new Timestamp(Long.fromInt(value, true));
+ }
+ static fromNumber(value) {
+ return new Timestamp(Long.fromNumber(value, true));
+ }
+ static fromBits(lowBits, highBits) {
+ return new Timestamp({ i: lowBits, t: highBits });
+ }
+ static fromString(str, optRadix) {
+ return new Timestamp(Long.fromString(str, true, optRadix));
+ }
+ toExtendedJSON() {
+ return { $timestamp: { t: this.t, i: this.i } };
+ }
+ static fromExtendedJSON(doc) {
+ const i = Long.isLong(doc.$timestamp.i)
+ ? doc.$timestamp.i.getLowBitsUnsigned()
+ : doc.$timestamp.i;
+ const t = Long.isLong(doc.$timestamp.t)
+ ? doc.$timestamp.t.getLowBitsUnsigned()
+ : doc.$timestamp.t;
+ return new Timestamp({ t, i });
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const t = inspect(this.t, options);
+ const i = inspect(this.i, options);
+ return `new Timestamp({ t: ${t}, i: ${i} })`;
+ }
+}
+
+const JS_INT_MAX_LONG = Long.fromNumber(JS_INT_MAX);
+const JS_INT_MIN_LONG = Long.fromNumber(JS_INT_MIN);
+function internalDeserialize(buffer, options, isArray) {
+ options = options == null ? {} : options;
+ const index = options && options.index ? options.index : 0;
+ const size = NumberUtils.getInt32LE(buffer, index);
+ if (size < 5) {
+ throw new BSONError(`bson size must be >= 5, is ${size}`);
+ }
+ if (options.allowObjectSmallerThanBufferSize && buffer.length < size) {
+ throw new BSONError(`buffer length ${buffer.length} must be >= bson size ${size}`);
+ }
+ if (!options.allowObjectSmallerThanBufferSize && buffer.length !== size) {
+ throw new BSONError(`buffer length ${buffer.length} must === bson size ${size}`);
+ }
+ if (size + index > buffer.byteLength) {
+ throw new BSONError(`(bson size ${size} + options.index ${index} must be <= buffer length ${buffer.byteLength})`);
+ }
+ if (buffer[index + size - 1] !== 0) {
+ throw new BSONError("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");
+ }
+ return deserializeObject(buffer, index, options, isArray);
+}
+const allowedDBRefKeys = /^\$ref$|^\$id$|^\$db$/;
+function deserializeObject(buffer, index, options, isArray = false) {
+ const fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];
+ const raw = options['raw'] == null ? false : options['raw'];
+ const bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false;
+ const promoteBuffers = options.promoteBuffers ?? false;
+ const promoteLongs = options.promoteLongs ?? true;
+ const promoteValues = options.promoteValues ?? true;
+ const useBigInt64 = options.useBigInt64 ?? false;
+ if (useBigInt64 && !promoteValues) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ if (useBigInt64 && !promoteLongs) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ const validation = options.validation == null ? { utf8: true } : options.validation;
+ let globalUTFValidation = true;
+ let validationSetting;
+ let utf8KeysSet;
+ const utf8ValidatedKeys = validation.utf8;
+ if (typeof utf8ValidatedKeys === 'boolean') {
+ validationSetting = utf8ValidatedKeys;
+ }
+ else {
+ globalUTFValidation = false;
+ const utf8ValidationValues = Object.keys(utf8ValidatedKeys).map(function (key) {
+ return utf8ValidatedKeys[key];
+ });
+ if (utf8ValidationValues.length === 0) {
+ throw new BSONError('UTF-8 validation setting cannot be empty');
+ }
+ if (typeof utf8ValidationValues[0] !== 'boolean') {
+ throw new BSONError('Invalid UTF-8 validation option, must specify boolean values');
+ }
+ validationSetting = utf8ValidationValues[0];
+ if (!utf8ValidationValues.every(item => item === validationSetting)) {
+ throw new BSONError('Invalid UTF-8 validation option - keys must be all true or all false');
+ }
+ }
+ if (!globalUTFValidation) {
+ utf8KeysSet = new Set();
+ for (const key of Object.keys(utf8ValidatedKeys)) {
+ utf8KeysSet.add(key);
+ }
+ }
+ const startIndex = index;
+ if (buffer.length < 5)
+ throw new BSONError('corrupt bson message < 5 bytes long');
+ const size = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (size < 5 || size > buffer.length)
+ throw new BSONError('corrupt bson message');
+ const object = isArray ? [] : {};
+ let arrayIndex = 0;
+ let isPossibleDBRef = isArray ? false : null;
+ while (true) {
+ const elementType = buffer[index++];
+ if (elementType === 0)
+ break;
+ let i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.byteLength)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const name = isArray ? arrayIndex++ : ByteUtils.toUTF8(buffer, index, i, false);
+ let shouldValidateKey = true;
+ if (globalUTFValidation || utf8KeysSet?.has(name)) {
+ shouldValidateKey = validationSetting;
+ }
+ else {
+ shouldValidateKey = !validationSetting;
+ }
+ if (isPossibleDBRef !== false && name[0] === '$') {
+ isPossibleDBRef = allowedDBRefKeys.test(name);
+ }
+ let value;
+ index = i + 1;
+ if (elementType === BSON_DATA_STRING) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ value = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_OID) {
+ const oid = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oid[i] = buffer[index + i];
+ value = new ObjectId(oid);
+ index = index + 12;
+ }
+ else if (elementType === BSON_DATA_INT && promoteValues === false) {
+ value = new Int32(NumberUtils.getInt32LE(buffer, index));
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_INT) {
+ value = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_NUMBER) {
+ value = NumberUtils.getFloat64LE(buffer, index);
+ index += 8;
+ if (promoteValues === false)
+ value = new Double(value);
+ }
+ else if (elementType === BSON_DATA_DATE) {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ value = new Date(new Long(lowBits, highBits).toNumber());
+ }
+ else if (elementType === BSON_DATA_BOOLEAN) {
+ if (buffer[index] !== 0 && buffer[index] !== 1)
+ throw new BSONError('illegal boolean type value');
+ value = buffer[index++] === 1;
+ }
+ else if (elementType === BSON_DATA_OBJECT) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ if (objectSize <= 0 || objectSize > buffer.length - index)
+ throw new BSONError('bad embedded document length in bson');
+ if (raw) {
+ value = buffer.subarray(index, index + objectSize);
+ }
+ else {
+ let objectOptions = options;
+ if (!globalUTFValidation) {
+ objectOptions = { ...options, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, objectOptions, false);
+ }
+ index = index + objectSize;
+ }
+ else if (elementType === BSON_DATA_ARRAY) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ let arrayOptions = options;
+ const stopIndex = index + objectSize;
+ if (fieldsAsRaw && fieldsAsRaw[name]) {
+ arrayOptions = { ...options, raw: true };
+ }
+ if (!globalUTFValidation) {
+ arrayOptions = { ...arrayOptions, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, arrayOptions, true);
+ index = index + objectSize;
+ if (buffer[index - 1] !== 0)
+ throw new BSONError('invalid array terminator byte');
+ if (index !== stopIndex)
+ throw new BSONError('corrupted array bson');
+ }
+ else if (elementType === BSON_DATA_UNDEFINED) {
+ value = undefined;
+ }
+ else if (elementType === BSON_DATA_NULL) {
+ value = null;
+ }
+ else if (elementType === BSON_DATA_LONG) {
+ if (useBigInt64) {
+ value = NumberUtils.getBigInt64LE(buffer, index);
+ index += 8;
+ }
+ else {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ const long = new Long(lowBits, highBits);
+ if (promoteLongs && promoteValues === true) {
+ value =
+ long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG)
+ ? long.toNumber()
+ : long;
+ }
+ else {
+ value = long;
+ }
+ }
+ }
+ else if (elementType === BSON_DATA_DECIMAL128) {
+ const bytes = ByteUtils.allocateUnsafe(16);
+ for (let i = 0; i < 16; i++)
+ bytes[i] = buffer[index + i];
+ index = index + 16;
+ value = new Decimal128(bytes);
+ }
+ else if (elementType === BSON_DATA_BINARY) {
+ let binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ const totalBinarySize = binarySize;
+ const subType = buffer[index++];
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found');
+ if (binarySize > buffer.byteLength)
+ throw new BSONError('Binary type size larger than document size');
+ if (subType === Binary.SUBTYPE_BYTE_ARRAY) {
+ binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found for subtype 0x02');
+ if (binarySize > totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too long binary size');
+ if (binarySize < totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too short binary size');
+ }
+ if (promoteBuffers && promoteValues) {
+ value = ByteUtils.toLocalBufferType(buffer.subarray(index, index + binarySize));
+ }
+ else {
+ value = new Binary(buffer.subarray(index, index + binarySize), subType);
+ if (subType === BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
+ value = value.toUUID();
+ }
+ }
+ index = index + binarySize;
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === false) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ const optionsArray = new Array(regExpOptions.length);
+ for (i = 0; i < regExpOptions.length; i++) {
+ switch (regExpOptions[i]) {
+ case 'm':
+ optionsArray[i] = 'm';
+ break;
+ case 's':
+ optionsArray[i] = 'g';
+ break;
+ case 'i':
+ optionsArray[i] = 'i';
+ break;
+ }
+ }
+ value = new RegExp(source, optionsArray.join(''));
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === true) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ value = new BSONRegExp(source, regExpOptions);
+ }
+ else if (elementType === BSON_DATA_SYMBOL) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const symbol = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = promoteValues ? symbol : new BSONSymbol(symbol);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_TIMESTAMP) {
+ value = new Timestamp({
+ i: NumberUtils.getUint32LE(buffer, index),
+ t: NumberUtils.getUint32LE(buffer, index + 4)
+ });
+ index += 8;
+ }
+ else if (elementType === BSON_DATA_MIN_KEY) {
+ value = new MinKey();
+ }
+ else if (elementType === BSON_DATA_MAX_KEY) {
+ value = new MaxKey();
+ }
+ else if (elementType === BSON_DATA_CODE) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = new Code(functionString);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_CODE_W_SCOPE) {
+ const totalSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (totalSize < 4 + 4 + 4 + 1) {
+ throw new BSONError('code_w_scope total size shorter minimum expected length');
+ }
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ const scopeObject = deserializeObject(buffer, _index, options, false);
+ index = index + objectSize;
+ if (totalSize < 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too short, truncating scope');
+ }
+ if (totalSize > 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too long, clips outer document');
+ }
+ value = new Code(functionString, scopeObject);
+ }
+ else if (elementType === BSON_DATA_DBPOINTER) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0)
+ throw new BSONError('bad string length in bson');
+ const namespace = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const oidBuffer = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oidBuffer[i] = buffer[index + i];
+ const oid = new ObjectId(oidBuffer);
+ index = index + 12;
+ value = new DBRef(namespace, oid);
+ }
+ else {
+ throw new BSONError(`Detected unknown BSON type ${elementType.toString(16)} for fieldname "${name}"`);
+ }
+ if (name === '__proto__') {
+ Object.defineProperty(object, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ object[name] = value;
+ }
+ }
+ if (size !== index - startIndex) {
+ if (isArray)
+ throw new BSONError('corrupt array bson');
+ throw new BSONError('corrupt object bson');
+ }
+ if (!isPossibleDBRef)
+ return object;
+ if (isDBRefLike(object)) {
+ const copy = Object.assign({}, object);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(object.$ref, object.$id, object.$db, copy);
+ }
+ return object;
+}
+
+const regexp = /\x00/;
+const ignoreKeys = new Set(['$db', '$ref', '$id', '$clusterTime']);
+function serializeString(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_STRING;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes + 1;
+ buffer[index - 1] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value, index + 4);
+ NumberUtils.setInt32LE(buffer, index, size + 1);
+ index = index + 4 + size;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeNumber(buffer, key, value, index) {
+ const isNegativeZero = Object.is(value, -0);
+ const type = !isNegativeZero &&
+ Number.isSafeInteger(value) &&
+ value <= BSON_INT32_MAX &&
+ value >= BSON_INT32_MIN
+ ? BSON_DATA_INT
+ : BSON_DATA_NUMBER;
+ buffer[index++] = type;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0x00;
+ if (type === BSON_DATA_INT) {
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ }
+ else {
+ index += NumberUtils.setFloat64LE(buffer, index, value);
+ }
+ return index;
+}
+function serializeBigInt(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_LONG;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index += numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setBigInt64LE(buffer, index, value);
+ return index;
+}
+function serializeNull(buffer, key, _, index) {
+ buffer[index++] = BSON_DATA_NULL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeBoolean(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BOOLEAN;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ buffer[index++] = value ? 1 : 0;
+ return index;
+}
+function serializeDate(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DATE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const dateInMilis = Long.fromNumber(value.getTime());
+ const lowBits = dateInMilis.getLowBits();
+ const highBits = dateInMilis.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.source && value.source.match(regexp) != null) {
+ throw new BSONError('value ' + value.source + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.source, index);
+ buffer[index++] = 0x00;
+ if (value.ignoreCase)
+ buffer[index++] = 0x69;
+ if (value.global)
+ buffer[index++] = 0x73;
+ if (value.multiline)
+ buffer[index++] = 0x6d;
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeBSONRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.pattern.match(regexp) != null) {
+ throw new BSONError('pattern ' + value.pattern + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.pattern, index);
+ buffer[index++] = 0x00;
+ const sortedOptions = value.options.split('').sort().join('');
+ index = index + ByteUtils.encodeUTF8Into(buffer, sortedOptions, index);
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeMinMax(buffer, key, value, index) {
+ if (value === null) {
+ buffer[index++] = BSON_DATA_NULL;
+ }
+ else if (value._bsontype === 'MinKey') {
+ buffer[index++] = BSON_DATA_MIN_KEY;
+ }
+ else {
+ buffer[index++] = BSON_DATA_MAX_KEY;
+ }
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeObjectId(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_OID;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += value.serializeInto(buffer, index);
+ return index;
+}
+function serializeBuffer(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = value.length;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = BSON_BINARY_SUBTYPE_DEFAULT;
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = value[i];
+ }
+ else {
+ buffer.set(value, index);
+ }
+ index = index + size;
+ return index;
+}
+function serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path.has(value)) {
+ throw new BSONError('Cannot convert circular structure to BSON');
+ }
+ path.add(value);
+ buffer[index++] = Array.isArray(value) ? BSON_DATA_ARRAY : BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ path.delete(value);
+ return endIndex;
+}
+function serializeDecimal128(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DECIMAL128;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ for (let i = 0; i < 16; i++)
+ buffer[index + i] = value.bytes[i];
+ return index + 16;
+}
+function serializeLong(buffer, key, value, index) {
+ buffer[index++] =
+ value._bsontype === 'Long' ? BSON_DATA_LONG : BSON_DATA_TIMESTAMP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const lowBits = value.getLowBits();
+ const highBits = value.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeInt32(buffer, key, value, index) {
+ value = value.valueOf();
+ buffer[index++] = BSON_DATA_INT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ return index;
+}
+function serializeDouble(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_NUMBER;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setFloat64LE(buffer, index, value.value);
+ return index;
+}
+function serializeFunction(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeCode(buffer, key, value, index, checkKeys = false, depth = 0, serializeFunctions = false, ignoreUndefined = true, path) {
+ if (value.scope && typeof value.scope === 'object') {
+ buffer[index++] = BSON_DATA_CODE_W_SCOPE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ const functionString = value.code;
+ index = index + 4;
+ const codeSize = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, codeSize);
+ buffer[index + 4 + codeSize - 1] = 0;
+ index = index + codeSize + 4;
+ const endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ index = endIndex - 1;
+ const totalSize = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, startIndex, totalSize);
+ buffer[index++] = 0;
+ }
+ else {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.code.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ }
+ return index;
+}
+function serializeBinary(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const data = value.buffer;
+ let size = value.position;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY)
+ size = size + 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = value.sub_type;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ size = size - 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ }
+ if (value.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(value);
+ }
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = data[i];
+ }
+ else {
+ buffer.set(data, index);
+ }
+ index = index + value.position;
+ return index;
+}
+function serializeSymbol(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_SYMBOL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value.value, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path) {
+ buffer[index++] = BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ let output = {
+ $ref: value.collection || value.namespace,
+ $id: value.oid
+ };
+ if (value.db != null) {
+ output.$db = value.db;
+ }
+ output = Object.assign(output, value.fields);
+ const endIndex = serializeInto(buffer, output, false, index, depth + 1, serializeFunctions, true, path);
+ const size = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, index, size);
+ return endIndex;
+}
+function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path == null) {
+ if (object == null) {
+ buffer[0] = 0x05;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ buffer[4] = 0x00;
+ return 5;
+ }
+ if (Array.isArray(object)) {
+ throw new BSONError('serialize does not support an array as the root input');
+ }
+ if (typeof object !== 'object') {
+ throw new BSONError('serialize does not support non-object as the root input');
+ }
+ else if ('_bsontype' in object && typeof object._bsontype === 'string') {
+ throw new BSONError(`BSON types cannot be serialized as a document`);
+ }
+ else if (isDate(object) ||
+ isRegExp(object) ||
+ isUint8Array(object) ||
+ isAnyArrayBuffer(object)) {
+ throw new BSONError(`date, regexp, typedarray, and arraybuffer cannot be BSON documents`);
+ }
+ path = new Set();
+ }
+ path.add(object);
+ let index = startingIndex + 4;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ const key = `${i}`;
+ let value = object[i];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (value === undefined) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else if (object instanceof Map || isMap(object)) {
+ const iterator = object.entries();
+ let done = false;
+ while (!done) {
+ const entry = iterator.next();
+ done = !!entry.done;
+ if (done)
+ continue;
+ const key = entry.value ? entry.value[0] : undefined;
+ let value = entry.value ? entry.value[1] : undefined;
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ if (object != null && typeof object !== 'object') {
+ throw new BSONError('toBSON function did not return an object');
+ }
+ }
+ for (const key of Object.keys(object)) {
+ let value = object[key];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ path.delete(object);
+ buffer[index++] = 0x00;
+ const size = index - startingIndex;
+ startingIndex += NumberUtils.setInt32LE(buffer, startingIndex, size);
+ return index;
+}
+
+function isBSONType(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '_bsontype' in value &&
+ typeof value._bsontype === 'string');
+}
+const keysToCodecs = {
+ $oid: ObjectId,
+ $binary: Binary,
+ $uuid: Binary,
+ $symbol: BSONSymbol,
+ $numberInt: Int32,
+ $numberDecimal: Decimal128,
+ $numberDouble: Double,
+ $numberLong: Long,
+ $minKey: MinKey,
+ $maxKey: MaxKey,
+ $regex: BSONRegExp,
+ $regularExpression: BSONRegExp,
+ $timestamp: Timestamp
+};
+function deserializeValue(value, options = {}) {
+ if (typeof value === 'number') {
+ const in32BitRange = value <= BSON_INT32_MAX && value >= BSON_INT32_MIN;
+ const in64BitRange = value <= BSON_INT64_MAX && value >= BSON_INT64_MIN;
+ if (options.relaxed || options.legacy) {
+ return value;
+ }
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (in32BitRange) {
+ return new Int32(value);
+ }
+ if (in64BitRange) {
+ if (options.useBigInt64) {
+ return BigInt(value);
+ }
+ return Long.fromNumber(value);
+ }
+ }
+ return new Double(value);
+ }
+ if (value == null || typeof value !== 'object')
+ return value;
+ if (value.$undefined)
+ return null;
+ const keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);
+ for (let i = 0; i < keys.length; i++) {
+ const c = keysToCodecs[keys[i]];
+ if (c)
+ return c.fromExtendedJSON(value, options);
+ }
+ if (value.$date != null) {
+ const d = value.$date;
+ const date = new Date();
+ if (options.legacy) {
+ if (typeof d === 'number')
+ date.setTime(d);
+ else if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ else {
+ if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (Long.isLong(d))
+ date.setTime(d.toNumber());
+ else if (typeof d === 'number' && options.relaxed)
+ date.setTime(d);
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ return date;
+ }
+ if (value.$code != null) {
+ const copy = Object.assign({}, value);
+ if (value.$scope) {
+ copy.$scope = deserializeValue(value.$scope);
+ }
+ return Code.fromExtendedJSON(value);
+ }
+ if (isDBRefLike(value) || value.$dbPointer) {
+ const v = value.$ref ? value : value.$dbPointer;
+ if (v instanceof DBRef)
+ return v;
+ const dollarKeys = Object.keys(v).filter(k => k.startsWith('$'));
+ let valid = true;
+ dollarKeys.forEach(k => {
+ if (['$ref', '$id', '$db'].indexOf(k) === -1)
+ valid = false;
+ });
+ if (valid)
+ return DBRef.fromExtendedJSON(v);
+ }
+ return value;
+}
+function serializeArray(array, options) {
+ return array.map((v, index) => {
+ options.seenObjects.push({ propertyName: `index ${index}`, obj: null });
+ try {
+ return serializeValue(v, options);
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ });
+}
+function getISOString(date) {
+ const isoStr = date.toISOString();
+ return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';
+}
+function serializeValue(value, options) {
+ if (value instanceof Map || isMap(value)) {
+ const obj = Object.create(null);
+ for (const [k, v] of value) {
+ if (typeof k !== 'string') {
+ throw new BSONError('Can only serialize maps with string keys');
+ }
+ obj[k] = v;
+ }
+ return serializeValue(obj, options);
+ }
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null) {
+ const index = options.seenObjects.findIndex(entry => entry.obj === value);
+ if (index !== -1) {
+ const props = options.seenObjects.map(entry => entry.propertyName);
+ const leadingPart = props
+ .slice(0, index)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const alreadySeen = props[index];
+ const circularPart = ' -> ' +
+ props
+ .slice(index + 1, props.length - 1)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const current = props[props.length - 1];
+ const leadingSpace = ' '.repeat(leadingPart.length + alreadySeen.length / 2);
+ const dashes = '-'.repeat(circularPart.length + (alreadySeen.length + current.length) / 2 - 1);
+ throw new BSONError('Converting circular structure to EJSON:\n' +
+ ` ${leadingPart}${alreadySeen}${circularPart}${current}\n` +
+ ` ${leadingSpace}\\${dashes}/`);
+ }
+ options.seenObjects[options.seenObjects.length - 1].obj = value;
+ }
+ if (Array.isArray(value))
+ return serializeArray(value, options);
+ if (value === undefined)
+ return options.ignoreUndefined ? undefined : null;
+ if (value instanceof Date || isDate(value)) {
+ const dateNum = value.getTime(), inRange = dateNum > -1 && dateNum < 253402318800000;
+ if (options.legacy) {
+ return options.relaxed && inRange
+ ? { $date: value.getTime() }
+ : { $date: getISOString(value) };
+ }
+ return options.relaxed && inRange
+ ? { $date: getISOString(value) }
+ : { $date: { $numberLong: value.getTime().toString() } };
+ }
+ if (typeof value === 'number' && (!options.relaxed || !isFinite(value))) {
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return { $numberInt: value.toString() };
+ }
+ if (value >= BSON_INT64_MIN && value <= BSON_INT64_MAX) {
+ return { $numberLong: value.toString() };
+ }
+ }
+ return { $numberDouble: Object.is(value, -0) ? '-0.0' : value.toString() };
+ }
+ if (typeof value === 'bigint') {
+ if (!options.relaxed) {
+ return { $numberLong: BigInt.asIntN(64, value).toString() };
+ }
+ return Number(BigInt.asIntN(64, value));
+ }
+ if (value instanceof RegExp || isRegExp(value)) {
+ let flags = value.flags;
+ if (flags === undefined) {
+ const match = value.toString().match(/[gimuy]*$/);
+ if (match) {
+ flags = match[0];
+ }
+ }
+ const rx = new BSONRegExp(value.source, flags);
+ return rx.toExtendedJSON(options);
+ }
+ if (value != null && typeof value === 'object')
+ return serializeDocument(value, options);
+ return value;
+}
+const BSON_TYPE_MAPPINGS = {
+ Binary: (o) => new Binary(o.value(), o.sub_type),
+ Code: (o) => new Code(o.code, o.scope),
+ DBRef: (o) => new DBRef(o.collection || o.namespace, o.oid, o.db, o.fields),
+ Decimal128: (o) => new Decimal128(o.bytes),
+ Double: (o) => new Double(o.value),
+ Int32: (o) => new Int32(o.value),
+ 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_),
+ MaxKey: () => new MaxKey(),
+ MinKey: () => new MinKey(),
+ ObjectId: (o) => new ObjectId(o),
+ BSONRegExp: (o) => new BSONRegExp(o.pattern, o.options),
+ BSONSymbol: (o) => new BSONSymbol(o.value),
+ Timestamp: (o) => Timestamp.fromBits(o.low, o.high)
+};
+function serializeDocument(doc, options) {
+ if (doc == null || typeof doc !== 'object')
+ throw new BSONError('not an object instance');
+ const bsontype = doc._bsontype;
+ if (typeof bsontype === 'undefined') {
+ const _doc = {};
+ for (const name of Object.keys(doc)) {
+ options.seenObjects.push({ propertyName: name, obj: null });
+ try {
+ const value = serializeValue(doc[name], options);
+ if (name === '__proto__') {
+ Object.defineProperty(_doc, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ _doc[name] = value;
+ }
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ }
+ return _doc;
+ }
+ else if (doc != null &&
+ typeof doc === 'object' &&
+ typeof doc._bsontype === 'string' &&
+ doc[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (isBSONType(doc)) {
+ let outDoc = doc;
+ if (typeof outDoc.toExtendedJSON !== 'function') {
+ const mapper = BSON_TYPE_MAPPINGS[doc._bsontype];
+ if (!mapper) {
+ throw new BSONError('Unrecognized or invalid _bsontype: ' + doc._bsontype);
+ }
+ outDoc = mapper(outDoc);
+ }
+ if (bsontype === 'Code' && outDoc.scope) {
+ outDoc = new Code(outDoc.code, serializeValue(outDoc.scope, options));
+ }
+ else if (bsontype === 'DBRef' && outDoc.oid) {
+ outDoc = new DBRef(serializeValue(outDoc.collection, options), serializeValue(outDoc.oid, options), serializeValue(outDoc.db, options), serializeValue(outDoc.fields, options));
+ }
+ return outDoc.toExtendedJSON(options);
+ }
+ else {
+ throw new BSONError('_bsontype must be a string, but was: ' + typeof bsontype);
+ }
+}
+function parse(text, options) {
+ const ejsonOptions = {
+ useBigInt64: options?.useBigInt64 ?? false,
+ relaxed: options?.relaxed ?? true,
+ legacy: options?.legacy ?? false
+ };
+ return JSON.parse(text, (key, value) => {
+ if (key.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Document field names cannot contain null bytes, found: ${JSON.stringify(key)}`);
+ }
+ return deserializeValue(value, ejsonOptions);
+ });
+}
+function stringify(value, replacer, space, options) {
+ if (space != null && typeof space === 'object') {
+ options = space;
+ space = 0;
+ }
+ if (replacer != null && typeof replacer === 'object' && !Array.isArray(replacer)) {
+ options = replacer;
+ replacer = undefined;
+ space = 0;
+ }
+ const serializeOptions = Object.assign({ relaxed: true, legacy: false }, options, {
+ seenObjects: [{ propertyName: '(root)', obj: null }]
+ });
+ const doc = serializeValue(value, serializeOptions);
+ return JSON.stringify(doc, replacer, space);
+}
+function EJSONserialize(value, options) {
+ options = options || {};
+ return JSON.parse(stringify(value, options));
+}
+function EJSONdeserialize(ejson, options) {
+ options = options || {};
+ return parse(JSON.stringify(ejson), options);
+}
+const EJSON = Object.create(null);
+EJSON.parse = parse;
+EJSON.stringify = stringify;
+EJSON.serialize = EJSONserialize;
+EJSON.deserialize = EJSONdeserialize;
+Object.freeze(EJSON);
+
+const BSONElementType = {
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: 255,
+ maxKey: 127
+};
+function getSize(source, offset) {
+ try {
+ return NumberUtils.getNonnegativeInt32LE(source, offset);
+ }
+ catch (cause) {
+ throw new BSONOffsetError('BSON size cannot be negative', offset, { cause });
+ }
+}
+function findNull(bytes, offset) {
+ let nullTerminatorOffset = offset;
+ for (; bytes[nullTerminatorOffset] !== 0x00; nullTerminatorOffset++)
+ ;
+ if (nullTerminatorOffset === bytes.length - 1) {
+ throw new BSONOffsetError('Null terminator not found', offset);
+ }
+ return nullTerminatorOffset;
+}
+function parseToElements(bytes, startOffset = 0) {
+ startOffset ??= 0;
+ if (bytes.length < 5) {
+ throw new BSONOffsetError(`Input must be at least 5 bytes, got ${bytes.length} bytes`, startOffset);
+ }
+ const documentSize = getSize(bytes, startOffset);
+ if (documentSize > bytes.length - startOffset) {
+ throw new BSONOffsetError(`Parsed documentSize (${documentSize} bytes) does not match input length (${bytes.length} bytes)`, startOffset);
+ }
+ if (bytes[startOffset + documentSize - 1] !== 0x00) {
+ throw new BSONOffsetError('BSON documents must end in 0x00', startOffset + documentSize);
+ }
+ const elements = [];
+ let offset = startOffset + 4;
+ while (offset <= documentSize + startOffset) {
+ const type = bytes[offset];
+ offset += 1;
+ if (type === 0) {
+ if (offset - startOffset !== documentSize) {
+ throw new BSONOffsetError(`Invalid 0x00 type byte`, offset);
+ }
+ break;
+ }
+ const nameOffset = offset;
+ const nameLength = findNull(bytes, offset) - nameOffset;
+ offset += nameLength + 1;
+ let length;
+ if (type === BSONElementType.double ||
+ type === BSONElementType.long ||
+ type === BSONElementType.date ||
+ type === BSONElementType.timestamp) {
+ length = 8;
+ }
+ else if (type === BSONElementType.int) {
+ length = 4;
+ }
+ else if (type === BSONElementType.objectId) {
+ length = 12;
+ }
+ else if (type === BSONElementType.decimal) {
+ length = 16;
+ }
+ else if (type === BSONElementType.bool) {
+ length = 1;
+ }
+ else if (type === BSONElementType.null ||
+ type === BSONElementType.undefined ||
+ type === BSONElementType.maxKey ||
+ type === BSONElementType.minKey) {
+ length = 0;
+ }
+ else if (type === BSONElementType.regex) {
+ length = findNull(bytes, findNull(bytes, offset) + 1) + 1 - offset;
+ }
+ else if (type === BSONElementType.object ||
+ type === BSONElementType.array ||
+ type === BSONElementType.javascriptWithScope) {
+ length = getSize(bytes, offset);
+ }
+ else if (type === BSONElementType.string ||
+ type === BSONElementType.binData ||
+ type === BSONElementType.dbPointer ||
+ type === BSONElementType.javascript ||
+ type === BSONElementType.symbol) {
+ length = getSize(bytes, offset) + 4;
+ if (type === BSONElementType.binData) {
+ length += 1;
+ }
+ if (type === BSONElementType.dbPointer) {
+ length += 12;
+ }
+ }
+ else {
+ throw new BSONOffsetError(`Invalid 0x${type.toString(16).padStart(2, '0')} type byte`, offset);
+ }
+ if (length > documentSize) {
+ throw new BSONOffsetError('value reports length larger than document', offset);
+ }
+ elements.push([type, nameOffset, nameLength, offset, length]);
+ offset += length;
+ }
+ return elements;
+}
+
+const onDemand = Object.create(null);
+onDemand.parseToElements = parseToElements;
+onDemand.ByteUtils = ByteUtils;
+onDemand.NumberUtils = NumberUtils;
+Object.freeze(onDemand);
+
+const MAXSIZE = 1024 * 1024 * 17;
+let buffer = ByteUtils.allocate(MAXSIZE);
+function setInternalBufferSize(size) {
+ if (buffer.length < size) {
+ buffer = ByteUtils.allocate(size);
+ }
+}
+function serialize(object, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const minInternalBufferSize = typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE;
+ if (buffer.length < minInternalBufferSize) {
+ buffer = ByteUtils.allocate(minInternalBufferSize);
+ }
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ const finishedBuffer = ByteUtils.allocateUnsafe(serializationIndex);
+ finishedBuffer.set(buffer.subarray(0, serializationIndex), 0);
+ return finishedBuffer;
+}
+function serializeWithBufferAndIndex(object, finalBuffer, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const startIndex = typeof options.index === 'number' ? options.index : 0;
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ finalBuffer.set(buffer.subarray(0, serializationIndex), startIndex);
+ return startIndex + serializationIndex - 1;
+}
+function deserialize(buffer, options = {}) {
+ return internalDeserialize(ByteUtils.toLocalBufferType(buffer), options);
+}
+function calculateObjectSize(object, options = {}) {
+ options = options || {};
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ return internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined);
+}
+function deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {
+ const internalOptions = Object.assign({ allowObjectSmallerThanBufferSize: true, index: 0 }, options);
+ const bufferData = ByteUtils.toLocalBufferType(data);
+ let index = startIndex;
+ for (let i = 0; i < numberOfDocuments; i++) {
+ const size = NumberUtils.getInt32LE(bufferData, index);
+ internalOptions.index = index;
+ documents[docStartIndex + i] = internalDeserialize(bufferData, internalOptions);
+ index = index + size;
+ }
+ return index;
+}
+
+var bson = /*#__PURE__*/Object.freeze({
+__proto__: null,
+BSONError: BSONError,
+BSONOffsetError: BSONOffsetError,
+BSONRegExp: BSONRegExp,
+BSONRuntimeError: BSONRuntimeError,
+BSONSymbol: BSONSymbol,
+BSONType: BSONType,
+BSONValue: BSONValue,
+BSONVersionError: BSONVersionError,
+Binary: Binary,
+ByteUtils: ByteUtils,
+Code: Code,
+DBRef: DBRef,
+Decimal128: Decimal128,
+Double: Double,
+EJSON: EJSON,
+Int32: Int32,
+Long: Long,
+MaxKey: MaxKey,
+MinKey: MinKey,
+NumberUtils: NumberUtils,
+ObjectId: ObjectId,
+Timestamp: Timestamp,
+UUID: UUID,
+bsonType: bsonType,
+calculateObjectSize: calculateObjectSize,
+deserialize: deserialize,
+deserializeStream: deserializeStream,
+onDemand: onDemand,
+serialize: serialize,
+serializeWithBufferAndIndex: serializeWithBufferAndIndex,
+setInternalBufferSize: setInternalBufferSize
+});
+
+exports.BSON = bson;
+exports.BSONError = BSONError;
+exports.BSONOffsetError = BSONOffsetError;
+exports.BSONRegExp = BSONRegExp;
+exports.BSONRuntimeError = BSONRuntimeError;
+exports.BSONSymbol = BSONSymbol;
+exports.BSONType = BSONType;
+exports.BSONValue = BSONValue;
+exports.BSONVersionError = BSONVersionError;
+exports.Binary = Binary;
+exports.ByteUtils = ByteUtils;
+exports.Code = Code;
+exports.DBRef = DBRef;
+exports.Decimal128 = Decimal128;
+exports.Double = Double;
+exports.EJSON = EJSON;
+exports.Int32 = Int32;
+exports.Long = Long;
+exports.MaxKey = MaxKey;
+exports.MinKey = MinKey;
+exports.NumberUtils = NumberUtils;
+exports.ObjectId = ObjectId;
+exports.Timestamp = Timestamp;
+exports.UUID = UUID;
+exports.bsonType = bsonType;
+exports.calculateObjectSize = calculateObjectSize;
+exports.deserialize = deserialize;
+exports.deserializeStream = deserializeStream;
+exports.onDemand = onDemand;
+exports.serialize = serialize;
+exports.serializeWithBufferAndIndex = serializeWithBufferAndIndex;
+exports.setInternalBufferSize = setInternalBufferSize;
+
+return exports;
+
+})({});
+//# sourceMappingURL=bson.bundle.js.map
diff --git a/node_modules/bson/lib/bson.bundle.js.map b/node_modules/bson/lib/bson.bundle.js.map
new file mode 100644
index 00000000..5814155f
--- /dev/null
+++ b/node_modules/bson/lib/bson.bundle.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"bson.bundle.js","sources":["../src/parser/utils.ts","../src/constants.ts","../src/error.ts","../src/parse_utf8.ts","../src/utils/latin.ts","../src/utils/node_byte_utils.ts","../src/utils/web_byte_utils.ts","../src/utils/byte_utils.ts","../src/bson_value.ts","../src/utils/number_utils.ts","../src/binary.ts","../src/code.ts","../src/db_ref.ts","../src/utils/string_utils.ts","../src/long.ts","../src/decimal128.ts","../src/double.ts","../src/int_32.ts","../src/max_key.ts","../src/min_key.ts","../src/objectid.ts","../src/parser/calculate_size.ts","../src/regexp.ts","../src/symbol.ts","../src/timestamp.ts","../src/parser/deserializer.ts","../src/parser/serializer.ts","../src/extended_json.ts","../src/parser/on_demand/parse_to_elements.ts","../src/parser/on_demand/index.ts","../src/bson.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["StringUtils.validateStringCharacters","StringUtils.removeLeadingZerosAndExplicitPlus","constants.JS_INT_MIN","constants.JS_INT_MAX","constants.BSON_INT32_MIN","constants.BSON_INT32_MAX","constants.BSON_VERSION_SYMBOL","constants.BSON_MAJOR_VERSION","constants.BSON_DATA_STRING","constants.BSON_DATA_OID","constants.BSON_DATA_INT","constants.BSON_DATA_NUMBER","constants.BSON_DATA_DATE","constants.BSON_DATA_BOOLEAN","constants.BSON_DATA_OBJECT","constants.BSON_DATA_ARRAY","constants.BSON_DATA_UNDEFINED","constants.BSON_DATA_NULL","constants.BSON_DATA_LONG","constants.BSON_DATA_DECIMAL128","constants.BSON_DATA_BINARY","constants.BSON_BINARY_SUBTYPE_UUID_NEW","constants.BSON_DATA_REGEXP","constants.BSON_DATA_SYMBOL","constants.BSON_DATA_TIMESTAMP","constants.BSON_DATA_MIN_KEY","constants.BSON_DATA_MAX_KEY","constants.BSON_DATA_CODE","constants.BSON_DATA_CODE_W_SCOPE","constants.BSON_DATA_DBPOINTER","constants.BSON_BINARY_SUBTYPE_DEFAULT"],"mappings":";;;AAAA,MAAM,uCAAuC,GAAG,CAAC,MAAK;IAIpD,MAAM,CAAC,GAAG,MAAM,CAAC,wBAAwB,CACvC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAC3C,MAAM,CAAC,WAAW,CAClB,CAAC,GAAI;IAEP,OAAO,CAAC,KAAc,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK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AAC,MAAM,EAAE,kBAAkB,EAAE,eAAe,CAAC;AACjF;AAcM,SAAU,iBAAiB,CAC/B,IAA8B,EAC9B,UAAkB,EAClB,iBAAyB,EACzB,SAAqB,EACrB,aAAqB,EACrB,OAA2B,EAAA;AAE3B,IAAA,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,EAAE,gCAAgC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,EACpD,OAAO,CACR;IACD,MAAM,UAAU,GAAG,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC;IAEpD,IAAI,KAAK,GAAG,UAAU;AAEtB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,EAAE,CAAC,EAAE,EAAE;QAE1C,MAAM,IAAI,GAAG,WAAW,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC;AAEtD,QAAA,eAAe,CAAC,KAAK,GAAG,KAAK;AAE7B,QAAA,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC,GAAG,mBAAmB,CAAC,UAAU,EAAE,eAAe,CAAC;AAE/E,QAAA,KAAK,GAAG,KAAK,GAAG,IAAI;IACtB;AAGA,IAAA,OAAO,KAAK;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/node_modules/bson/lib/bson.cjs b/node_modules/bson/lib/bson.cjs
new file mode 100644
index 00000000..5e377402
--- /dev/null
+++ b/node_modules/bson/lib/bson.cjs
@@ -0,0 +1,4745 @@
+'use strict';
+
+const TypedArrayPrototypeGetSymbolToStringTag = (() => {
+ const g = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get;
+ return (value) => g.call(value);
+})();
+function isUint8Array(value) {
+ return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array';
+}
+function isAnyArrayBuffer(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ (value[Symbol.toStringTag] === 'ArrayBuffer' ||
+ value[Symbol.toStringTag] === 'SharedArrayBuffer'));
+}
+function isRegExp(regexp) {
+ return regexp instanceof RegExp || Object.prototype.toString.call(regexp) === '[object RegExp]';
+}
+function isMap(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ value[Symbol.toStringTag] === 'Map');
+}
+function isDate(date) {
+ return date instanceof Date || Object.prototype.toString.call(date) === '[object Date]';
+}
+function defaultInspect(x, _options) {
+ return JSON.stringify(x, (k, v) => {
+ if (typeof v === 'bigint') {
+ return { $numberLong: `${v}` };
+ }
+ else if (isMap(v)) {
+ return Object.fromEntries(v);
+ }
+ return v;
+ });
+}
+function getStylizeFunction(options) {
+ const stylizeExists = options != null &&
+ typeof options === 'object' &&
+ 'stylize' in options &&
+ typeof options.stylize === 'function';
+ if (stylizeExists) {
+ return options.stylize;
+ }
+}
+
+const BSON_MAJOR_VERSION = 7;
+const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version');
+const BSON_INT32_MAX = 0x7fffffff;
+const BSON_INT32_MIN = -2147483648;
+const BSON_INT64_MAX = Math.pow(2, 63) - 1;
+const BSON_INT64_MIN = -Math.pow(2, 63);
+const JS_INT_MAX = Math.pow(2, 53);
+const JS_INT_MIN = -Math.pow(2, 53);
+const BSON_DATA_NUMBER = 1;
+const BSON_DATA_STRING = 2;
+const BSON_DATA_OBJECT = 3;
+const BSON_DATA_ARRAY = 4;
+const BSON_DATA_BINARY = 5;
+const BSON_DATA_UNDEFINED = 6;
+const BSON_DATA_OID = 7;
+const BSON_DATA_BOOLEAN = 8;
+const BSON_DATA_DATE = 9;
+const BSON_DATA_NULL = 10;
+const BSON_DATA_REGEXP = 11;
+const BSON_DATA_DBPOINTER = 12;
+const BSON_DATA_CODE = 13;
+const BSON_DATA_SYMBOL = 14;
+const BSON_DATA_CODE_W_SCOPE = 15;
+const BSON_DATA_INT = 16;
+const BSON_DATA_TIMESTAMP = 17;
+const BSON_DATA_LONG = 18;
+const BSON_DATA_DECIMAL128 = 19;
+const BSON_DATA_MIN_KEY = 0xff;
+const BSON_DATA_MAX_KEY = 0x7f;
+const BSON_BINARY_SUBTYPE_DEFAULT = 0;
+const BSON_BINARY_SUBTYPE_UUID_NEW = 4;
+const BSONType = Object.freeze({
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: -1,
+ maxKey: 127
+});
+
+class BSONError extends Error {
+ get bsonError() {
+ return true;
+ }
+ get name() {
+ return 'BSONError';
+ }
+ constructor(message, options) {
+ super(message, options);
+ }
+ static isBSONError(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ 'bsonError' in value &&
+ value.bsonError === true &&
+ 'name' in value &&
+ 'message' in value &&
+ 'stack' in value);
+ }
+}
+class BSONVersionError extends BSONError {
+ get name() {
+ return 'BSONVersionError';
+ }
+ constructor() {
+ super(`Unsupported BSON version, bson types must be from bson ${BSON_MAJOR_VERSION}.x.x`);
+ }
+}
+class BSONRuntimeError extends BSONError {
+ get name() {
+ return 'BSONRuntimeError';
+ }
+ constructor(message) {
+ super(message);
+ }
+}
+class BSONOffsetError extends BSONError {
+ get name() {
+ return 'BSONOffsetError';
+ }
+ offset;
+ constructor(message, offset, options) {
+ super(`${message}. offset: ${offset}`, options);
+ this.offset = offset;
+ }
+}
+
+let TextDecoderFatal;
+let TextDecoderNonFatal;
+function parseUtf8(buffer, start, end, fatal) {
+ if (fatal) {
+ TextDecoderFatal ??= new TextDecoder('utf8', { fatal: true });
+ try {
+ return TextDecoderFatal.decode(buffer.subarray(start, end));
+ }
+ catch (cause) {
+ throw new BSONError('Invalid UTF-8 string in BSON document', { cause });
+ }
+ }
+ TextDecoderNonFatal ??= new TextDecoder('utf8', { fatal: false });
+ return TextDecoderNonFatal.decode(buffer.subarray(start, end));
+}
+
+function tryReadBasicLatin(uint8array, start, end) {
+ if (uint8array.length === 0) {
+ return '';
+ }
+ const stringByteLength = end - start;
+ if (stringByteLength === 0) {
+ return '';
+ }
+ if (stringByteLength > 20) {
+ return null;
+ }
+ if (stringByteLength === 1 && uint8array[start] < 128) {
+ return String.fromCharCode(uint8array[start]);
+ }
+ if (stringByteLength === 2 && uint8array[start] < 128 && uint8array[start + 1] < 128) {
+ return String.fromCharCode(uint8array[start]) + String.fromCharCode(uint8array[start + 1]);
+ }
+ if (stringByteLength === 3 &&
+ uint8array[start] < 128 &&
+ uint8array[start + 1] < 128 &&
+ uint8array[start + 2] < 128) {
+ return (String.fromCharCode(uint8array[start]) +
+ String.fromCharCode(uint8array[start + 1]) +
+ String.fromCharCode(uint8array[start + 2]));
+ }
+ const latinBytes = [];
+ for (let i = start; i < end; i++) {
+ const byte = uint8array[i];
+ if (byte > 127) {
+ return null;
+ }
+ latinBytes.push(byte);
+ }
+ return String.fromCharCode(...latinBytes);
+}
+function tryWriteBasicLatin(destination, source, offset) {
+ if (source.length === 0)
+ return 0;
+ if (source.length > 25)
+ return null;
+ if (destination.length - offset < source.length)
+ return null;
+ for (let charOffset = 0, destinationOffset = offset; charOffset < source.length; charOffset++, destinationOffset++) {
+ const char = source.charCodeAt(charOffset);
+ if (char > 127)
+ return null;
+ destination[destinationOffset] = char;
+ }
+ return source.length;
+}
+
+function nodejsMathRandomBytes(byteLength) {
+ return nodeJsByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+function nodejsSecureRandomBytes(byteLength) {
+ return crypto.getRandomValues(nodeJsByteUtils.allocate(byteLength));
+}
+const nodejsRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return nodejsSecureRandomBytes;
+ }
+ else {
+ return nodejsMathRandomBytes;
+ }
+})();
+const nodeJsByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialBuffer) {
+ if (Buffer.isBuffer(potentialBuffer)) {
+ return potentialBuffer;
+ }
+ if (ArrayBuffer.isView(potentialBuffer)) {
+ return Buffer.from(potentialBuffer.buffer, potentialBuffer.byteOffset, potentialBuffer.byteLength);
+ }
+ const stringTag = potentialBuffer?.[Symbol.toStringTag] ?? Object.prototype.toString.call(potentialBuffer);
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return Buffer.from(potentialBuffer);
+ }
+ throw new BSONError(`Cannot create Buffer from the passed potentialBuffer.`);
+ },
+ allocate(size) {
+ return Buffer.alloc(size);
+ },
+ allocateUnsafe(size) {
+ return Buffer.allocUnsafe(size);
+ },
+ compare(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).compare(b);
+ },
+ concat(list) {
+ return Buffer.concat(list);
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ return nodeJsByteUtils
+ .toLocalBufferType(source)
+ .copy(target, targetStart ?? 0, sourceStart ?? 0, sourceEnd ?? source.length);
+ },
+ equals(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).equals(b);
+ },
+ fromNumberArray(array) {
+ return Buffer.from(array);
+ },
+ fromBase64(base64) {
+ return Buffer.from(base64, 'base64');
+ },
+ fromUTF8(utf8) {
+ return Buffer.from(utf8, 'utf8');
+ },
+ toBase64(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('base64');
+ },
+ fromISO88591(codePoints) {
+ return Buffer.from(codePoints, 'binary');
+ },
+ toISO88591(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('binary');
+ },
+ fromHex(hex) {
+ return Buffer.from(hex, 'hex');
+ },
+ toHex(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('hex');
+ },
+ toUTF8(buffer, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(buffer, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ const string = nodeJsByteUtils.toLocalBufferType(buffer).toString('utf8', start, end);
+ if (fatal) {
+ for (let i = 0; i < string.length; i++) {
+ if (string.charCodeAt(i) === 0xfffd) {
+ parseUtf8(buffer, start, end, true);
+ break;
+ }
+ }
+ }
+ return string;
+ },
+ utf8ByteLength(input) {
+ return Buffer.byteLength(input, 'utf8');
+ },
+ encodeUTF8Into(buffer, source, byteOffset) {
+ const latinBytesWritten = tryWriteBasicLatin(buffer, source, byteOffset);
+ if (latinBytesWritten != null) {
+ return latinBytesWritten;
+ }
+ return nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8');
+ },
+ randomBytes: nodejsRandomBytes,
+ swap32(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).swap32();
+ }
+};
+
+function isReactNative() {
+ const { navigator } = globalThis;
+ return typeof navigator === 'object' && navigator.product === 'ReactNative';
+}
+function webMathRandomBytes(byteLength) {
+ if (byteLength < 0) {
+ throw new RangeError(`The argument 'byteLength' is invalid. Received ${byteLength}`);
+ }
+ return webByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+const webRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return (byteLength) => {
+ return crypto.getRandomValues(webByteUtils.allocate(byteLength));
+ };
+ }
+ else {
+ if (isReactNative()) {
+ const { console } = globalThis;
+ console?.warn?.('BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.');
+ }
+ return webMathRandomBytes;
+ }
+})();
+const HEX_DIGIT = /(\d|[a-f])/i;
+const webByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialUint8array) {
+ const stringTag = potentialUint8array?.[Symbol.toStringTag] ??
+ Object.prototype.toString.call(potentialUint8array);
+ if (stringTag === 'Uint8Array') {
+ return potentialUint8array;
+ }
+ if (ArrayBuffer.isView(potentialUint8array)) {
+ return new Uint8Array(potentialUint8array.buffer.slice(potentialUint8array.byteOffset, potentialUint8array.byteOffset + potentialUint8array.byteLength));
+ }
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return new Uint8Array(potentialUint8array);
+ }
+ throw new BSONError(`Cannot make a Uint8Array from passed potentialBuffer.`);
+ },
+ allocate(size) {
+ if (typeof size !== 'number') {
+ throw new TypeError(`The "size" argument must be of type number. Received ${String(size)}`);
+ }
+ return new Uint8Array(size);
+ },
+ allocateUnsafe(size) {
+ return webByteUtils.allocate(size);
+ },
+ compare(uint8Array, otherUint8Array) {
+ if (uint8Array === otherUint8Array)
+ return 0;
+ const len = Math.min(uint8Array.length, otherUint8Array.length);
+ for (let i = 0; i < len; i++) {
+ if (uint8Array[i] < otherUint8Array[i])
+ return -1;
+ if (uint8Array[i] > otherUint8Array[i])
+ return 1;
+ }
+ if (uint8Array.length < otherUint8Array.length)
+ return -1;
+ if (uint8Array.length > otherUint8Array.length)
+ return 1;
+ return 0;
+ },
+ concat(uint8Arrays) {
+ if (uint8Arrays.length === 0)
+ return webByteUtils.allocate(0);
+ let totalLength = 0;
+ for (const uint8Array of uint8Arrays) {
+ totalLength += uint8Array.length;
+ }
+ const result = webByteUtils.allocate(totalLength);
+ let offset = 0;
+ for (const uint8Array of uint8Arrays) {
+ result.set(uint8Array, offset);
+ offset += uint8Array.length;
+ }
+ return result;
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ if (sourceEnd !== undefined && sourceEnd < 0) {
+ throw new RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${sourceEnd}`);
+ }
+ sourceEnd = sourceEnd ?? source.length;
+ if (sourceStart !== undefined && (sourceStart < 0 || sourceStart > sourceEnd)) {
+ throw new RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${sourceEnd}. Received ${sourceStart}`);
+ }
+ sourceStart = sourceStart ?? 0;
+ if (targetStart !== undefined && targetStart < 0) {
+ throw new RangeError(`The value of "targetStart" is out of range. It must be >= 0. Received ${targetStart}`);
+ }
+ targetStart = targetStart ?? 0;
+ const srcSlice = source.subarray(sourceStart, sourceEnd);
+ const maxLen = Math.min(srcSlice.length, target.length - targetStart);
+ if (maxLen <= 0) {
+ return 0;
+ }
+ target.set(srcSlice.subarray(0, maxLen), targetStart);
+ return maxLen;
+ },
+ equals(uint8Array, otherUint8Array) {
+ if (uint8Array.byteLength !== otherUint8Array.byteLength) {
+ return false;
+ }
+ for (let i = 0; i < uint8Array.byteLength; i++) {
+ if (uint8Array[i] !== otherUint8Array[i]) {
+ return false;
+ }
+ }
+ return true;
+ },
+ fromNumberArray(array) {
+ return Uint8Array.from(array);
+ },
+ fromBase64(base64) {
+ return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
+ },
+ fromUTF8(utf8) {
+ return new TextEncoder().encode(utf8);
+ },
+ toBase64(uint8array) {
+ return btoa(webByteUtils.toISO88591(uint8array));
+ },
+ fromISO88591(codePoints) {
+ return Uint8Array.from(codePoints, c => c.charCodeAt(0) & 0xff);
+ },
+ toISO88591(uint8array) {
+ return Array.from(Uint16Array.from(uint8array), b => String.fromCharCode(b)).join('');
+ },
+ fromHex(hex) {
+ const evenLengthHex = hex.length % 2 === 0 ? hex : hex.slice(0, hex.length - 1);
+ const buffer = [];
+ for (let i = 0; i < evenLengthHex.length; i += 2) {
+ const firstDigit = evenLengthHex[i];
+ const secondDigit = evenLengthHex[i + 1];
+ if (!HEX_DIGIT.test(firstDigit)) {
+ break;
+ }
+ if (!HEX_DIGIT.test(secondDigit)) {
+ break;
+ }
+ const hexDigit = Number.parseInt(`${firstDigit}${secondDigit}`, 16);
+ buffer.push(hexDigit);
+ }
+ return Uint8Array.from(buffer);
+ },
+ toHex(uint8array) {
+ return Array.from(uint8array, byte => byte.toString(16).padStart(2, '0')).join('');
+ },
+ toUTF8(uint8array, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(uint8array, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ return parseUtf8(uint8array, start, end, fatal);
+ },
+ utf8ByteLength(input) {
+ return new TextEncoder().encode(input).byteLength;
+ },
+ encodeUTF8Into(uint8array, source, byteOffset) {
+ const bytes = new TextEncoder().encode(source);
+ uint8array.set(bytes, byteOffset);
+ return bytes.byteLength;
+ },
+ randomBytes: webRandomBytes,
+ swap32(buffer) {
+ if (buffer.length % 4 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 32-bits');
+ }
+ for (let i = 0; i < buffer.length; i += 4) {
+ const byte0 = buffer[i];
+ const byte1 = buffer[i + 1];
+ const byte2 = buffer[i + 2];
+ const byte3 = buffer[i + 3];
+ buffer[i] = byte3;
+ buffer[i + 1] = byte2;
+ buffer[i + 2] = byte1;
+ buffer[i + 3] = byte0;
+ }
+ return buffer;
+ }
+};
+
+const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true;
+const ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
+
+const bsonType = Symbol.for('@@mdb.bson.type');
+class BSONValue {
+ get [bsonType]() {
+ return this._bsontype;
+ }
+ get [BSON_VERSION_SYMBOL]() {
+ return BSON_MAJOR_VERSION;
+ }
+ [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {
+ return this.inspect(depth, options, inspect);
+ }
+}
+
+const FLOAT = new Float64Array(1);
+const FLOAT_BYTES = new Uint8Array(FLOAT.buffer, 0, 8);
+FLOAT[0] = -1;
+const isBigEndian = FLOAT_BYTES[7] === 0;
+const NumberUtils = {
+ isBigEndian,
+ getNonnegativeInt32LE(source, offset) {
+ if (source[offset + 3] > 127) {
+ throw new RangeError(`Size cannot be negative at offset: ${offset}`);
+ }
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getInt32LE(source, offset) {
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getUint32LE(source, offset) {
+ return (source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ },
+ getUint32BE(source, offset) {
+ return (source[offset + 3] +
+ source[offset + 2] * 256 +
+ source[offset + 1] * 65536 +
+ source[offset] * 16777216);
+ },
+ getBigInt64LE(source, offset) {
+ const hi = BigInt(source[offset + 4] +
+ source[offset + 5] * 256 +
+ source[offset + 6] * 65536 +
+ (source[offset + 7] << 24));
+ const lo = BigInt(source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ return (hi << 32n) + lo;
+ },
+ getFloat64LE: isBigEndian
+ ? (source, offset) => {
+ FLOAT_BYTES[7] = source[offset];
+ FLOAT_BYTES[6] = source[offset + 1];
+ FLOAT_BYTES[5] = source[offset + 2];
+ FLOAT_BYTES[4] = source[offset + 3];
+ FLOAT_BYTES[3] = source[offset + 4];
+ FLOAT_BYTES[2] = source[offset + 5];
+ FLOAT_BYTES[1] = source[offset + 6];
+ FLOAT_BYTES[0] = source[offset + 7];
+ return FLOAT[0];
+ }
+ : (source, offset) => {
+ FLOAT_BYTES[0] = source[offset];
+ FLOAT_BYTES[1] = source[offset + 1];
+ FLOAT_BYTES[2] = source[offset + 2];
+ FLOAT_BYTES[3] = source[offset + 3];
+ FLOAT_BYTES[4] = source[offset + 4];
+ FLOAT_BYTES[5] = source[offset + 5];
+ FLOAT_BYTES[6] = source[offset + 6];
+ FLOAT_BYTES[7] = source[offset + 7];
+ return FLOAT[0];
+ },
+ setInt32BE(destination, offset, value) {
+ destination[offset + 3] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset] = value;
+ return 4;
+ },
+ setInt32LE(destination, offset, value) {
+ destination[offset] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 3] = value;
+ return 4;
+ },
+ setBigInt64LE(destination, offset, value) {
+ const mask32bits = 0xffffffffn;
+ let lo = Number(value & mask32bits);
+ destination[offset] = lo;
+ lo >>= 8;
+ destination[offset + 1] = lo;
+ lo >>= 8;
+ destination[offset + 2] = lo;
+ lo >>= 8;
+ destination[offset + 3] = lo;
+ let hi = Number((value >> 32n) & mask32bits);
+ destination[offset + 4] = hi;
+ hi >>= 8;
+ destination[offset + 5] = hi;
+ hi >>= 8;
+ destination[offset + 6] = hi;
+ hi >>= 8;
+ destination[offset + 7] = hi;
+ return 8;
+ },
+ setFloat64LE: isBigEndian
+ ? (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[7];
+ destination[offset + 1] = FLOAT_BYTES[6];
+ destination[offset + 2] = FLOAT_BYTES[5];
+ destination[offset + 3] = FLOAT_BYTES[4];
+ destination[offset + 4] = FLOAT_BYTES[3];
+ destination[offset + 5] = FLOAT_BYTES[2];
+ destination[offset + 6] = FLOAT_BYTES[1];
+ destination[offset + 7] = FLOAT_BYTES[0];
+ return 8;
+ }
+ : (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[0];
+ destination[offset + 1] = FLOAT_BYTES[1];
+ destination[offset + 2] = FLOAT_BYTES[2];
+ destination[offset + 3] = FLOAT_BYTES[3];
+ destination[offset + 4] = FLOAT_BYTES[4];
+ destination[offset + 5] = FLOAT_BYTES[5];
+ destination[offset + 6] = FLOAT_BYTES[6];
+ destination[offset + 7] = FLOAT_BYTES[7];
+ return 8;
+ }
+};
+
+class Binary extends BSONValue {
+ get _bsontype() {
+ return 'Binary';
+ }
+ static BSON_BINARY_SUBTYPE_DEFAULT = 0;
+ static BUFFER_SIZE = 256;
+ static SUBTYPE_DEFAULT = 0;
+ static SUBTYPE_FUNCTION = 1;
+ static SUBTYPE_BYTE_ARRAY = 2;
+ static SUBTYPE_UUID_OLD = 3;
+ static SUBTYPE_UUID = 4;
+ static SUBTYPE_MD5 = 5;
+ static SUBTYPE_ENCRYPTED = 6;
+ static SUBTYPE_COLUMN = 7;
+ static SUBTYPE_SENSITIVE = 8;
+ static SUBTYPE_VECTOR = 9;
+ static SUBTYPE_USER_DEFINED = 128;
+ static VECTOR_TYPE = Object.freeze({
+ Int8: 0x03,
+ Float32: 0x27,
+ PackedBit: 0x10
+ });
+ buffer;
+ sub_type;
+ position;
+ constructor(buffer, subType) {
+ super();
+ if (!(buffer == null) &&
+ typeof buffer === 'string' &&
+ !ArrayBuffer.isView(buffer) &&
+ !isAnyArrayBuffer(buffer) &&
+ !Array.isArray(buffer)) {
+ throw new BSONError('Binary can only be constructed from Uint8Array or number[]');
+ }
+ this.sub_type = subType ?? Binary.BSON_BINARY_SUBTYPE_DEFAULT;
+ if (buffer == null) {
+ this.buffer = ByteUtils.allocate(Binary.BUFFER_SIZE);
+ this.position = 0;
+ }
+ else {
+ this.buffer = Array.isArray(buffer)
+ ? ByteUtils.fromNumberArray(buffer)
+ : ByteUtils.toLocalBufferType(buffer);
+ this.position = this.buffer.byteLength;
+ }
+ }
+ put(byteValue) {
+ if (typeof byteValue === 'string' && byteValue.length !== 1) {
+ throw new BSONError('only accepts single character String');
+ }
+ else if (typeof byteValue !== 'number' && byteValue.length !== 1)
+ throw new BSONError('only accepts single character Uint8Array or Array');
+ let decodedByte;
+ if (typeof byteValue === 'string') {
+ decodedByte = byteValue.charCodeAt(0);
+ }
+ else if (typeof byteValue === 'number') {
+ decodedByte = byteValue;
+ }
+ else {
+ decodedByte = byteValue[0];
+ }
+ if (decodedByte < 0 || decodedByte > 255) {
+ throw new BSONError('only accepts number in a valid unsigned byte range 0-255');
+ }
+ if (this.buffer.byteLength > this.position) {
+ this.buffer[this.position++] = decodedByte;
+ }
+ else {
+ const newSpace = ByteUtils.allocate(Binary.BUFFER_SIZE + this.buffer.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ this.buffer[this.position++] = decodedByte;
+ }
+ }
+ write(sequence, offset) {
+ offset = typeof offset === 'number' ? offset : this.position;
+ if (this.buffer.byteLength < offset + sequence.length) {
+ const newSpace = ByteUtils.allocate(this.buffer.byteLength + sequence.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ }
+ if (ArrayBuffer.isView(sequence)) {
+ this.buffer.set(ByteUtils.toLocalBufferType(sequence), offset);
+ this.position =
+ offset + sequence.byteLength > this.position ? offset + sequence.length : this.position;
+ }
+ else if (typeof sequence === 'string') {
+ throw new BSONError('input cannot be string');
+ }
+ }
+ read(position, length) {
+ length = length && length > 0 ? length : this.position;
+ const end = position + length;
+ return this.buffer.subarray(position, end > this.position ? this.position : end);
+ }
+ value() {
+ return this.buffer.length === this.position
+ ? this.buffer
+ : this.buffer.subarray(0, this.position);
+ }
+ length() {
+ return this.position;
+ }
+ toJSON() {
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.buffer.subarray(0, this.position));
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ if (encoding === 'utf8' || encoding === 'utf-8')
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (this.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(this);
+ }
+ const base64String = ByteUtils.toBase64(this.buffer);
+ const subType = Number(this.sub_type).toString(16);
+ if (options.legacy) {
+ return {
+ $binary: base64String,
+ $type: subType.length === 1 ? '0' + subType : subType
+ };
+ }
+ return {
+ $binary: {
+ base64: base64String,
+ subType: subType.length === 1 ? '0' + subType : subType
+ }
+ };
+ }
+ toUUID() {
+ if (this.sub_type === Binary.SUBTYPE_UUID) {
+ return new UUID(this.buffer.subarray(0, this.position));
+ }
+ throw new BSONError(`Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${Binary.SUBTYPE_UUID}" is currently supported.`);
+ }
+ static createFromHexString(hex, subType) {
+ return new Binary(ByteUtils.fromHex(hex), subType);
+ }
+ static createFromBase64(base64, subType) {
+ return new Binary(ByteUtils.fromBase64(base64), subType);
+ }
+ static fromExtendedJSON(doc, options) {
+ options = options || {};
+ let data;
+ let type;
+ if ('$binary' in doc) {
+ if (options.legacy && typeof doc.$binary === 'string' && '$type' in doc) {
+ type = doc.$type ? parseInt(doc.$type, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary);
+ }
+ else {
+ if (typeof doc.$binary !== 'string') {
+ type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary.base64);
+ }
+ }
+ }
+ else if ('$uuid' in doc) {
+ type = 4;
+ data = UUID.bytesFromString(doc.$uuid);
+ }
+ if (!data) {
+ throw new BSONError(`Unexpected Binary Extended JSON format ${JSON.stringify(doc)}`);
+ }
+ return type === BSON_BINARY_SUBTYPE_UUID_NEW ? new UUID(data) : new Binary(data, type);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const base64 = ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ const base64Arg = inspect(base64, options);
+ const subTypeArg = inspect(this.sub_type, options);
+ return `Binary.createFromBase64(${base64Arg}, ${subTypeArg})`;
+ }
+ toInt8Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Int8) {
+ throw new BSONError('Binary datatype field is not Int8');
+ }
+ validateBinaryVector(this);
+ return new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toFloat32Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Float32) {
+ throw new BSONError('Binary datatype field is not Float32');
+ }
+ validateBinaryVector(this);
+ const floatBytes = new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(floatBytes);
+ return new Float32Array(floatBytes.buffer);
+ }
+ toPackedBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ return new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ const byteCount = this.length() - 2;
+ const bitCount = byteCount * 8 - this.buffer[1];
+ const bits = new Int8Array(bitCount);
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = (bitOffset / 8) | 0;
+ const byte = this.buffer[byteOffset + 2];
+ const shift = 7 - (bitOffset % 8);
+ const bit = (byte >> shift) & 1;
+ bits[bitOffset] = bit;
+ }
+ return bits;
+ }
+ static fromInt8Array(array) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.Int8;
+ buffer[1] = 0;
+ const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ buffer.set(intBytes, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromFloat32Array(array) {
+ const binaryBytes = ByteUtils.allocate(array.byteLength + 2);
+ binaryBytes[0] = Binary.VECTOR_TYPE.Float32;
+ binaryBytes[1] = 0;
+ const floatBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ binaryBytes.set(floatBytes, 2);
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(new Uint8Array(binaryBytes.buffer, 2));
+ const bin = new this(binaryBytes, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromPackedBits(array, padding = 0) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.PackedBit;
+ buffer[1] = padding;
+ buffer.set(array, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromBits(bits) {
+ const byteLength = (bits.length + 7) >>> 3;
+ const bytes = new Uint8Array(byteLength + 2);
+ bytes[0] = Binary.VECTOR_TYPE.PackedBit;
+ const remainder = bits.length % 8;
+ bytes[1] = remainder === 0 ? 0 : 8 - remainder;
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = bitOffset >>> 3;
+ const bit = bits[bitOffset];
+ if (bit !== 0 && bit !== 1) {
+ throw new BSONError(`Invalid bit value at ${bitOffset}: must be 0 or 1, found ${bits[bitOffset]}`);
+ }
+ if (bit === 0)
+ continue;
+ const shift = 7 - (bitOffset % 8);
+ bytes[byteOffset + 2] |= bit << shift;
+ }
+ return new this(bytes, Binary.SUBTYPE_VECTOR);
+ }
+}
+function validateBinaryVector(vector) {
+ if (vector.sub_type !== Binary.SUBTYPE_VECTOR)
+ return;
+ const size = vector.position;
+ const datatype = vector.buffer[0];
+ const padding = vector.buffer[1];
+ if ((datatype === Binary.VECTOR_TYPE.Float32 || datatype === Binary.VECTOR_TYPE.Int8) &&
+ padding !== 0) {
+ throw new BSONError('Invalid Vector: padding must be zero for int8 and float32 vectors');
+ }
+ if (datatype === Binary.VECTOR_TYPE.Float32) {
+ if (size !== 0 && size - 2 !== 0 && (size - 2) % 4 !== 0) {
+ throw new BSONError('Invalid Vector: Float32 vector must contain a multiple of 4 bytes');
+ }
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding !== 0 && size === 2) {
+ throw new BSONError('Invalid Vector: padding must be zero for packed bit vectors that are empty');
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding > 7) {
+ throw new BSONError(`Invalid Vector: padding must be a value between 0 and 7. found: ${padding}`);
+ }
+}
+const UUID_BYTE_LENGTH = 16;
+const UUID_WITHOUT_DASHES = /^[0-9A-F]{32}$/i;
+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;
+class UUID extends Binary {
+ constructor(input) {
+ let bytes;
+ if (input == null) {
+ bytes = UUID.generate();
+ }
+ else if (input instanceof UUID) {
+ bytes = ByteUtils.toLocalBufferType(new Uint8Array(input.buffer));
+ }
+ else if (ArrayBuffer.isView(input) && input.byteLength === UUID_BYTE_LENGTH) {
+ bytes = ByteUtils.toLocalBufferType(input);
+ }
+ else if (typeof input === 'string') {
+ bytes = UUID.bytesFromString(input);
+ }
+ else {
+ 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).');
+ }
+ super(bytes, BSON_BINARY_SUBTYPE_UUID_NEW);
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ }
+ toHexString(includeDashes = true) {
+ if (includeDashes) {
+ return [
+ ByteUtils.toHex(this.buffer.subarray(0, 4)),
+ ByteUtils.toHex(this.buffer.subarray(4, 6)),
+ ByteUtils.toHex(this.buffer.subarray(6, 8)),
+ ByteUtils.toHex(this.buffer.subarray(8, 10)),
+ ByteUtils.toHex(this.buffer.subarray(10, 16))
+ ].join('-');
+ }
+ return ByteUtils.toHex(this.buffer);
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.id);
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ equals(otherId) {
+ if (!otherId) {
+ return false;
+ }
+ if (otherId instanceof UUID) {
+ return ByteUtils.equals(otherId.id, this.id);
+ }
+ try {
+ return ByteUtils.equals(new UUID(otherId).id, this.id);
+ }
+ catch {
+ return false;
+ }
+ }
+ toBinary() {
+ return new Binary(this.id, Binary.SUBTYPE_UUID);
+ }
+ static generate() {
+ const bytes = ByteUtils.randomBytes(UUID_BYTE_LENGTH);
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
+ return bytes;
+ }
+ static isValid(input) {
+ if (!input) {
+ return false;
+ }
+ if (typeof input === 'string') {
+ return UUID.isValidUUIDString(input);
+ }
+ if (isUint8Array(input)) {
+ return input.byteLength === UUID_BYTE_LENGTH;
+ }
+ return (input._bsontype === 'Binary' &&
+ input.sub_type === this.SUBTYPE_UUID &&
+ input.buffer.byteLength === 16);
+ }
+ static createFromHexString(hexString) {
+ const buffer = UUID.bytesFromString(hexString);
+ return new UUID(buffer);
+ }
+ static createFromBase64(base64) {
+ return new UUID(ByteUtils.fromBase64(base64));
+ }
+ static bytesFromString(representation) {
+ if (!UUID.isValidUUIDString(representation)) {
+ throw new BSONError('UUID string representation must be 32 hex digits or canonical hyphenated representation');
+ }
+ return ByteUtils.fromHex(representation.replace(/-/g, ''));
+ }
+ static isValidUUIDString(representation) {
+ return UUID_WITHOUT_DASHES.test(representation) || UUID_WITH_DASHES.test(representation);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new UUID(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+class Code extends BSONValue {
+ get _bsontype() {
+ return 'Code';
+ }
+ code;
+ scope;
+ constructor(code, scope) {
+ super();
+ this.code = code.toString();
+ this.scope = scope ?? null;
+ }
+ toJSON() {
+ if (this.scope != null) {
+ return { code: this.code, scope: this.scope };
+ }
+ return { code: this.code };
+ }
+ toExtendedJSON() {
+ if (this.scope) {
+ return { $code: this.code, $scope: this.scope };
+ }
+ return { $code: this.code };
+ }
+ static fromExtendedJSON(doc) {
+ return new Code(doc.$code, doc.$scope);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ let parametersString = inspect(this.code, options);
+ const multiLineFn = parametersString.includes('\n');
+ if (this.scope != null) {
+ parametersString += `,${multiLineFn ? '\n' : ' '}${inspect(this.scope, options)}`;
+ }
+ const endingNewline = multiLineFn && this.scope === null;
+ return `new Code(${multiLineFn ? '\n' : ''}${parametersString}${endingNewline ? '\n' : ''})`;
+ }
+}
+
+function isDBRefLike(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '$id' in value &&
+ value.$id != null &&
+ '$ref' in value &&
+ typeof value.$ref === 'string' &&
+ (!('$db' in value) || ('$db' in value && typeof value.$db === 'string')));
+}
+class DBRef extends BSONValue {
+ get _bsontype() {
+ return 'DBRef';
+ }
+ collection;
+ oid;
+ db;
+ fields;
+ constructor(collection, oid, db, fields) {
+ super();
+ const parts = collection.split('.');
+ if (parts.length === 2) {
+ db = parts.shift();
+ collection = parts.shift();
+ }
+ this.collection = collection;
+ this.oid = oid;
+ this.db = db;
+ this.fields = fields || {};
+ }
+ get namespace() {
+ return this.collection;
+ }
+ set namespace(value) {
+ this.collection = value;
+ }
+ toJSON() {
+ const o = Object.assign({
+ $ref: this.collection,
+ $id: this.oid
+ }, this.fields);
+ if (this.db != null)
+ o.$db = this.db;
+ return o;
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ let o = {
+ $ref: this.collection,
+ $id: this.oid
+ };
+ if (options.legacy) {
+ return o;
+ }
+ if (this.db)
+ o.$db = this.db;
+ o = Object.assign(o, this.fields);
+ return o;
+ }
+ static fromExtendedJSON(doc) {
+ const copy = Object.assign({}, doc);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(doc.$ref, doc.$id, doc.$db, copy);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const args = [
+ inspect(this.namespace, options),
+ inspect(this.oid, options),
+ ...(this.db ? [inspect(this.db, options)] : []),
+ ...(Object.keys(this.fields).length > 0 ? [inspect(this.fields, options)] : [])
+ ];
+ args[1] = inspect === defaultInspect ? `new ObjectId(${args[1]})` : args[1];
+ return `new DBRef(${args.join(', ')})`;
+ }
+}
+
+function removeLeadingZerosAndExplicitPlus(str) {
+ if (str === '') {
+ return str;
+ }
+ let startIndex = 0;
+ const isNegative = str[startIndex] === '-';
+ const isExplicitlyPositive = str[startIndex] === '+';
+ if (isExplicitlyPositive || isNegative) {
+ startIndex += 1;
+ }
+ let foundInsignificantZero = false;
+ for (; startIndex < str.length && str[startIndex] === '0'; ++startIndex) {
+ foundInsignificantZero = true;
+ }
+ if (!foundInsignificantZero) {
+ return isExplicitlyPositive ? str.slice(1) : str;
+ }
+ return `${isNegative ? '-' : ''}${str.length === startIndex ? '0' : str.slice(startIndex)}`;
+}
+function validateStringCharacters(str, radix) {
+ radix = radix ?? 10;
+ const validCharacters = '0123456789abcdefghijklmnopqrstuvwxyz'.slice(0, radix);
+ const regex = new RegExp(`[^-+${validCharacters}]`, 'i');
+ return regex.test(str) ? false : str;
+}
+
+let wasm = undefined;
+try {
+ 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;
+}
+catch {
+}
+const TWO_PWR_16_DBL = 1 << 16;
+const TWO_PWR_24_DBL = 1 << 24;
+const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+const TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+const TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+const INT_CACHE = {};
+const UINT_CACHE = {};
+const MAX_INT64_STRING_LENGTH = 20;
+const DECIMAL_REG_EX = /^(\+?0|(\+|-)?[1-9][0-9]*)$/;
+class Long extends BSONValue {
+ get _bsontype() {
+ return 'Long';
+ }
+ get __isLong__() {
+ return true;
+ }
+ high;
+ low;
+ unsigned;
+ constructor(lowOrValue = 0, highOrUnsigned, unsigned) {
+ super();
+ const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
+ const high = typeof highOrUnsigned === 'number' ? highOrUnsigned : 0;
+ const res = typeof lowOrValue === 'string'
+ ? Long.fromString(lowOrValue, unsignedBool)
+ : typeof lowOrValue === 'bigint'
+ ? Long.fromBigInt(lowOrValue, unsignedBool)
+ : { low: lowOrValue | 0, high: high | 0, unsigned: unsignedBool };
+ this.low = res.low;
+ this.high = res.high;
+ this.unsigned = res.unsigned;
+ }
+ static TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
+ static MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true);
+ static ZERO = Long.fromInt(0);
+ static UZERO = Long.fromInt(0, true);
+ static ONE = Long.fromInt(1);
+ static UONE = Long.fromInt(1, true);
+ static NEG_ONE = Long.fromInt(-1);
+ static MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
+ static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false);
+ static fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+ }
+ static fromInt(value, unsigned) {
+ let obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if ((cache = 0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, (value | 0) < 0 ? -1 : 0, true);
+ if (cache)
+ UINT_CACHE[value] = obj;
+ return obj;
+ }
+ else {
+ value |= 0;
+ if ((cache = -128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache)
+ INT_CACHE[value] = obj;
+ return obj;
+ }
+ }
+ static fromNumber(value, unsigned) {
+ if (isNaN(value))
+ return unsigned ? Long.UZERO : Long.ZERO;
+ if (unsigned) {
+ if (value < 0)
+ return Long.UZERO;
+ if (value >= TWO_PWR_64_DBL)
+ return Long.MAX_UNSIGNED_VALUE;
+ }
+ else {
+ if (value <= -TWO_PWR_63_DBL)
+ return Long.MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL)
+ return Long.MAX_VALUE;
+ }
+ if (value < 0)
+ return Long.fromNumber(-value, unsigned).neg();
+ return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
+ }
+ static fromBigInt(value, unsigned) {
+ const FROM_BIGINT_BIT_MASK = 0xffffffffn;
+ const FROM_BIGINT_BIT_SHIFT = 32n;
+ return new Long(Number(value & FROM_BIGINT_BIT_MASK), Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK), unsigned);
+ }
+ static _fromString(str, unsigned, radix) {
+ if (str.length === 0)
+ throw new BSONError('empty string');
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ let p;
+ if ((p = str.indexOf('-')) > 0)
+ throw new BSONError('interior hyphen');
+ else if (p === 0) {
+ return Long._fromString(str.substring(1), unsigned, radix).neg();
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 8));
+ let result = Long.ZERO;
+ for (let i = 0; i < str.length; i += 8) {
+ const size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ const power = Long.fromNumber(Math.pow(radix, size));
+ result = result.mul(power).add(Long.fromNumber(value));
+ }
+ else {
+ result = result.mul(radixToPower);
+ result = result.add(Long.fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+ }
+ static fromStringStrict(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str.trim() !== str) {
+ throw new BSONError(`Input: '${str}' contains leading and/or trailing whitespace`);
+ }
+ if (!validateStringCharacters(str, radix)) {
+ throw new BSONError(`Input: '${str}' contains invalid characters for radix: ${radix}`);
+ }
+ const cleanedStr = removeLeadingZerosAndExplicitPlus(str);
+ const result = Long._fromString(cleanedStr, unsigned, radix);
+ if (result.toString(radix).toLowerCase() !== cleanedStr.toLowerCase()) {
+ throw new BSONError(`Input: ${str} is not representable as ${result.unsigned ? 'an unsigned' : 'a signed'} 64-bit Long ${radix != null ? `with radix: ${radix}` : ''}`);
+ }
+ return result;
+ }
+ static fromString(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str === 'NaN' && radix < 24) {
+ return Long.ZERO;
+ }
+ else if ((str === 'Infinity' || str === '+Infinity' || str === '-Infinity') && radix < 35) {
+ return Long.ZERO;
+ }
+ return Long._fromString(str, unsigned, radix);
+ }
+ static fromBytes(bytes, unsigned, le) {
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
+ }
+ static fromBytesLE(bytes, unsigned) {
+ 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);
+ }
+ static fromBytesBE(bytes, unsigned) {
+ 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);
+ }
+ static isLong(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '__isLong__' in value &&
+ value.__isLong__ === true);
+ }
+ static fromValue(val, unsigned) {
+ if (typeof val === 'number')
+ return Long.fromNumber(val, unsigned);
+ if (typeof val === 'string')
+ return Long.fromString(val, unsigned);
+ return Long.fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
+ }
+ add(addend) {
+ if (!Long.isLong(addend))
+ addend = Long.fromValue(addend);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = addend.high >>> 16;
+ const b32 = addend.high & 0xffff;
+ const b16 = addend.low >>> 16;
+ const b00 = addend.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 + b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ and(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+ }
+ compare(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.eq(other))
+ return 0;
+ const thisNeg = this.isNegative(), otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg)
+ return -1;
+ if (!thisNeg && otherNeg)
+ return 1;
+ if (!this.unsigned)
+ return this.sub(other).isNegative() ? -1 : 1;
+ return other.high >>> 0 > this.high >>> 0 ||
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
+ ? -1
+ : 1;
+ }
+ comp(other) {
+ return this.compare(other);
+ }
+ divide(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (divisor.isZero())
+ throw new BSONError('division by zero');
+ if (wasm) {
+ if (!this.unsigned &&
+ this.high === -2147483648 &&
+ divisor.low === -1 &&
+ divisor.high === -1) {
+ return this;
+ }
+ const low = (this.unsigned ? wasm.div_u : wasm.div_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (this.isZero())
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ let approx, rem, res;
+ if (!this.unsigned) {
+ if (this.eq(Long.MIN_VALUE)) {
+ if (divisor.eq(Long.ONE) || divisor.eq(Long.NEG_ONE))
+ return Long.MIN_VALUE;
+ else if (divisor.eq(Long.MIN_VALUE))
+ return Long.ONE;
+ else {
+ const halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(Long.ZERO)) {
+ return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
+ }
+ else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ }
+ else if (divisor.eq(Long.MIN_VALUE))
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative())
+ return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ }
+ else if (divisor.isNegative())
+ return this.div(divisor.neg()).neg();
+ res = Long.ZERO;
+ }
+ else {
+ if (!divisor.unsigned)
+ divisor = divisor.toUnsigned();
+ if (divisor.gt(this))
+ return Long.UZERO;
+ if (divisor.gt(this.shru(1)))
+ return Long.UONE;
+ res = Long.UZERO;
+ }
+ rem = this;
+ while (rem.gte(divisor)) {
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+ const log2 = Math.ceil(Math.log(approx) / Math.LN2);
+ const delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);
+ let approxRes = Long.fromNumber(approx);
+ let approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = Long.fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+ if (approxRes.isZero())
+ approxRes = Long.ONE;
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+ }
+ div(divisor) {
+ return this.divide(divisor);
+ }
+ equals(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
+ return false;
+ return this.high === other.high && this.low === other.low;
+ }
+ eq(other) {
+ return this.equals(other);
+ }
+ getHighBits() {
+ return this.high;
+ }
+ getHighBitsUnsigned() {
+ return this.high >>> 0;
+ }
+ getLowBits() {
+ return this.low;
+ }
+ getLowBitsUnsigned() {
+ return this.low >>> 0;
+ }
+ getNumBitsAbs() {
+ if (this.isNegative()) {
+ return this.eq(Long.MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ }
+ const val = this.high !== 0 ? this.high : this.low;
+ let bit;
+ for (bit = 31; bit > 0; bit--)
+ if ((val & (1 << bit)) !== 0)
+ break;
+ return this.high !== 0 ? bit + 33 : bit + 1;
+ }
+ greaterThan(other) {
+ return this.comp(other) > 0;
+ }
+ gt(other) {
+ return this.greaterThan(other);
+ }
+ greaterThanOrEqual(other) {
+ return this.comp(other) >= 0;
+ }
+ gte(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ ge(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ isEven() {
+ return (this.low & 1) === 0;
+ }
+ isNegative() {
+ return !this.unsigned && this.high < 0;
+ }
+ isOdd() {
+ return (this.low & 1) === 1;
+ }
+ isPositive() {
+ return this.unsigned || this.high >= 0;
+ }
+ isZero() {
+ return this.high === 0 && this.low === 0;
+ }
+ lessThan(other) {
+ return this.comp(other) < 0;
+ }
+ lt(other) {
+ return this.lessThan(other);
+ }
+ lessThanOrEqual(other) {
+ return this.comp(other) <= 0;
+ }
+ lte(other) {
+ return this.lessThanOrEqual(other);
+ }
+ modulo(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (wasm) {
+ const low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ return this.sub(this.div(divisor).mul(divisor));
+ }
+ mod(divisor) {
+ return this.modulo(divisor);
+ }
+ rem(divisor) {
+ return this.modulo(divisor);
+ }
+ multiply(multiplier) {
+ if (this.isZero())
+ return Long.ZERO;
+ if (!Long.isLong(multiplier))
+ multiplier = Long.fromValue(multiplier);
+ if (wasm) {
+ const low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (multiplier.isZero())
+ return Long.ZERO;
+ if (this.eq(Long.MIN_VALUE))
+ return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (multiplier.eq(Long.MIN_VALUE))
+ return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (this.isNegative()) {
+ if (multiplier.isNegative())
+ return this.neg().mul(multiplier.neg());
+ else
+ return this.neg().mul(multiplier).neg();
+ }
+ else if (multiplier.isNegative())
+ return this.mul(multiplier.neg()).neg();
+ if (this.lt(Long.TWO_PWR_24) && multiplier.lt(Long.TWO_PWR_24))
+ return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = multiplier.high >>> 16;
+ const b32 = multiplier.high & 0xffff;
+ const b16 = multiplier.low >>> 16;
+ const b00 = multiplier.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ mul(multiplier) {
+ return this.multiply(multiplier);
+ }
+ negate() {
+ if (!this.unsigned && this.eq(Long.MIN_VALUE))
+ return Long.MIN_VALUE;
+ return this.not().add(Long.ONE);
+ }
+ neg() {
+ return this.negate();
+ }
+ not() {
+ return Long.fromBits(~this.low, ~this.high, this.unsigned);
+ }
+ notEquals(other) {
+ return !this.equals(other);
+ }
+ neq(other) {
+ return this.notEquals(other);
+ }
+ ne(other) {
+ return this.notEquals(other);
+ }
+ or(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+ }
+ shiftLeft(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
+ else
+ return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
+ }
+ shl(numBits) {
+ return this.shiftLeft(numBits);
+ }
+ shiftRight(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
+ else
+ return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
+ }
+ shr(numBits) {
+ return this.shiftRight(numBits);
+ }
+ shiftRightUnsigned(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ numBits &= 63;
+ if (numBits === 0)
+ return this;
+ else {
+ const high = this.high;
+ if (numBits < 32) {
+ const low = this.low;
+ return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
+ }
+ else if (numBits === 32)
+ return Long.fromBits(high, 0, this.unsigned);
+ else
+ return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
+ }
+ }
+ shr_u(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ shru(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ subtract(subtrahend) {
+ if (!Long.isLong(subtrahend))
+ subtrahend = Long.fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+ }
+ sub(subtrahend) {
+ return this.subtract(subtrahend);
+ }
+ toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+ }
+ toNumber() {
+ if (this.unsigned)
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+ }
+ toBigInt() {
+ return BigInt(this.toString());
+ }
+ toBytes(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+ }
+ toBytesLE() {
+ const hi = this.high, lo = this.low;
+ return [
+ lo & 0xff,
+ (lo >>> 8) & 0xff,
+ (lo >>> 16) & 0xff,
+ lo >>> 24,
+ hi & 0xff,
+ (hi >>> 8) & 0xff,
+ (hi >>> 16) & 0xff,
+ hi >>> 24
+ ];
+ }
+ toBytesBE() {
+ const hi = this.high, lo = this.low;
+ return [
+ hi >>> 24,
+ (hi >>> 16) & 0xff,
+ (hi >>> 8) & 0xff,
+ hi & 0xff,
+ lo >>> 24,
+ (lo >>> 16) & 0xff,
+ (lo >>> 8) & 0xff,
+ lo & 0xff
+ ];
+ }
+ toSigned() {
+ if (!this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, false);
+ }
+ toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ if (this.isZero())
+ return '0';
+ if (this.isNegative()) {
+ if (this.eq(Long.MIN_VALUE)) {
+ const radixLong = Long.fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ }
+ else
+ return '-' + this.neg().toString(radix);
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
+ let rem = this;
+ let result = '';
+ while (true) {
+ const remDiv = rem.div(radixToPower);
+ const intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0;
+ let digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero()) {
+ return digits + result;
+ }
+ else {
+ while (digits.length < 6)
+ digits = '0' + digits;
+ result = '' + digits + result;
+ }
+ }
+ }
+ toUnsigned() {
+ if (this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, true);
+ }
+ xor(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+ }
+ eqz() {
+ return this.isZero();
+ }
+ le(other) {
+ return this.lessThanOrEqual(other);
+ }
+ toExtendedJSON(options) {
+ if (options && options.relaxed)
+ return this.toNumber();
+ return { $numberLong: this.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ const { useBigInt64 = false, relaxed = true } = { ...options };
+ if (doc.$numberLong.length > MAX_INT64_STRING_LENGTH) {
+ throw new BSONError('$numberLong string is too long');
+ }
+ if (!DECIMAL_REG_EX.test(doc.$numberLong)) {
+ throw new BSONError(`$numberLong string "${doc.$numberLong}" is in an invalid format`);
+ }
+ if (useBigInt64) {
+ const bigIntResult = BigInt(doc.$numberLong);
+ return BigInt.asIntN(64, bigIntResult);
+ }
+ const longResult = Long.fromString(doc.$numberLong);
+ if (relaxed) {
+ return longResult.toNumber();
+ }
+ return longResult;
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const longVal = inspect(this.toString(), options);
+ const unsignedVal = this.unsigned ? `, ${inspect(this.unsigned, options)}` : '';
+ return `new Long(${longVal}${unsignedVal})`;
+ }
+}
+
+const PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/;
+const PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i;
+const PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i;
+const EXPONENT_MAX = 6111;
+const EXPONENT_MIN = -6176;
+const EXPONENT_BIAS = 6176;
+const MAX_DIGITS = 34;
+const NAN_BUFFER = ByteUtils.fromNumberArray([
+ 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_NEGATIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_POSITIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const EXPONENT_REGEX = /^([-+])?(\d+)?$/;
+const COMBINATION_MASK = 0x1f;
+const EXPONENT_MASK = 0x3fff;
+const COMBINATION_INFINITY = 30;
+const COMBINATION_NAN = 31;
+function isDigit(value) {
+ return !isNaN(parseInt(value, 10));
+}
+function divideu128(value) {
+ const DIVISOR = Long.fromNumber(1000 * 1000 * 1000);
+ let _rem = Long.fromNumber(0);
+ if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) {
+ return { quotient: value, rem: _rem };
+ }
+ for (let i = 0; i <= 3; i++) {
+ _rem = _rem.shiftLeft(32);
+ _rem = _rem.add(new Long(value.parts[i], 0));
+ value.parts[i] = _rem.div(DIVISOR).low;
+ _rem = _rem.modulo(DIVISOR);
+ }
+ return { quotient: value, rem: _rem };
+}
+function multiply64x2(left, right) {
+ if (!left && !right) {
+ return { high: Long.fromNumber(0), low: Long.fromNumber(0) };
+ }
+ const leftHigh = left.shiftRightUnsigned(32);
+ const leftLow = new Long(left.getLowBits(), 0);
+ const rightHigh = right.shiftRightUnsigned(32);
+ const rightLow = new Long(right.getLowBits(), 0);
+ let productHigh = leftHigh.multiply(rightHigh);
+ let productMid = leftHigh.multiply(rightLow);
+ const productMid2 = leftLow.multiply(rightHigh);
+ let productLow = leftLow.multiply(rightLow);
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productMid = new Long(productMid.getLowBits(), 0)
+ .add(productMid2)
+ .add(productLow.shiftRightUnsigned(32));
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));
+ return { high: productHigh, low: productLow };
+}
+function lessThan(left, right) {
+ const uhleft = left.high >>> 0;
+ const uhright = right.high >>> 0;
+ if (uhleft < uhright) {
+ return true;
+ }
+ else if (uhleft === uhright) {
+ const ulleft = left.low >>> 0;
+ const ulright = right.low >>> 0;
+ if (ulleft < ulright)
+ return true;
+ }
+ return false;
+}
+function invalidErr(string, message) {
+ throw new BSONError(`"${string}" is not a valid Decimal128 string - ${message}`);
+}
+class Decimal128 extends BSONValue {
+ get _bsontype() {
+ return 'Decimal128';
+ }
+ bytes;
+ constructor(bytes) {
+ super();
+ if (typeof bytes === 'string') {
+ this.bytes = Decimal128.fromString(bytes).bytes;
+ }
+ else if (bytes instanceof Uint8Array || isUint8Array(bytes)) {
+ if (bytes.byteLength !== 16) {
+ throw new BSONError('Decimal128 must take a Buffer of 16 bytes');
+ }
+ this.bytes = bytes;
+ }
+ else {
+ throw new BSONError('Decimal128 must take a Buffer or string');
+ }
+ }
+ static fromString(representation) {
+ return Decimal128._fromString(representation, { allowRounding: false });
+ }
+ static fromStringWithRounding(representation) {
+ return Decimal128._fromString(representation, { allowRounding: true });
+ }
+ static _fromString(representation, options) {
+ let isNegative = false;
+ let sawSign = false;
+ let sawRadix = false;
+ let foundNonZero = false;
+ let significantDigits = 0;
+ let nDigitsRead = 0;
+ let nDigits = 0;
+ let radixPosition = 0;
+ let firstNonZero = 0;
+ const digits = [0];
+ let nDigitsStored = 0;
+ let digitsInsert = 0;
+ let lastDigit = 0;
+ let exponent = 0;
+ let significandHigh = new Long(0, 0);
+ let significandLow = new Long(0, 0);
+ let biasedExponent = 0;
+ let index = 0;
+ if (representation.length >= 7000) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ const stringMatch = representation.match(PARSE_STRING_REGEXP);
+ const infMatch = representation.match(PARSE_INF_REGEXP);
+ const nanMatch = representation.match(PARSE_NAN_REGEXP);
+ if ((!stringMatch && !infMatch && !nanMatch) || representation.length === 0) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ if (stringMatch) {
+ const unsignedNumber = stringMatch[2];
+ const e = stringMatch[4];
+ const expSign = stringMatch[5];
+ const expNumber = stringMatch[6];
+ if (e && expNumber === undefined)
+ invalidErr(representation, 'missing exponent power');
+ if (e && unsignedNumber === undefined)
+ invalidErr(representation, 'missing exponent base');
+ if (e === undefined && (expSign || expNumber)) {
+ invalidErr(representation, 'missing e before exponent');
+ }
+ }
+ if (representation[index] === '+' || representation[index] === '-') {
+ sawSign = true;
+ isNegative = representation[index++] === '-';
+ }
+ if (!isDigit(representation[index]) && representation[index] !== '.') {
+ if (representation[index] === 'i' || representation[index] === 'I') {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ else if (representation[index] === 'N') {
+ return new Decimal128(NAN_BUFFER);
+ }
+ }
+ while (isDigit(representation[index]) || representation[index] === '.') {
+ if (representation[index] === '.') {
+ if (sawRadix)
+ invalidErr(representation, 'contains multiple periods');
+ sawRadix = true;
+ index = index + 1;
+ continue;
+ }
+ if (nDigitsStored < MAX_DIGITS) {
+ if (representation[index] !== '0' || foundNonZero) {
+ if (!foundNonZero) {
+ firstNonZero = nDigitsRead;
+ }
+ foundNonZero = true;
+ digits[digitsInsert++] = parseInt(representation[index], 10);
+ nDigitsStored = nDigitsStored + 1;
+ }
+ }
+ if (foundNonZero)
+ nDigits = nDigits + 1;
+ if (sawRadix)
+ radixPosition = radixPosition + 1;
+ nDigitsRead = nDigitsRead + 1;
+ index = index + 1;
+ }
+ if (sawRadix && !nDigitsRead)
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ if (representation[index] === 'e' || representation[index] === 'E') {
+ const match = representation.substr(++index).match(EXPONENT_REGEX);
+ if (!match || !match[2])
+ return new Decimal128(NAN_BUFFER);
+ exponent = parseInt(match[0], 10);
+ index = index + match[0].length;
+ }
+ if (representation[index])
+ return new Decimal128(NAN_BUFFER);
+ if (!nDigitsStored) {
+ digits[0] = 0;
+ nDigits = 1;
+ nDigitsStored = 1;
+ significantDigits = 0;
+ }
+ else {
+ lastDigit = nDigitsStored - 1;
+ significantDigits = nDigits;
+ if (significantDigits !== 1) {
+ while (representation[firstNonZero + significantDigits - 1 + Number(sawSign) + Number(sawRadix)] === '0') {
+ significantDigits = significantDigits - 1;
+ }
+ }
+ }
+ if (exponent <= radixPosition && radixPosition > exponent + (1 << 14)) {
+ exponent = EXPONENT_MIN;
+ }
+ else {
+ exponent = exponent - radixPosition;
+ }
+ while (exponent > EXPONENT_MAX) {
+ lastDigit = lastDigit + 1;
+ if (lastDigit >= MAX_DIGITS) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ exponent = exponent - 1;
+ }
+ if (options.allowRounding) {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0 && significantDigits < nDigitsStored) {
+ exponent = EXPONENT_MIN;
+ significantDigits = 0;
+ break;
+ }
+ if (nDigitsStored < nDigits) {
+ nDigits = nDigits - 1;
+ }
+ else {
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ const digitsString = digits.join('');
+ if (digitsString.match(/^0+$/)) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ let endOfString = nDigitsRead;
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ let roundBit = 0;
+ if (roundDigit >= 5) {
+ roundBit = 1;
+ if (roundDigit === 5) {
+ roundBit = digits[lastDigit] % 2 === 1 ? 1 : 0;
+ for (let i = firstNonZero + lastDigit + 2; i < endOfString; i++) {
+ if (parseInt(representation[i], 10)) {
+ roundBit = 1;
+ break;
+ }
+ }
+ }
+ }
+ if (roundBit) {
+ let dIdx = lastDigit;
+ for (; dIdx >= 0; dIdx--) {
+ if (++digits[dIdx] > 9) {
+ digits[dIdx] = 0;
+ if (dIdx === 0) {
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ digits[dIdx] = 1;
+ }
+ else {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ }
+ }
+ else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ else {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MIN;
+ break;
+ }
+ invalidErr(representation, 'exponent underflow');
+ }
+ if (nDigitsStored < nDigits) {
+ if (representation[nDigits - 1 + Number(sawSign) + Number(sawRadix)] !== '0' &&
+ significantDigits !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ nDigits = nDigits - 1;
+ }
+ else {
+ if (digits[lastDigit] !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ if (roundDigit !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ }
+ }
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ if (significantDigits === 0) {
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ }
+ else if (lastDigit < 17) {
+ let dIdx = 0;
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ significandHigh = new Long(0, 0);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ else {
+ let dIdx = 0;
+ significandHigh = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit - 17; dIdx++) {
+ significandHigh = significandHigh.multiply(Long.fromNumber(10));
+ significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));
+ }
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ const significand = multiply64x2(significandHigh, Long.fromString('100000000000000000'));
+ significand.low = significand.low.add(significandLow);
+ if (lessThan(significand.low, significandLow)) {
+ significand.high = significand.high.add(Long.fromNumber(1));
+ }
+ biasedExponent = exponent + EXPONENT_BIAS;
+ const dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };
+ if (significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1))) {
+ dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));
+ }
+ else {
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));
+ }
+ dec.low = significand.low;
+ if (isNegative) {
+ dec.high = dec.high.or(Long.fromString('9223372036854775808'));
+ }
+ const buffer = ByteUtils.allocateUnsafe(16);
+ index = 0;
+ buffer[index++] = dec.low.low & 0xff;
+ buffer[index++] = (dec.low.low >> 8) & 0xff;
+ buffer[index++] = (dec.low.low >> 16) & 0xff;
+ buffer[index++] = (dec.low.low >> 24) & 0xff;
+ buffer[index++] = dec.low.high & 0xff;
+ buffer[index++] = (dec.low.high >> 8) & 0xff;
+ buffer[index++] = (dec.low.high >> 16) & 0xff;
+ buffer[index++] = (dec.low.high >> 24) & 0xff;
+ buffer[index++] = dec.high.low & 0xff;
+ buffer[index++] = (dec.high.low >> 8) & 0xff;
+ buffer[index++] = (dec.high.low >> 16) & 0xff;
+ buffer[index++] = (dec.high.low >> 24) & 0xff;
+ buffer[index++] = dec.high.high & 0xff;
+ buffer[index++] = (dec.high.high >> 8) & 0xff;
+ buffer[index++] = (dec.high.high >> 16) & 0xff;
+ buffer[index++] = (dec.high.high >> 24) & 0xff;
+ return new Decimal128(buffer);
+ }
+ toString() {
+ let biased_exponent;
+ let significand_digits = 0;
+ const significand = new Array(36);
+ for (let i = 0; i < significand.length; i++)
+ significand[i] = 0;
+ let index = 0;
+ let is_zero = false;
+ let significand_msb;
+ let significand128 = { parts: [0, 0, 0, 0] };
+ let j, k;
+ const string = [];
+ index = 0;
+ const buffer = this.bytes;
+ const low = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midl = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midh = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const high = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ index = 0;
+ const dec = {
+ low: new Long(low, midl),
+ high: new Long(midh, high)
+ };
+ if (dec.high.lessThan(Long.ZERO)) {
+ string.push('-');
+ }
+ const combination = (high >> 26) & COMBINATION_MASK;
+ if (combination >> 3 === 3) {
+ if (combination === COMBINATION_INFINITY) {
+ return string.join('') + 'Infinity';
+ }
+ else if (combination === COMBINATION_NAN) {
+ return 'NaN';
+ }
+ else {
+ biased_exponent = (high >> 15) & EXPONENT_MASK;
+ significand_msb = 0x08 + ((high >> 14) & 0x01);
+ }
+ }
+ else {
+ significand_msb = (high >> 14) & 0x07;
+ biased_exponent = (high >> 17) & EXPONENT_MASK;
+ }
+ const exponent = biased_exponent - EXPONENT_BIAS;
+ significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);
+ significand128.parts[1] = midh;
+ significand128.parts[2] = midl;
+ significand128.parts[3] = low;
+ if (significand128.parts[0] === 0 &&
+ significand128.parts[1] === 0 &&
+ significand128.parts[2] === 0 &&
+ significand128.parts[3] === 0) {
+ is_zero = true;
+ }
+ else {
+ for (k = 3; k >= 0; k--) {
+ let least_digits = 0;
+ const result = divideu128(significand128);
+ significand128 = result.quotient;
+ least_digits = result.rem.low;
+ if (!least_digits)
+ continue;
+ for (j = 8; j >= 0; j--) {
+ significand[k * 9 + j] = least_digits % 10;
+ least_digits = Math.floor(least_digits / 10);
+ }
+ }
+ }
+ if (is_zero) {
+ significand_digits = 1;
+ significand[index] = 0;
+ }
+ else {
+ significand_digits = 36;
+ while (!significand[index]) {
+ significand_digits = significand_digits - 1;
+ index = index + 1;
+ }
+ }
+ const scientific_exponent = significand_digits - 1 + exponent;
+ if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) {
+ if (significand_digits > 34) {
+ string.push(`${0}`);
+ if (exponent > 0)
+ string.push(`E+${exponent}`);
+ else if (exponent < 0)
+ string.push(`E${exponent}`);
+ return string.join('');
+ }
+ string.push(`${significand[index++]}`);
+ significand_digits = significand_digits - 1;
+ if (significand_digits) {
+ string.push('.');
+ }
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ string.push('E');
+ if (scientific_exponent > 0) {
+ string.push(`+${scientific_exponent}`);
+ }
+ else {
+ string.push(`${scientific_exponent}`);
+ }
+ }
+ else {
+ if (exponent >= 0) {
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ let radix_position = significand_digits + exponent;
+ if (radix_position > 0) {
+ for (let i = 0; i < radix_position; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ string.push('0');
+ }
+ string.push('.');
+ while (radix_position++ < 0) {
+ string.push('0');
+ }
+ for (let i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ }
+ return string.join('');
+ }
+ toJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ toExtendedJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ static fromExtendedJSON(doc) {
+ return Decimal128.fromString(doc.$numberDecimal);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const d128string = inspect(this.toString(), options);
+ return `new Decimal128(${d128string})`;
+ }
+}
+
+class Double extends BSONValue {
+ get _bsontype() {
+ return 'Double';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value;
+ }
+ static fromString(value) {
+ const coercedValue = Number(value);
+ if (value === 'NaN')
+ return new Double(NaN);
+ if (value === 'Infinity')
+ return new Double(Infinity);
+ if (value === '-Infinity')
+ return new Double(-Infinity);
+ if (!Number.isFinite(coercedValue)) {
+ throw new BSONError(`Input: ${value} is not representable as a Double`);
+ }
+ if (value.trim() !== value) {
+ throw new BSONError(`Input: '${value}' contains whitespace`);
+ }
+ if (value === '') {
+ throw new BSONError(`Input is an empty string`);
+ }
+ if (/[^-0-9.+eE]/.test(value)) {
+ throw new BSONError(`Input: '${value}' is not in decimal or exponential notation`);
+ }
+ return new Double(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toExtendedJSON(options) {
+ if (options && (options.legacy || (options.relaxed && isFinite(this.value)))) {
+ return this.value;
+ }
+ if (Object.is(Math.sign(this.value), -0)) {
+ return { $numberDouble: '-0.0' };
+ }
+ return {
+ $numberDouble: Number.isInteger(this.value) ? this.value.toFixed(1) : this.value.toString()
+ };
+ }
+ static fromExtendedJSON(doc, options) {
+ const doubleValue = parseFloat(doc.$numberDouble);
+ return options && options.relaxed ? doubleValue : new Double(doubleValue);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Double(${inspect(this.value, options)})`;
+ }
+}
+
+class Int32 extends BSONValue {
+ get _bsontype() {
+ return 'Int32';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value | 0;
+ }
+ static fromString(value) {
+ const cleanedValue = removeLeadingZerosAndExplicitPlus(value);
+ const coercedValue = Number(value);
+ if (BSON_INT32_MAX < coercedValue) {
+ throw new BSONError(`Input: '${value}' is larger than the maximum value for Int32`);
+ }
+ else if (BSON_INT32_MIN > coercedValue) {
+ throw new BSONError(`Input: '${value}' is smaller than the minimum value for Int32`);
+ }
+ else if (!Number.isSafeInteger(coercedValue)) {
+ throw new BSONError(`Input: '${value}' is not a safe integer`);
+ }
+ else if (coercedValue.toString() !== cleanedValue) {
+ throw new BSONError(`Input: '${value}' is not a valid Int32 string`);
+ }
+ return new Int32(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON(options) {
+ if (options && (options.relaxed || options.legacy))
+ return this.value;
+ return { $numberInt: this.value.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new Int32(doc.$numberInt);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Int32(${inspect(this.value, options)})`;
+ }
+}
+
+class MaxKey extends BSONValue {
+ get _bsontype() {
+ return 'MaxKey';
+ }
+ toExtendedJSON() {
+ return { $maxKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MaxKey();
+ }
+ inspect() {
+ return 'new MaxKey()';
+ }
+}
+
+class MinKey extends BSONValue {
+ get _bsontype() {
+ return 'MinKey';
+ }
+ toExtendedJSON() {
+ return { $minKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MinKey();
+ }
+ inspect() {
+ return 'new MinKey()';
+ }
+}
+
+let PROCESS_UNIQUE = null;
+const __idCache = new WeakMap();
+class ObjectId extends BSONValue {
+ get _bsontype() {
+ return 'ObjectId';
+ }
+ static index = Math.floor(Math.random() * 0xffffff);
+ static cacheHexString;
+ buffer;
+ constructor(inputId) {
+ super();
+ let workingId;
+ if (typeof inputId === 'object' && inputId && 'id' in inputId) {
+ if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
+ throw new BSONError('Argument passed in must have an id that is of type string or Buffer');
+ }
+ if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
+ workingId = ByteUtils.fromHex(inputId.toHexString());
+ }
+ else {
+ workingId = inputId.id;
+ }
+ }
+ else {
+ workingId = inputId;
+ }
+ if (workingId == null) {
+ this.buffer = ObjectId.generate();
+ }
+ else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
+ this.buffer = ByteUtils.toLocalBufferType(workingId);
+ }
+ else if (typeof workingId === 'string') {
+ if (ObjectId.validateHexString(workingId)) {
+ this.buffer = ByteUtils.fromHex(workingId);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, workingId);
+ }
+ }
+ else {
+ throw new BSONError('input must be a 24 character hex string, 12 byte Uint8Array, or an integer');
+ }
+ }
+ else {
+ throw new BSONError('Argument passed in does not match the accepted types');
+ }
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, ByteUtils.toHex(value));
+ }
+ }
+ static validateHexString(string) {
+ if (string?.length !== 24)
+ return false;
+ for (let i = 0; i < 24; i++) {
+ const char = string.charCodeAt(i);
+ if ((char >= 48 && char <= 57) ||
+ (char >= 97 && char <= 102) ||
+ (char >= 65 && char <= 70)) {
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+ toHexString() {
+ if (ObjectId.cacheHexString) {
+ const __id = __idCache.get(this);
+ if (__id)
+ return __id;
+ }
+ const hexString = ByteUtils.toHex(this.id);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, hexString);
+ }
+ return hexString;
+ }
+ static getInc() {
+ return (ObjectId.index = (ObjectId.index + 1) % 0xffffff);
+ }
+ static generate(time) {
+ if ('number' !== typeof time) {
+ time = Math.floor(Date.now() / 1000);
+ }
+ const inc = ObjectId.getInc();
+ const buffer = ByteUtils.allocateUnsafe(12);
+ NumberUtils.setInt32BE(buffer, 0, time);
+ if (PROCESS_UNIQUE === null) {
+ PROCESS_UNIQUE = ByteUtils.randomBytes(5);
+ }
+ buffer[4] = PROCESS_UNIQUE[0];
+ buffer[5] = PROCESS_UNIQUE[1];
+ buffer[6] = PROCESS_UNIQUE[2];
+ buffer[7] = PROCESS_UNIQUE[3];
+ buffer[8] = PROCESS_UNIQUE[4];
+ buffer[11] = inc & 0xff;
+ buffer[10] = (inc >> 8) & 0xff;
+ buffer[9] = (inc >> 16) & 0xff;
+ return buffer;
+ }
+ toString(encoding) {
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ if (encoding === 'hex')
+ return this.toHexString();
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ static is(variable) {
+ return (variable != null &&
+ typeof variable === 'object' &&
+ '_bsontype' in variable &&
+ variable._bsontype === 'ObjectId');
+ }
+ equals(otherId) {
+ if (otherId === undefined || otherId === null) {
+ return false;
+ }
+ if (ObjectId.is(otherId)) {
+ return (this.buffer[11] === otherId.buffer[11] && ByteUtils.equals(this.buffer, otherId.buffer));
+ }
+ if (typeof otherId === 'string') {
+ return otherId.toLowerCase() === this.toHexString();
+ }
+ if (typeof otherId === 'object' && typeof otherId.toHexString === 'function') {
+ const otherIdString = otherId.toHexString();
+ const thisIdString = this.toHexString();
+ return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
+ }
+ return false;
+ }
+ getTimestamp() {
+ const timestamp = new Date();
+ const time = NumberUtils.getUint32BE(this.buffer, 0);
+ timestamp.setTime(Math.floor(time) * 1000);
+ return timestamp;
+ }
+ static createPk() {
+ return new ObjectId();
+ }
+ serializeInto(uint8array, index) {
+ uint8array[index] = this.buffer[0];
+ uint8array[index + 1] = this.buffer[1];
+ uint8array[index + 2] = this.buffer[2];
+ uint8array[index + 3] = this.buffer[3];
+ uint8array[index + 4] = this.buffer[4];
+ uint8array[index + 5] = this.buffer[5];
+ uint8array[index + 6] = this.buffer[6];
+ uint8array[index + 7] = this.buffer[7];
+ uint8array[index + 8] = this.buffer[8];
+ uint8array[index + 9] = this.buffer[9];
+ uint8array[index + 10] = this.buffer[10];
+ uint8array[index + 11] = this.buffer[11];
+ return 12;
+ }
+ static createFromTime(time) {
+ const buffer = ByteUtils.allocate(12);
+ for (let i = 11; i >= 4; i--)
+ buffer[i] = 0;
+ NumberUtils.setInt32BE(buffer, 0, time);
+ return new ObjectId(buffer);
+ }
+ static createFromHexString(hexString) {
+ if (hexString?.length !== 24) {
+ throw new BSONError('hex string must be 24 characters');
+ }
+ return new ObjectId(ByteUtils.fromHex(hexString));
+ }
+ static createFromBase64(base64) {
+ if (base64?.length !== 16) {
+ throw new BSONError('base64 string must be 16 characters');
+ }
+ return new ObjectId(ByteUtils.fromBase64(base64));
+ }
+ static isValid(id) {
+ if (id == null)
+ return false;
+ if (typeof id === 'string')
+ return ObjectId.validateHexString(id);
+ try {
+ new ObjectId(id);
+ return true;
+ }
+ catch {
+ return false;
+ }
+ }
+ toExtendedJSON() {
+ if (this.toHexString)
+ return { $oid: this.toHexString() };
+ return { $oid: this.toString('hex') };
+ }
+ static fromExtendedJSON(doc) {
+ return new ObjectId(doc.$oid);
+ }
+ isCached() {
+ return ObjectId.cacheHexString && __idCache.has(this);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new ObjectId(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+function internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined) {
+ let totalLength = 4 + 1;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined);
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ }
+ for (const key of Object.keys(object)) {
+ totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined);
+ }
+ }
+ return totalLength;
+}
+function calculateElement(name, value, serializeFunctions = false, isArray = false, ignoreUndefined = false) {
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ switch (typeof value) {
+ case 'string':
+ return 1 + ByteUtils.utf8ByteLength(name) + 1 + 4 + ByteUtils.utf8ByteLength(value) + 1;
+ case 'number':
+ if (Math.floor(value) === value &&
+ value >= JS_INT_MIN &&
+ value <= JS_INT_MAX) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (4 + 1);
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ case 'undefined':
+ if (isArray || !ignoreUndefined)
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ return 0;
+ case 'boolean':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 1);
+ case 'object':
+ if (value != null &&
+ typeof value._bsontype === 'string' &&
+ value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value == null || value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ }
+ else if (value._bsontype === 'ObjectId') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (12 + 1);
+ }
+ else if (value instanceof Date || isDate(value)) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (ArrayBuffer.isView(value) ||
+ value instanceof ArrayBuffer ||
+ isAnyArrayBuffer(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 4 + 1) + value.byteLength);
+ }
+ else if (value._bsontype === 'Long' ||
+ value._bsontype === 'Double' ||
+ value._bsontype === 'Timestamp') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (16 + 1);
+ }
+ else if (value._bsontype === 'Code') {
+ if (value.scope != null && Object.keys(value.scope).length > 0) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1 +
+ internalCalculateObjectSize(value.scope, serializeFunctions, ignoreUndefined));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1);
+ }
+ }
+ else if (value._bsontype === 'Binary') {
+ const binary = value;
+ if (binary.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ (binary.position + 1 + 4 + 1 + 4));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (binary.position + 1 + 4 + 1));
+ }
+ }
+ else if (value._bsontype === 'Symbol') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ ByteUtils.utf8ByteLength(value.value) +
+ 4 +
+ 1 +
+ 1);
+ }
+ else if (value._bsontype === 'DBRef') {
+ const ordered_values = Object.assign({
+ $ref: value.collection,
+ $id: value.oid
+ }, value.fields);
+ if (value.db != null) {
+ ordered_values['$db'] = value.db;
+ }
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ internalCalculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined));
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.source) +
+ 1 +
+ (value.global ? 1 : 0) +
+ (value.ignoreCase ? 1 : 0) +
+ (value.multiline ? 1 : 0) +
+ 1);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.pattern) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.options) +
+ 1);
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ internalCalculateObjectSize(value, serializeFunctions, ignoreUndefined) +
+ 1);
+ }
+ case 'function':
+ if (serializeFunctions) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.toString()) +
+ 1);
+ }
+ return 0;
+ case 'bigint':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ case 'symbol':
+ return 0;
+ default:
+ throw new BSONError(`Unrecognized JS type: ${typeof value}`);
+ }
+}
+
+function alphabetize(str) {
+ return str.split('').sort().join('');
+}
+class BSONRegExp extends BSONValue {
+ get _bsontype() {
+ return 'BSONRegExp';
+ }
+ pattern;
+ options;
+ constructor(pattern, options) {
+ super();
+ this.pattern = pattern;
+ this.options = alphabetize(options ?? '');
+ if (this.pattern.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}`);
+ }
+ if (this.options.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex options cannot contain null bytes, found: ${JSON.stringify(this.options)}`);
+ }
+ for (let i = 0; i < this.options.length; i++) {
+ if (!(this.options[i] === 'i' ||
+ this.options[i] === 'm' ||
+ this.options[i] === 'x' ||
+ this.options[i] === 'l' ||
+ this.options[i] === 's' ||
+ this.options[i] === 'u')) {
+ throw new BSONError(`The regular expression option [${this.options[i]}] is not supported`);
+ }
+ }
+ }
+ static parseOptions(options) {
+ return options ? options.split('').sort().join('') : '';
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (options.legacy) {
+ return { $regex: this.pattern, $options: this.options };
+ }
+ return { $regularExpression: { pattern: this.pattern, options: this.options } };
+ }
+ static fromExtendedJSON(doc) {
+ if ('$regex' in doc) {
+ if (typeof doc.$regex !== 'string') {
+ if (doc.$regex._bsontype === 'BSONRegExp') {
+ return doc;
+ }
+ }
+ else {
+ return new BSONRegExp(doc.$regex, BSONRegExp.parseOptions(doc.$options));
+ }
+ }
+ if ('$regularExpression' in doc) {
+ return new BSONRegExp(doc.$regularExpression.pattern, BSONRegExp.parseOptions(doc.$regularExpression.options));
+ }
+ throw new BSONError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(doc)}`);
+ }
+ inspect(depth, options, inspect) {
+ const stylize = getStylizeFunction(options) ?? (v => v);
+ inspect ??= defaultInspect;
+ const pattern = stylize(inspect(this.pattern), 'regexp');
+ const flags = stylize(inspect(this.options), 'regexp');
+ return `new BSONRegExp(${pattern}, ${flags})`;
+ }
+}
+
+class BSONSymbol extends BSONValue {
+ get _bsontype() {
+ return 'BSONSymbol';
+ }
+ value;
+ constructor(value) {
+ super();
+ this.value = value;
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON() {
+ return { $symbol: this.value };
+ }
+ static fromExtendedJSON(doc) {
+ return new BSONSymbol(doc.$symbol);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new BSONSymbol(${inspect(this.value, options)})`;
+ }
+}
+
+const LongWithoutOverridesClass = Long;
+class Timestamp extends LongWithoutOverridesClass {
+ get _bsontype() {
+ return 'Timestamp';
+ }
+ get [bsonType]() {
+ return 'Timestamp';
+ }
+ static MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
+ get i() {
+ return this.low >>> 0;
+ }
+ get t() {
+ return this.high >>> 0;
+ }
+ constructor(low) {
+ if (low == null) {
+ super(0, 0, true);
+ }
+ else if (typeof low === 'bigint') {
+ super(low, true);
+ }
+ else if (Long.isLong(low)) {
+ super(low.low, low.high, true);
+ }
+ else if (typeof low === 'object' && 't' in low && 'i' in low) {
+ if (typeof low.t !== 'number' && (typeof low.t !== 'object' || low.t._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t as a number');
+ }
+ if (typeof low.i !== 'number' && (typeof low.i !== 'object' || low.i._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i as a number');
+ }
+ const t = Number(low.t);
+ const i = Number(low.i);
+ if (t < 0 || Number.isNaN(t)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive t');
+ }
+ if (i < 0 || Number.isNaN(i)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive i');
+ }
+ if (t > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t equal or less than uint32 max');
+ }
+ if (i > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i equal or less than uint32 max');
+ }
+ super(i, t, true);
+ }
+ else {
+ throw new BSONError('A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }');
+ }
+ }
+ toJSON() {
+ return {
+ $timestamp: this.toString()
+ };
+ }
+ static fromInt(value) {
+ return new Timestamp(Long.fromInt(value, true));
+ }
+ static fromNumber(value) {
+ return new Timestamp(Long.fromNumber(value, true));
+ }
+ static fromBits(lowBits, highBits) {
+ return new Timestamp({ i: lowBits, t: highBits });
+ }
+ static fromString(str, optRadix) {
+ return new Timestamp(Long.fromString(str, true, optRadix));
+ }
+ toExtendedJSON() {
+ return { $timestamp: { t: this.t, i: this.i } };
+ }
+ static fromExtendedJSON(doc) {
+ const i = Long.isLong(doc.$timestamp.i)
+ ? doc.$timestamp.i.getLowBitsUnsigned()
+ : doc.$timestamp.i;
+ const t = Long.isLong(doc.$timestamp.t)
+ ? doc.$timestamp.t.getLowBitsUnsigned()
+ : doc.$timestamp.t;
+ return new Timestamp({ t, i });
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const t = inspect(this.t, options);
+ const i = inspect(this.i, options);
+ return `new Timestamp({ t: ${t}, i: ${i} })`;
+ }
+}
+
+const JS_INT_MAX_LONG = Long.fromNumber(JS_INT_MAX);
+const JS_INT_MIN_LONG = Long.fromNumber(JS_INT_MIN);
+function internalDeserialize(buffer, options, isArray) {
+ options = options == null ? {} : options;
+ const index = options && options.index ? options.index : 0;
+ const size = NumberUtils.getInt32LE(buffer, index);
+ if (size < 5) {
+ throw new BSONError(`bson size must be >= 5, is ${size}`);
+ }
+ if (options.allowObjectSmallerThanBufferSize && buffer.length < size) {
+ throw new BSONError(`buffer length ${buffer.length} must be >= bson size ${size}`);
+ }
+ if (!options.allowObjectSmallerThanBufferSize && buffer.length !== size) {
+ throw new BSONError(`buffer length ${buffer.length} must === bson size ${size}`);
+ }
+ if (size + index > buffer.byteLength) {
+ throw new BSONError(`(bson size ${size} + options.index ${index} must be <= buffer length ${buffer.byteLength})`);
+ }
+ if (buffer[index + size - 1] !== 0) {
+ throw new BSONError("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");
+ }
+ return deserializeObject(buffer, index, options, isArray);
+}
+const allowedDBRefKeys = /^\$ref$|^\$id$|^\$db$/;
+function deserializeObject(buffer, index, options, isArray = false) {
+ const fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];
+ const raw = options['raw'] == null ? false : options['raw'];
+ const bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false;
+ const promoteBuffers = options.promoteBuffers ?? false;
+ const promoteLongs = options.promoteLongs ?? true;
+ const promoteValues = options.promoteValues ?? true;
+ const useBigInt64 = options.useBigInt64 ?? false;
+ if (useBigInt64 && !promoteValues) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ if (useBigInt64 && !promoteLongs) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ const validation = options.validation == null ? { utf8: true } : options.validation;
+ let globalUTFValidation = true;
+ let validationSetting;
+ let utf8KeysSet;
+ const utf8ValidatedKeys = validation.utf8;
+ if (typeof utf8ValidatedKeys === 'boolean') {
+ validationSetting = utf8ValidatedKeys;
+ }
+ else {
+ globalUTFValidation = false;
+ const utf8ValidationValues = Object.keys(utf8ValidatedKeys).map(function (key) {
+ return utf8ValidatedKeys[key];
+ });
+ if (utf8ValidationValues.length === 0) {
+ throw new BSONError('UTF-8 validation setting cannot be empty');
+ }
+ if (typeof utf8ValidationValues[0] !== 'boolean') {
+ throw new BSONError('Invalid UTF-8 validation option, must specify boolean values');
+ }
+ validationSetting = utf8ValidationValues[0];
+ if (!utf8ValidationValues.every(item => item === validationSetting)) {
+ throw new BSONError('Invalid UTF-8 validation option - keys must be all true or all false');
+ }
+ }
+ if (!globalUTFValidation) {
+ utf8KeysSet = new Set();
+ for (const key of Object.keys(utf8ValidatedKeys)) {
+ utf8KeysSet.add(key);
+ }
+ }
+ const startIndex = index;
+ if (buffer.length < 5)
+ throw new BSONError('corrupt bson message < 5 bytes long');
+ const size = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (size < 5 || size > buffer.length)
+ throw new BSONError('corrupt bson message');
+ const object = isArray ? [] : {};
+ let arrayIndex = 0;
+ let isPossibleDBRef = isArray ? false : null;
+ while (true) {
+ const elementType = buffer[index++];
+ if (elementType === 0)
+ break;
+ let i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.byteLength)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const name = isArray ? arrayIndex++ : ByteUtils.toUTF8(buffer, index, i, false);
+ let shouldValidateKey = true;
+ if (globalUTFValidation || utf8KeysSet?.has(name)) {
+ shouldValidateKey = validationSetting;
+ }
+ else {
+ shouldValidateKey = !validationSetting;
+ }
+ if (isPossibleDBRef !== false && name[0] === '$') {
+ isPossibleDBRef = allowedDBRefKeys.test(name);
+ }
+ let value;
+ index = i + 1;
+ if (elementType === BSON_DATA_STRING) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ value = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_OID) {
+ const oid = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oid[i] = buffer[index + i];
+ value = new ObjectId(oid);
+ index = index + 12;
+ }
+ else if (elementType === BSON_DATA_INT && promoteValues === false) {
+ value = new Int32(NumberUtils.getInt32LE(buffer, index));
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_INT) {
+ value = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_NUMBER) {
+ value = NumberUtils.getFloat64LE(buffer, index);
+ index += 8;
+ if (promoteValues === false)
+ value = new Double(value);
+ }
+ else if (elementType === BSON_DATA_DATE) {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ value = new Date(new Long(lowBits, highBits).toNumber());
+ }
+ else if (elementType === BSON_DATA_BOOLEAN) {
+ if (buffer[index] !== 0 && buffer[index] !== 1)
+ throw new BSONError('illegal boolean type value');
+ value = buffer[index++] === 1;
+ }
+ else if (elementType === BSON_DATA_OBJECT) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ if (objectSize <= 0 || objectSize > buffer.length - index)
+ throw new BSONError('bad embedded document length in bson');
+ if (raw) {
+ value = buffer.subarray(index, index + objectSize);
+ }
+ else {
+ let objectOptions = options;
+ if (!globalUTFValidation) {
+ objectOptions = { ...options, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, objectOptions, false);
+ }
+ index = index + objectSize;
+ }
+ else if (elementType === BSON_DATA_ARRAY) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ let arrayOptions = options;
+ const stopIndex = index + objectSize;
+ if (fieldsAsRaw && fieldsAsRaw[name]) {
+ arrayOptions = { ...options, raw: true };
+ }
+ if (!globalUTFValidation) {
+ arrayOptions = { ...arrayOptions, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, arrayOptions, true);
+ index = index + objectSize;
+ if (buffer[index - 1] !== 0)
+ throw new BSONError('invalid array terminator byte');
+ if (index !== stopIndex)
+ throw new BSONError('corrupted array bson');
+ }
+ else if (elementType === BSON_DATA_UNDEFINED) {
+ value = undefined;
+ }
+ else if (elementType === BSON_DATA_NULL) {
+ value = null;
+ }
+ else if (elementType === BSON_DATA_LONG) {
+ if (useBigInt64) {
+ value = NumberUtils.getBigInt64LE(buffer, index);
+ index += 8;
+ }
+ else {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ const long = new Long(lowBits, highBits);
+ if (promoteLongs && promoteValues === true) {
+ value =
+ long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG)
+ ? long.toNumber()
+ : long;
+ }
+ else {
+ value = long;
+ }
+ }
+ }
+ else if (elementType === BSON_DATA_DECIMAL128) {
+ const bytes = ByteUtils.allocateUnsafe(16);
+ for (let i = 0; i < 16; i++)
+ bytes[i] = buffer[index + i];
+ index = index + 16;
+ value = new Decimal128(bytes);
+ }
+ else if (elementType === BSON_DATA_BINARY) {
+ let binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ const totalBinarySize = binarySize;
+ const subType = buffer[index++];
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found');
+ if (binarySize > buffer.byteLength)
+ throw new BSONError('Binary type size larger than document size');
+ if (subType === Binary.SUBTYPE_BYTE_ARRAY) {
+ binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found for subtype 0x02');
+ if (binarySize > totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too long binary size');
+ if (binarySize < totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too short binary size');
+ }
+ if (promoteBuffers && promoteValues) {
+ value = ByteUtils.toLocalBufferType(buffer.subarray(index, index + binarySize));
+ }
+ else {
+ value = new Binary(buffer.subarray(index, index + binarySize), subType);
+ if (subType === BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
+ value = value.toUUID();
+ }
+ }
+ index = index + binarySize;
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === false) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ const optionsArray = new Array(regExpOptions.length);
+ for (i = 0; i < regExpOptions.length; i++) {
+ switch (regExpOptions[i]) {
+ case 'm':
+ optionsArray[i] = 'm';
+ break;
+ case 's':
+ optionsArray[i] = 'g';
+ break;
+ case 'i':
+ optionsArray[i] = 'i';
+ break;
+ }
+ }
+ value = new RegExp(source, optionsArray.join(''));
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === true) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ value = new BSONRegExp(source, regExpOptions);
+ }
+ else if (elementType === BSON_DATA_SYMBOL) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const symbol = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = promoteValues ? symbol : new BSONSymbol(symbol);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_TIMESTAMP) {
+ value = new Timestamp({
+ i: NumberUtils.getUint32LE(buffer, index),
+ t: NumberUtils.getUint32LE(buffer, index + 4)
+ });
+ index += 8;
+ }
+ else if (elementType === BSON_DATA_MIN_KEY) {
+ value = new MinKey();
+ }
+ else if (elementType === BSON_DATA_MAX_KEY) {
+ value = new MaxKey();
+ }
+ else if (elementType === BSON_DATA_CODE) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = new Code(functionString);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_CODE_W_SCOPE) {
+ const totalSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (totalSize < 4 + 4 + 4 + 1) {
+ throw new BSONError('code_w_scope total size shorter minimum expected length');
+ }
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ const scopeObject = deserializeObject(buffer, _index, options, false);
+ index = index + objectSize;
+ if (totalSize < 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too short, truncating scope');
+ }
+ if (totalSize > 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too long, clips outer document');
+ }
+ value = new Code(functionString, scopeObject);
+ }
+ else if (elementType === BSON_DATA_DBPOINTER) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0)
+ throw new BSONError('bad string length in bson');
+ const namespace = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const oidBuffer = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oidBuffer[i] = buffer[index + i];
+ const oid = new ObjectId(oidBuffer);
+ index = index + 12;
+ value = new DBRef(namespace, oid);
+ }
+ else {
+ throw new BSONError(`Detected unknown BSON type ${elementType.toString(16)} for fieldname "${name}"`);
+ }
+ if (name === '__proto__') {
+ Object.defineProperty(object, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ object[name] = value;
+ }
+ }
+ if (size !== index - startIndex) {
+ if (isArray)
+ throw new BSONError('corrupt array bson');
+ throw new BSONError('corrupt object bson');
+ }
+ if (!isPossibleDBRef)
+ return object;
+ if (isDBRefLike(object)) {
+ const copy = Object.assign({}, object);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(object.$ref, object.$id, object.$db, copy);
+ }
+ return object;
+}
+
+const regexp = /\x00/;
+const ignoreKeys = new Set(['$db', '$ref', '$id', '$clusterTime']);
+function serializeString(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_STRING;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes + 1;
+ buffer[index - 1] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value, index + 4);
+ NumberUtils.setInt32LE(buffer, index, size + 1);
+ index = index + 4 + size;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeNumber(buffer, key, value, index) {
+ const isNegativeZero = Object.is(value, -0);
+ const type = !isNegativeZero &&
+ Number.isSafeInteger(value) &&
+ value <= BSON_INT32_MAX &&
+ value >= BSON_INT32_MIN
+ ? BSON_DATA_INT
+ : BSON_DATA_NUMBER;
+ buffer[index++] = type;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0x00;
+ if (type === BSON_DATA_INT) {
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ }
+ else {
+ index += NumberUtils.setFloat64LE(buffer, index, value);
+ }
+ return index;
+}
+function serializeBigInt(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_LONG;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index += numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setBigInt64LE(buffer, index, value);
+ return index;
+}
+function serializeNull(buffer, key, _, index) {
+ buffer[index++] = BSON_DATA_NULL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeBoolean(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BOOLEAN;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ buffer[index++] = value ? 1 : 0;
+ return index;
+}
+function serializeDate(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DATE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const dateInMilis = Long.fromNumber(value.getTime());
+ const lowBits = dateInMilis.getLowBits();
+ const highBits = dateInMilis.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.source && value.source.match(regexp) != null) {
+ throw new BSONError('value ' + value.source + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.source, index);
+ buffer[index++] = 0x00;
+ if (value.ignoreCase)
+ buffer[index++] = 0x69;
+ if (value.global)
+ buffer[index++] = 0x73;
+ if (value.multiline)
+ buffer[index++] = 0x6d;
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeBSONRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.pattern.match(regexp) != null) {
+ throw new BSONError('pattern ' + value.pattern + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.pattern, index);
+ buffer[index++] = 0x00;
+ const sortedOptions = value.options.split('').sort().join('');
+ index = index + ByteUtils.encodeUTF8Into(buffer, sortedOptions, index);
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeMinMax(buffer, key, value, index) {
+ if (value === null) {
+ buffer[index++] = BSON_DATA_NULL;
+ }
+ else if (value._bsontype === 'MinKey') {
+ buffer[index++] = BSON_DATA_MIN_KEY;
+ }
+ else {
+ buffer[index++] = BSON_DATA_MAX_KEY;
+ }
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeObjectId(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_OID;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += value.serializeInto(buffer, index);
+ return index;
+}
+function serializeBuffer(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = value.length;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = BSON_BINARY_SUBTYPE_DEFAULT;
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = value[i];
+ }
+ else {
+ buffer.set(value, index);
+ }
+ index = index + size;
+ return index;
+}
+function serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path.has(value)) {
+ throw new BSONError('Cannot convert circular structure to BSON');
+ }
+ path.add(value);
+ buffer[index++] = Array.isArray(value) ? BSON_DATA_ARRAY : BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ path.delete(value);
+ return endIndex;
+}
+function serializeDecimal128(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DECIMAL128;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ for (let i = 0; i < 16; i++)
+ buffer[index + i] = value.bytes[i];
+ return index + 16;
+}
+function serializeLong(buffer, key, value, index) {
+ buffer[index++] =
+ value._bsontype === 'Long' ? BSON_DATA_LONG : BSON_DATA_TIMESTAMP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const lowBits = value.getLowBits();
+ const highBits = value.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeInt32(buffer, key, value, index) {
+ value = value.valueOf();
+ buffer[index++] = BSON_DATA_INT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ return index;
+}
+function serializeDouble(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_NUMBER;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setFloat64LE(buffer, index, value.value);
+ return index;
+}
+function serializeFunction(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeCode(buffer, key, value, index, checkKeys = false, depth = 0, serializeFunctions = false, ignoreUndefined = true, path) {
+ if (value.scope && typeof value.scope === 'object') {
+ buffer[index++] = BSON_DATA_CODE_W_SCOPE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ const functionString = value.code;
+ index = index + 4;
+ const codeSize = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, codeSize);
+ buffer[index + 4 + codeSize - 1] = 0;
+ index = index + codeSize + 4;
+ const endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ index = endIndex - 1;
+ const totalSize = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, startIndex, totalSize);
+ buffer[index++] = 0;
+ }
+ else {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.code.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ }
+ return index;
+}
+function serializeBinary(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const data = value.buffer;
+ let size = value.position;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY)
+ size = size + 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = value.sub_type;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ size = size - 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ }
+ if (value.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(value);
+ }
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = data[i];
+ }
+ else {
+ buffer.set(data, index);
+ }
+ index = index + value.position;
+ return index;
+}
+function serializeSymbol(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_SYMBOL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value.value, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path) {
+ buffer[index++] = BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ let output = {
+ $ref: value.collection || value.namespace,
+ $id: value.oid
+ };
+ if (value.db != null) {
+ output.$db = value.db;
+ }
+ output = Object.assign(output, value.fields);
+ const endIndex = serializeInto(buffer, output, false, index, depth + 1, serializeFunctions, true, path);
+ const size = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, index, size);
+ return endIndex;
+}
+function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path == null) {
+ if (object == null) {
+ buffer[0] = 0x05;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ buffer[4] = 0x00;
+ return 5;
+ }
+ if (Array.isArray(object)) {
+ throw new BSONError('serialize does not support an array as the root input');
+ }
+ if (typeof object !== 'object') {
+ throw new BSONError('serialize does not support non-object as the root input');
+ }
+ else if ('_bsontype' in object && typeof object._bsontype === 'string') {
+ throw new BSONError(`BSON types cannot be serialized as a document`);
+ }
+ else if (isDate(object) ||
+ isRegExp(object) ||
+ isUint8Array(object) ||
+ isAnyArrayBuffer(object)) {
+ throw new BSONError(`date, regexp, typedarray, and arraybuffer cannot be BSON documents`);
+ }
+ path = new Set();
+ }
+ path.add(object);
+ let index = startingIndex + 4;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ const key = `${i}`;
+ let value = object[i];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (value === undefined) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else if (object instanceof Map || isMap(object)) {
+ const iterator = object.entries();
+ let done = false;
+ while (!done) {
+ const entry = iterator.next();
+ done = !!entry.done;
+ if (done)
+ continue;
+ const key = entry.value ? entry.value[0] : undefined;
+ let value = entry.value ? entry.value[1] : undefined;
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ if (object != null && typeof object !== 'object') {
+ throw new BSONError('toBSON function did not return an object');
+ }
+ }
+ for (const key of Object.keys(object)) {
+ let value = object[key];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ path.delete(object);
+ buffer[index++] = 0x00;
+ const size = index - startingIndex;
+ startingIndex += NumberUtils.setInt32LE(buffer, startingIndex, size);
+ return index;
+}
+
+function isBSONType(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '_bsontype' in value &&
+ typeof value._bsontype === 'string');
+}
+const keysToCodecs = {
+ $oid: ObjectId,
+ $binary: Binary,
+ $uuid: Binary,
+ $symbol: BSONSymbol,
+ $numberInt: Int32,
+ $numberDecimal: Decimal128,
+ $numberDouble: Double,
+ $numberLong: Long,
+ $minKey: MinKey,
+ $maxKey: MaxKey,
+ $regex: BSONRegExp,
+ $regularExpression: BSONRegExp,
+ $timestamp: Timestamp
+};
+function deserializeValue(value, options = {}) {
+ if (typeof value === 'number') {
+ const in32BitRange = value <= BSON_INT32_MAX && value >= BSON_INT32_MIN;
+ const in64BitRange = value <= BSON_INT64_MAX && value >= BSON_INT64_MIN;
+ if (options.relaxed || options.legacy) {
+ return value;
+ }
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (in32BitRange) {
+ return new Int32(value);
+ }
+ if (in64BitRange) {
+ if (options.useBigInt64) {
+ return BigInt(value);
+ }
+ return Long.fromNumber(value);
+ }
+ }
+ return new Double(value);
+ }
+ if (value == null || typeof value !== 'object')
+ return value;
+ if (value.$undefined)
+ return null;
+ const keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);
+ for (let i = 0; i < keys.length; i++) {
+ const c = keysToCodecs[keys[i]];
+ if (c)
+ return c.fromExtendedJSON(value, options);
+ }
+ if (value.$date != null) {
+ const d = value.$date;
+ const date = new Date();
+ if (options.legacy) {
+ if (typeof d === 'number')
+ date.setTime(d);
+ else if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ else {
+ if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (Long.isLong(d))
+ date.setTime(d.toNumber());
+ else if (typeof d === 'number' && options.relaxed)
+ date.setTime(d);
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ return date;
+ }
+ if (value.$code != null) {
+ const copy = Object.assign({}, value);
+ if (value.$scope) {
+ copy.$scope = deserializeValue(value.$scope);
+ }
+ return Code.fromExtendedJSON(value);
+ }
+ if (isDBRefLike(value) || value.$dbPointer) {
+ const v = value.$ref ? value : value.$dbPointer;
+ if (v instanceof DBRef)
+ return v;
+ const dollarKeys = Object.keys(v).filter(k => k.startsWith('$'));
+ let valid = true;
+ dollarKeys.forEach(k => {
+ if (['$ref', '$id', '$db'].indexOf(k) === -1)
+ valid = false;
+ });
+ if (valid)
+ return DBRef.fromExtendedJSON(v);
+ }
+ return value;
+}
+function serializeArray(array, options) {
+ return array.map((v, index) => {
+ options.seenObjects.push({ propertyName: `index ${index}`, obj: null });
+ try {
+ return serializeValue(v, options);
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ });
+}
+function getISOString(date) {
+ const isoStr = date.toISOString();
+ return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';
+}
+function serializeValue(value, options) {
+ if (value instanceof Map || isMap(value)) {
+ const obj = Object.create(null);
+ for (const [k, v] of value) {
+ if (typeof k !== 'string') {
+ throw new BSONError('Can only serialize maps with string keys');
+ }
+ obj[k] = v;
+ }
+ return serializeValue(obj, options);
+ }
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null) {
+ const index = options.seenObjects.findIndex(entry => entry.obj === value);
+ if (index !== -1) {
+ const props = options.seenObjects.map(entry => entry.propertyName);
+ const leadingPart = props
+ .slice(0, index)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const alreadySeen = props[index];
+ const circularPart = ' -> ' +
+ props
+ .slice(index + 1, props.length - 1)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const current = props[props.length - 1];
+ const leadingSpace = ' '.repeat(leadingPart.length + alreadySeen.length / 2);
+ const dashes = '-'.repeat(circularPart.length + (alreadySeen.length + current.length) / 2 - 1);
+ throw new BSONError('Converting circular structure to EJSON:\n' +
+ ` ${leadingPart}${alreadySeen}${circularPart}${current}\n` +
+ ` ${leadingSpace}\\${dashes}/`);
+ }
+ options.seenObjects[options.seenObjects.length - 1].obj = value;
+ }
+ if (Array.isArray(value))
+ return serializeArray(value, options);
+ if (value === undefined)
+ return options.ignoreUndefined ? undefined : null;
+ if (value instanceof Date || isDate(value)) {
+ const dateNum = value.getTime(), inRange = dateNum > -1 && dateNum < 253402318800000;
+ if (options.legacy) {
+ return options.relaxed && inRange
+ ? { $date: value.getTime() }
+ : { $date: getISOString(value) };
+ }
+ return options.relaxed && inRange
+ ? { $date: getISOString(value) }
+ : { $date: { $numberLong: value.getTime().toString() } };
+ }
+ if (typeof value === 'number' && (!options.relaxed || !isFinite(value))) {
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return { $numberInt: value.toString() };
+ }
+ if (value >= BSON_INT64_MIN && value <= BSON_INT64_MAX) {
+ return { $numberLong: value.toString() };
+ }
+ }
+ return { $numberDouble: Object.is(value, -0) ? '-0.0' : value.toString() };
+ }
+ if (typeof value === 'bigint') {
+ if (!options.relaxed) {
+ return { $numberLong: BigInt.asIntN(64, value).toString() };
+ }
+ return Number(BigInt.asIntN(64, value));
+ }
+ if (value instanceof RegExp || isRegExp(value)) {
+ let flags = value.flags;
+ if (flags === undefined) {
+ const match = value.toString().match(/[gimuy]*$/);
+ if (match) {
+ flags = match[0];
+ }
+ }
+ const rx = new BSONRegExp(value.source, flags);
+ return rx.toExtendedJSON(options);
+ }
+ if (value != null && typeof value === 'object')
+ return serializeDocument(value, options);
+ return value;
+}
+const BSON_TYPE_MAPPINGS = {
+ Binary: (o) => new Binary(o.value(), o.sub_type),
+ Code: (o) => new Code(o.code, o.scope),
+ DBRef: (o) => new DBRef(o.collection || o.namespace, o.oid, o.db, o.fields),
+ Decimal128: (o) => new Decimal128(o.bytes),
+ Double: (o) => new Double(o.value),
+ Int32: (o) => new Int32(o.value),
+ 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_),
+ MaxKey: () => new MaxKey(),
+ MinKey: () => new MinKey(),
+ ObjectId: (o) => new ObjectId(o),
+ BSONRegExp: (o) => new BSONRegExp(o.pattern, o.options),
+ BSONSymbol: (o) => new BSONSymbol(o.value),
+ Timestamp: (o) => Timestamp.fromBits(o.low, o.high)
+};
+function serializeDocument(doc, options) {
+ if (doc == null || typeof doc !== 'object')
+ throw new BSONError('not an object instance');
+ const bsontype = doc._bsontype;
+ if (typeof bsontype === 'undefined') {
+ const _doc = {};
+ for (const name of Object.keys(doc)) {
+ options.seenObjects.push({ propertyName: name, obj: null });
+ try {
+ const value = serializeValue(doc[name], options);
+ if (name === '__proto__') {
+ Object.defineProperty(_doc, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ _doc[name] = value;
+ }
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ }
+ return _doc;
+ }
+ else if (doc != null &&
+ typeof doc === 'object' &&
+ typeof doc._bsontype === 'string' &&
+ doc[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (isBSONType(doc)) {
+ let outDoc = doc;
+ if (typeof outDoc.toExtendedJSON !== 'function') {
+ const mapper = BSON_TYPE_MAPPINGS[doc._bsontype];
+ if (!mapper) {
+ throw new BSONError('Unrecognized or invalid _bsontype: ' + doc._bsontype);
+ }
+ outDoc = mapper(outDoc);
+ }
+ if (bsontype === 'Code' && outDoc.scope) {
+ outDoc = new Code(outDoc.code, serializeValue(outDoc.scope, options));
+ }
+ else if (bsontype === 'DBRef' && outDoc.oid) {
+ outDoc = new DBRef(serializeValue(outDoc.collection, options), serializeValue(outDoc.oid, options), serializeValue(outDoc.db, options), serializeValue(outDoc.fields, options));
+ }
+ return outDoc.toExtendedJSON(options);
+ }
+ else {
+ throw new BSONError('_bsontype must be a string, but was: ' + typeof bsontype);
+ }
+}
+function parse(text, options) {
+ const ejsonOptions = {
+ useBigInt64: options?.useBigInt64 ?? false,
+ relaxed: options?.relaxed ?? true,
+ legacy: options?.legacy ?? false
+ };
+ return JSON.parse(text, (key, value) => {
+ if (key.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Document field names cannot contain null bytes, found: ${JSON.stringify(key)}`);
+ }
+ return deserializeValue(value, ejsonOptions);
+ });
+}
+function stringify(value, replacer, space, options) {
+ if (space != null && typeof space === 'object') {
+ options = space;
+ space = 0;
+ }
+ if (replacer != null && typeof replacer === 'object' && !Array.isArray(replacer)) {
+ options = replacer;
+ replacer = undefined;
+ space = 0;
+ }
+ const serializeOptions = Object.assign({ relaxed: true, legacy: false }, options, {
+ seenObjects: [{ propertyName: '(root)', obj: null }]
+ });
+ const doc = serializeValue(value, serializeOptions);
+ return JSON.stringify(doc, replacer, space);
+}
+function EJSONserialize(value, options) {
+ options = options || {};
+ return JSON.parse(stringify(value, options));
+}
+function EJSONdeserialize(ejson, options) {
+ options = options || {};
+ return parse(JSON.stringify(ejson), options);
+}
+const EJSON = Object.create(null);
+EJSON.parse = parse;
+EJSON.stringify = stringify;
+EJSON.serialize = EJSONserialize;
+EJSON.deserialize = EJSONdeserialize;
+Object.freeze(EJSON);
+
+const BSONElementType = {
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: 255,
+ maxKey: 127
+};
+function getSize(source, offset) {
+ try {
+ return NumberUtils.getNonnegativeInt32LE(source, offset);
+ }
+ catch (cause) {
+ throw new BSONOffsetError('BSON size cannot be negative', offset, { cause });
+ }
+}
+function findNull(bytes, offset) {
+ let nullTerminatorOffset = offset;
+ for (; bytes[nullTerminatorOffset] !== 0x00; nullTerminatorOffset++)
+ ;
+ if (nullTerminatorOffset === bytes.length - 1) {
+ throw new BSONOffsetError('Null terminator not found', offset);
+ }
+ return nullTerminatorOffset;
+}
+function parseToElements(bytes, startOffset = 0) {
+ startOffset ??= 0;
+ if (bytes.length < 5) {
+ throw new BSONOffsetError(`Input must be at least 5 bytes, got ${bytes.length} bytes`, startOffset);
+ }
+ const documentSize = getSize(bytes, startOffset);
+ if (documentSize > bytes.length - startOffset) {
+ throw new BSONOffsetError(`Parsed documentSize (${documentSize} bytes) does not match input length (${bytes.length} bytes)`, startOffset);
+ }
+ if (bytes[startOffset + documentSize - 1] !== 0x00) {
+ throw new BSONOffsetError('BSON documents must end in 0x00', startOffset + documentSize);
+ }
+ const elements = [];
+ let offset = startOffset + 4;
+ while (offset <= documentSize + startOffset) {
+ const type = bytes[offset];
+ offset += 1;
+ if (type === 0) {
+ if (offset - startOffset !== documentSize) {
+ throw new BSONOffsetError(`Invalid 0x00 type byte`, offset);
+ }
+ break;
+ }
+ const nameOffset = offset;
+ const nameLength = findNull(bytes, offset) - nameOffset;
+ offset += nameLength + 1;
+ let length;
+ if (type === BSONElementType.double ||
+ type === BSONElementType.long ||
+ type === BSONElementType.date ||
+ type === BSONElementType.timestamp) {
+ length = 8;
+ }
+ else if (type === BSONElementType.int) {
+ length = 4;
+ }
+ else if (type === BSONElementType.objectId) {
+ length = 12;
+ }
+ else if (type === BSONElementType.decimal) {
+ length = 16;
+ }
+ else if (type === BSONElementType.bool) {
+ length = 1;
+ }
+ else if (type === BSONElementType.null ||
+ type === BSONElementType.undefined ||
+ type === BSONElementType.maxKey ||
+ type === BSONElementType.minKey) {
+ length = 0;
+ }
+ else if (type === BSONElementType.regex) {
+ length = findNull(bytes, findNull(bytes, offset) + 1) + 1 - offset;
+ }
+ else if (type === BSONElementType.object ||
+ type === BSONElementType.array ||
+ type === BSONElementType.javascriptWithScope) {
+ length = getSize(bytes, offset);
+ }
+ else if (type === BSONElementType.string ||
+ type === BSONElementType.binData ||
+ type === BSONElementType.dbPointer ||
+ type === BSONElementType.javascript ||
+ type === BSONElementType.symbol) {
+ length = getSize(bytes, offset) + 4;
+ if (type === BSONElementType.binData) {
+ length += 1;
+ }
+ if (type === BSONElementType.dbPointer) {
+ length += 12;
+ }
+ }
+ else {
+ throw new BSONOffsetError(`Invalid 0x${type.toString(16).padStart(2, '0')} type byte`, offset);
+ }
+ if (length > documentSize) {
+ throw new BSONOffsetError('value reports length larger than document', offset);
+ }
+ elements.push([type, nameOffset, nameLength, offset, length]);
+ offset += length;
+ }
+ return elements;
+}
+
+const onDemand = Object.create(null);
+onDemand.parseToElements = parseToElements;
+onDemand.ByteUtils = ByteUtils;
+onDemand.NumberUtils = NumberUtils;
+Object.freeze(onDemand);
+
+const MAXSIZE = 1024 * 1024 * 17;
+let buffer = ByteUtils.allocate(MAXSIZE);
+function setInternalBufferSize(size) {
+ if (buffer.length < size) {
+ buffer = ByteUtils.allocate(size);
+ }
+}
+function serialize(object, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const minInternalBufferSize = typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE;
+ if (buffer.length < minInternalBufferSize) {
+ buffer = ByteUtils.allocate(minInternalBufferSize);
+ }
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ const finishedBuffer = ByteUtils.allocateUnsafe(serializationIndex);
+ finishedBuffer.set(buffer.subarray(0, serializationIndex), 0);
+ return finishedBuffer;
+}
+function serializeWithBufferAndIndex(object, finalBuffer, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const startIndex = typeof options.index === 'number' ? options.index : 0;
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ finalBuffer.set(buffer.subarray(0, serializationIndex), startIndex);
+ return startIndex + serializationIndex - 1;
+}
+function deserialize(buffer, options = {}) {
+ return internalDeserialize(ByteUtils.toLocalBufferType(buffer), options);
+}
+function calculateObjectSize(object, options = {}) {
+ options = options || {};
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ return internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined);
+}
+function deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {
+ const internalOptions = Object.assign({ allowObjectSmallerThanBufferSize: true, index: 0 }, options);
+ const bufferData = ByteUtils.toLocalBufferType(data);
+ let index = startIndex;
+ for (let i = 0; i < numberOfDocuments; i++) {
+ const size = NumberUtils.getInt32LE(bufferData, index);
+ internalOptions.index = index;
+ documents[docStartIndex + i] = internalDeserialize(bufferData, internalOptions);
+ index = index + size;
+ }
+ return index;
+}
+
+var bson = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ BSONError: BSONError,
+ BSONOffsetError: BSONOffsetError,
+ BSONRegExp: BSONRegExp,
+ BSONRuntimeError: BSONRuntimeError,
+ BSONSymbol: BSONSymbol,
+ BSONType: BSONType,
+ BSONValue: BSONValue,
+ BSONVersionError: BSONVersionError,
+ Binary: Binary,
+ ByteUtils: ByteUtils,
+ Code: Code,
+ DBRef: DBRef,
+ Decimal128: Decimal128,
+ Double: Double,
+ EJSON: EJSON,
+ Int32: Int32,
+ Long: Long,
+ MaxKey: MaxKey,
+ MinKey: MinKey,
+ NumberUtils: NumberUtils,
+ ObjectId: ObjectId,
+ Timestamp: Timestamp,
+ UUID: UUID,
+ bsonType: bsonType,
+ calculateObjectSize: calculateObjectSize,
+ deserialize: deserialize,
+ deserializeStream: deserializeStream,
+ onDemand: onDemand,
+ serialize: serialize,
+ serializeWithBufferAndIndex: serializeWithBufferAndIndex,
+ setInternalBufferSize: setInternalBufferSize
+});
+
+exports.BSON = bson;
+exports.BSONError = BSONError;
+exports.BSONOffsetError = BSONOffsetError;
+exports.BSONRegExp = BSONRegExp;
+exports.BSONRuntimeError = BSONRuntimeError;
+exports.BSONSymbol = BSONSymbol;
+exports.BSONType = BSONType;
+exports.BSONValue = BSONValue;
+exports.BSONVersionError = BSONVersionError;
+exports.Binary = Binary;
+exports.ByteUtils = ByteUtils;
+exports.Code = Code;
+exports.DBRef = DBRef;
+exports.Decimal128 = Decimal128;
+exports.Double = Double;
+exports.EJSON = EJSON;
+exports.Int32 = Int32;
+exports.Long = Long;
+exports.MaxKey = MaxKey;
+exports.MinKey = MinKey;
+exports.NumberUtils = NumberUtils;
+exports.ObjectId = ObjectId;
+exports.Timestamp = Timestamp;
+exports.UUID = UUID;
+exports.bsonType = bsonType;
+exports.calculateObjectSize = calculateObjectSize;
+exports.deserialize = deserialize;
+exports.deserializeStream = deserializeStream;
+exports.onDemand = onDemand;
+exports.serialize = serialize;
+exports.serializeWithBufferAndIndex = serializeWithBufferAndIndex;
+exports.setInternalBufferSize = setInternalBufferSize;
+//# sourceMappingURL=bson.cjs.map
diff --git a/node_modules/bson/lib/bson.cjs.map b/node_modules/bson/lib/bson.cjs.map
new file mode 100644
index 00000000..a23d60cf
--- /dev/null
+++ b/node_modules/bson/lib/bson.cjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"bson.cjs","sources":["../src/parser/utils.ts","../src/constants.ts","../src/error.ts","../src/parse_utf8.ts","../src/utils/latin.ts","../src/utils/node_byte_utils.ts","../src/utils/web_byte_utils.ts","../src/utils/byte_utils.ts","../src/bson_value.ts","../src/utils/number_utils.ts","../src/binary.ts","../src/code.ts","../src/db_ref.ts","../src/utils/string_utils.ts","../src/long.ts","../src/decimal128.ts","../src/double.ts","../src/int_32.ts","../src/max_key.ts","../src/min_key.ts","../src/objectid.ts","../src/parser/calculate_size.ts","../src/regexp.ts","../src/symbol.ts","../src/timestamp.ts","../src/parser/deserializer.ts","../src/parser/serializer.ts","../src/extended_json.ts","../src/parser/on_demand/parse_to_elements.ts","../src/parser/on_demand/index.ts","../src/bson.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["StringUtils.validateStringCharacters","StringUtils.removeLeadingZerosAndExplicitPlus","constants.JS_INT_MIN","constants.JS_INT_MAX","constants.BSON_INT32_MIN","constants.BSON_INT32_MAX","constants.BSON_VERSION_SYMBOL","constants.BSON_MAJOR_VERSION","constants.BSON_DATA_STRING","constants.BSON_DATA_OID","constants.BSON_DATA_INT","constants.BSON_DATA_NUMBER","constants.BSON_DATA_DATE","constants.BSON_DATA_BOOLEAN","constants.BSON_DATA_OBJECT","constants.BSON_DATA_ARRAY","constants.BSON_DATA_UNDEFINED","constants.BSON_DATA_NULL","constants.BSON_DATA_LONG","constants.BSON_DATA_DECIMAL128","constants.BSON_DATA_BINARY","constants.BSON_BINARY_SUBTYPE_UUID_NEW","constants.BSON_DATA_REGEXP","constants.BSON_DATA_SYMBOL","constants.BSON_DATA_TIMESTAMP","constants.BSON_DATA_MIN_KEY","constants.BSON_DATA_MAX_KEY","constants.BSON_DATA_CODE","constants.BSON_DATA_CODE_W_SCOPE","constants.BSON_DATA_DBPOINTER","constants.BSON_BINARY_SUBTYPE_DEFAULT"],"mappings":";;AAAA,MAAM,uCAAuC,GAAG,CAAC,MAAK;IAIpD,MAAM,CAAC,GAAG,MAAM,CAAC,wBAAwB,CACvC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAC3C,MAAM,CAAC,WAAW,CAClB,CAAC,GAAI;IAEP,OAAO,CAAC,KAAc,KAAK,CAAC,CAAC,IAAI,CA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BAA2B,CAAC,MAAM,EAAE,kBAAkB,EAAE,eAAe,CAAC;AACjF;AAcM,SAAU,iBAAiB,CAC/B,IAA8B,EAC9B,UAAkB,EAClB,iBAAyB,EACzB,SAAqB,EACrB,aAAqB,EACrB,OAA2B,EAAA;AAE3B,IAAA,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,EAAE,gCAAgC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,EACpD,OAAO,CACR;IACD,MAAM,UAAU,GAAG,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC;IAEpD,IAAI,KAAK,GAAG,UAAU;AAEtB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,EAAE,CAAC,EAAE,EAAE;QAE1C,MAAM,IAAI,GAAG,WAAW,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC;AAEtD,QAAA,eAAe,CAAC,KAAK,GAAG,KAAK;AAE7B,QAAA,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC,GAAG,mBAAmB,CAAC,UAAU,EAAE,eAAe,CAAC;AAE/E,QAAA,KAAK,GAAG,KAAK,GAAG,IAAI;IACtB;AAGA,IAAA,OAAO,KAAK;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/node_modules/bson/lib/bson.mjs b/node_modules/bson/lib/bson.mjs
new file mode 100644
index 00000000..ce08cf0d
--- /dev/null
+++ b/node_modules/bson/lib/bson.mjs
@@ -0,0 +1,4712 @@
+const TypedArrayPrototypeGetSymbolToStringTag = (() => {
+ const g = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get;
+ return (value) => g.call(value);
+})();
+function isUint8Array(value) {
+ return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array';
+}
+function isAnyArrayBuffer(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ (value[Symbol.toStringTag] === 'ArrayBuffer' ||
+ value[Symbol.toStringTag] === 'SharedArrayBuffer'));
+}
+function isRegExp(regexp) {
+ return regexp instanceof RegExp || Object.prototype.toString.call(regexp) === '[object RegExp]';
+}
+function isMap(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ value[Symbol.toStringTag] === 'Map');
+}
+function isDate(date) {
+ return date instanceof Date || Object.prototype.toString.call(date) === '[object Date]';
+}
+function defaultInspect(x, _options) {
+ return JSON.stringify(x, (k, v) => {
+ if (typeof v === 'bigint') {
+ return { $numberLong: `${v}` };
+ }
+ else if (isMap(v)) {
+ return Object.fromEntries(v);
+ }
+ return v;
+ });
+}
+function getStylizeFunction(options) {
+ const stylizeExists = options != null &&
+ typeof options === 'object' &&
+ 'stylize' in options &&
+ typeof options.stylize === 'function';
+ if (stylizeExists) {
+ return options.stylize;
+ }
+}
+
+const BSON_MAJOR_VERSION = 7;
+const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version');
+const BSON_INT32_MAX = 0x7fffffff;
+const BSON_INT32_MIN = -2147483648;
+const BSON_INT64_MAX = Math.pow(2, 63) - 1;
+const BSON_INT64_MIN = -Math.pow(2, 63);
+const JS_INT_MAX = Math.pow(2, 53);
+const JS_INT_MIN = -Math.pow(2, 53);
+const BSON_DATA_NUMBER = 1;
+const BSON_DATA_STRING = 2;
+const BSON_DATA_OBJECT = 3;
+const BSON_DATA_ARRAY = 4;
+const BSON_DATA_BINARY = 5;
+const BSON_DATA_UNDEFINED = 6;
+const BSON_DATA_OID = 7;
+const BSON_DATA_BOOLEAN = 8;
+const BSON_DATA_DATE = 9;
+const BSON_DATA_NULL = 10;
+const BSON_DATA_REGEXP = 11;
+const BSON_DATA_DBPOINTER = 12;
+const BSON_DATA_CODE = 13;
+const BSON_DATA_SYMBOL = 14;
+const BSON_DATA_CODE_W_SCOPE = 15;
+const BSON_DATA_INT = 16;
+const BSON_DATA_TIMESTAMP = 17;
+const BSON_DATA_LONG = 18;
+const BSON_DATA_DECIMAL128 = 19;
+const BSON_DATA_MIN_KEY = 0xff;
+const BSON_DATA_MAX_KEY = 0x7f;
+const BSON_BINARY_SUBTYPE_DEFAULT = 0;
+const BSON_BINARY_SUBTYPE_UUID_NEW = 4;
+const BSONType = Object.freeze({
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: -1,
+ maxKey: 127
+});
+
+class BSONError extends Error {
+ get bsonError() {
+ return true;
+ }
+ get name() {
+ return 'BSONError';
+ }
+ constructor(message, options) {
+ super(message, options);
+ }
+ static isBSONError(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ 'bsonError' in value &&
+ value.bsonError === true &&
+ 'name' in value &&
+ 'message' in value &&
+ 'stack' in value);
+ }
+}
+class BSONVersionError extends BSONError {
+ get name() {
+ return 'BSONVersionError';
+ }
+ constructor() {
+ super(`Unsupported BSON version, bson types must be from bson ${BSON_MAJOR_VERSION}.x.x`);
+ }
+}
+class BSONRuntimeError extends BSONError {
+ get name() {
+ return 'BSONRuntimeError';
+ }
+ constructor(message) {
+ super(message);
+ }
+}
+class BSONOffsetError extends BSONError {
+ get name() {
+ return 'BSONOffsetError';
+ }
+ offset;
+ constructor(message, offset, options) {
+ super(`${message}. offset: ${offset}`, options);
+ this.offset = offset;
+ }
+}
+
+let TextDecoderFatal;
+let TextDecoderNonFatal;
+function parseUtf8(buffer, start, end, fatal) {
+ if (fatal) {
+ TextDecoderFatal ??= new TextDecoder('utf8', { fatal: true });
+ try {
+ return TextDecoderFatal.decode(buffer.subarray(start, end));
+ }
+ catch (cause) {
+ throw new BSONError('Invalid UTF-8 string in BSON document', { cause });
+ }
+ }
+ TextDecoderNonFatal ??= new TextDecoder('utf8', { fatal: false });
+ return TextDecoderNonFatal.decode(buffer.subarray(start, end));
+}
+
+function tryReadBasicLatin(uint8array, start, end) {
+ if (uint8array.length === 0) {
+ return '';
+ }
+ const stringByteLength = end - start;
+ if (stringByteLength === 0) {
+ return '';
+ }
+ if (stringByteLength > 20) {
+ return null;
+ }
+ if (stringByteLength === 1 && uint8array[start] < 128) {
+ return String.fromCharCode(uint8array[start]);
+ }
+ if (stringByteLength === 2 && uint8array[start] < 128 && uint8array[start + 1] < 128) {
+ return String.fromCharCode(uint8array[start]) + String.fromCharCode(uint8array[start + 1]);
+ }
+ if (stringByteLength === 3 &&
+ uint8array[start] < 128 &&
+ uint8array[start + 1] < 128 &&
+ uint8array[start + 2] < 128) {
+ return (String.fromCharCode(uint8array[start]) +
+ String.fromCharCode(uint8array[start + 1]) +
+ String.fromCharCode(uint8array[start + 2]));
+ }
+ const latinBytes = [];
+ for (let i = start; i < end; i++) {
+ const byte = uint8array[i];
+ if (byte > 127) {
+ return null;
+ }
+ latinBytes.push(byte);
+ }
+ return String.fromCharCode(...latinBytes);
+}
+function tryWriteBasicLatin(destination, source, offset) {
+ if (source.length === 0)
+ return 0;
+ if (source.length > 25)
+ return null;
+ if (destination.length - offset < source.length)
+ return null;
+ for (let charOffset = 0, destinationOffset = offset; charOffset < source.length; charOffset++, destinationOffset++) {
+ const char = source.charCodeAt(charOffset);
+ if (char > 127)
+ return null;
+ destination[destinationOffset] = char;
+ }
+ return source.length;
+}
+
+function nodejsMathRandomBytes(byteLength) {
+ return nodeJsByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+function nodejsSecureRandomBytes(byteLength) {
+ return crypto.getRandomValues(nodeJsByteUtils.allocate(byteLength));
+}
+const nodejsRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return nodejsSecureRandomBytes;
+ }
+ else {
+ return nodejsMathRandomBytes;
+ }
+})();
+const nodeJsByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialBuffer) {
+ if (Buffer.isBuffer(potentialBuffer)) {
+ return potentialBuffer;
+ }
+ if (ArrayBuffer.isView(potentialBuffer)) {
+ return Buffer.from(potentialBuffer.buffer, potentialBuffer.byteOffset, potentialBuffer.byteLength);
+ }
+ const stringTag = potentialBuffer?.[Symbol.toStringTag] ?? Object.prototype.toString.call(potentialBuffer);
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return Buffer.from(potentialBuffer);
+ }
+ throw new BSONError(`Cannot create Buffer from the passed potentialBuffer.`);
+ },
+ allocate(size) {
+ return Buffer.alloc(size);
+ },
+ allocateUnsafe(size) {
+ return Buffer.allocUnsafe(size);
+ },
+ compare(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).compare(b);
+ },
+ concat(list) {
+ return Buffer.concat(list);
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ return nodeJsByteUtils
+ .toLocalBufferType(source)
+ .copy(target, targetStart ?? 0, sourceStart ?? 0, sourceEnd ?? source.length);
+ },
+ equals(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).equals(b);
+ },
+ fromNumberArray(array) {
+ return Buffer.from(array);
+ },
+ fromBase64(base64) {
+ return Buffer.from(base64, 'base64');
+ },
+ fromUTF8(utf8) {
+ return Buffer.from(utf8, 'utf8');
+ },
+ toBase64(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('base64');
+ },
+ fromISO88591(codePoints) {
+ return Buffer.from(codePoints, 'binary');
+ },
+ toISO88591(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('binary');
+ },
+ fromHex(hex) {
+ return Buffer.from(hex, 'hex');
+ },
+ toHex(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('hex');
+ },
+ toUTF8(buffer, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(buffer, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ const string = nodeJsByteUtils.toLocalBufferType(buffer).toString('utf8', start, end);
+ if (fatal) {
+ for (let i = 0; i < string.length; i++) {
+ if (string.charCodeAt(i) === 0xfffd) {
+ parseUtf8(buffer, start, end, true);
+ break;
+ }
+ }
+ }
+ return string;
+ },
+ utf8ByteLength(input) {
+ return Buffer.byteLength(input, 'utf8');
+ },
+ encodeUTF8Into(buffer, source, byteOffset) {
+ const latinBytesWritten = tryWriteBasicLatin(buffer, source, byteOffset);
+ if (latinBytesWritten != null) {
+ return latinBytesWritten;
+ }
+ return nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8');
+ },
+ randomBytes: nodejsRandomBytes,
+ swap32(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).swap32();
+ }
+};
+
+function isReactNative() {
+ const { navigator } = globalThis;
+ return typeof navigator === 'object' && navigator.product === 'ReactNative';
+}
+function webMathRandomBytes(byteLength) {
+ if (byteLength < 0) {
+ throw new RangeError(`The argument 'byteLength' is invalid. Received ${byteLength}`);
+ }
+ return webByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+const webRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return (byteLength) => {
+ return crypto.getRandomValues(webByteUtils.allocate(byteLength));
+ };
+ }
+ else {
+ if (isReactNative()) {
+ const { console } = globalThis;
+ console?.warn?.('BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.');
+ }
+ return webMathRandomBytes;
+ }
+})();
+const HEX_DIGIT = /(\d|[a-f])/i;
+const webByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialUint8array) {
+ const stringTag = potentialUint8array?.[Symbol.toStringTag] ??
+ Object.prototype.toString.call(potentialUint8array);
+ if (stringTag === 'Uint8Array') {
+ return potentialUint8array;
+ }
+ if (ArrayBuffer.isView(potentialUint8array)) {
+ return new Uint8Array(potentialUint8array.buffer.slice(potentialUint8array.byteOffset, potentialUint8array.byteOffset + potentialUint8array.byteLength));
+ }
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return new Uint8Array(potentialUint8array);
+ }
+ throw new BSONError(`Cannot make a Uint8Array from passed potentialBuffer.`);
+ },
+ allocate(size) {
+ if (typeof size !== 'number') {
+ throw new TypeError(`The "size" argument must be of type number. Received ${String(size)}`);
+ }
+ return new Uint8Array(size);
+ },
+ allocateUnsafe(size) {
+ return webByteUtils.allocate(size);
+ },
+ compare(uint8Array, otherUint8Array) {
+ if (uint8Array === otherUint8Array)
+ return 0;
+ const len = Math.min(uint8Array.length, otherUint8Array.length);
+ for (let i = 0; i < len; i++) {
+ if (uint8Array[i] < otherUint8Array[i])
+ return -1;
+ if (uint8Array[i] > otherUint8Array[i])
+ return 1;
+ }
+ if (uint8Array.length < otherUint8Array.length)
+ return -1;
+ if (uint8Array.length > otherUint8Array.length)
+ return 1;
+ return 0;
+ },
+ concat(uint8Arrays) {
+ if (uint8Arrays.length === 0)
+ return webByteUtils.allocate(0);
+ let totalLength = 0;
+ for (const uint8Array of uint8Arrays) {
+ totalLength += uint8Array.length;
+ }
+ const result = webByteUtils.allocate(totalLength);
+ let offset = 0;
+ for (const uint8Array of uint8Arrays) {
+ result.set(uint8Array, offset);
+ offset += uint8Array.length;
+ }
+ return result;
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ if (sourceEnd !== undefined && sourceEnd < 0) {
+ throw new RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${sourceEnd}`);
+ }
+ sourceEnd = sourceEnd ?? source.length;
+ if (sourceStart !== undefined && (sourceStart < 0 || sourceStart > sourceEnd)) {
+ throw new RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${sourceEnd}. Received ${sourceStart}`);
+ }
+ sourceStart = sourceStart ?? 0;
+ if (targetStart !== undefined && targetStart < 0) {
+ throw new RangeError(`The value of "targetStart" is out of range. It must be >= 0. Received ${targetStart}`);
+ }
+ targetStart = targetStart ?? 0;
+ const srcSlice = source.subarray(sourceStart, sourceEnd);
+ const maxLen = Math.min(srcSlice.length, target.length - targetStart);
+ if (maxLen <= 0) {
+ return 0;
+ }
+ target.set(srcSlice.subarray(0, maxLen), targetStart);
+ return maxLen;
+ },
+ equals(uint8Array, otherUint8Array) {
+ if (uint8Array.byteLength !== otherUint8Array.byteLength) {
+ return false;
+ }
+ for (let i = 0; i < uint8Array.byteLength; i++) {
+ if (uint8Array[i] !== otherUint8Array[i]) {
+ return false;
+ }
+ }
+ return true;
+ },
+ fromNumberArray(array) {
+ return Uint8Array.from(array);
+ },
+ fromBase64(base64) {
+ return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
+ },
+ fromUTF8(utf8) {
+ return new TextEncoder().encode(utf8);
+ },
+ toBase64(uint8array) {
+ return btoa(webByteUtils.toISO88591(uint8array));
+ },
+ fromISO88591(codePoints) {
+ return Uint8Array.from(codePoints, c => c.charCodeAt(0) & 0xff);
+ },
+ toISO88591(uint8array) {
+ return Array.from(Uint16Array.from(uint8array), b => String.fromCharCode(b)).join('');
+ },
+ fromHex(hex) {
+ const evenLengthHex = hex.length % 2 === 0 ? hex : hex.slice(0, hex.length - 1);
+ const buffer = [];
+ for (let i = 0; i < evenLengthHex.length; i += 2) {
+ const firstDigit = evenLengthHex[i];
+ const secondDigit = evenLengthHex[i + 1];
+ if (!HEX_DIGIT.test(firstDigit)) {
+ break;
+ }
+ if (!HEX_DIGIT.test(secondDigit)) {
+ break;
+ }
+ const hexDigit = Number.parseInt(`${firstDigit}${secondDigit}`, 16);
+ buffer.push(hexDigit);
+ }
+ return Uint8Array.from(buffer);
+ },
+ toHex(uint8array) {
+ return Array.from(uint8array, byte => byte.toString(16).padStart(2, '0')).join('');
+ },
+ toUTF8(uint8array, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(uint8array, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ return parseUtf8(uint8array, start, end, fatal);
+ },
+ utf8ByteLength(input) {
+ return new TextEncoder().encode(input).byteLength;
+ },
+ encodeUTF8Into(uint8array, source, byteOffset) {
+ const bytes = new TextEncoder().encode(source);
+ uint8array.set(bytes, byteOffset);
+ return bytes.byteLength;
+ },
+ randomBytes: webRandomBytes,
+ swap32(buffer) {
+ if (buffer.length % 4 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 32-bits');
+ }
+ for (let i = 0; i < buffer.length; i += 4) {
+ const byte0 = buffer[i];
+ const byte1 = buffer[i + 1];
+ const byte2 = buffer[i + 2];
+ const byte3 = buffer[i + 3];
+ buffer[i] = byte3;
+ buffer[i + 1] = byte2;
+ buffer[i + 2] = byte1;
+ buffer[i + 3] = byte0;
+ }
+ return buffer;
+ }
+};
+
+const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true;
+const ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
+
+const bsonType = Symbol.for('@@mdb.bson.type');
+class BSONValue {
+ get [bsonType]() {
+ return this._bsontype;
+ }
+ get [BSON_VERSION_SYMBOL]() {
+ return BSON_MAJOR_VERSION;
+ }
+ [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {
+ return this.inspect(depth, options, inspect);
+ }
+}
+
+const FLOAT = new Float64Array(1);
+const FLOAT_BYTES = new Uint8Array(FLOAT.buffer, 0, 8);
+FLOAT[0] = -1;
+const isBigEndian = FLOAT_BYTES[7] === 0;
+const NumberUtils = {
+ isBigEndian,
+ getNonnegativeInt32LE(source, offset) {
+ if (source[offset + 3] > 127) {
+ throw new RangeError(`Size cannot be negative at offset: ${offset}`);
+ }
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getInt32LE(source, offset) {
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getUint32LE(source, offset) {
+ return (source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ },
+ getUint32BE(source, offset) {
+ return (source[offset + 3] +
+ source[offset + 2] * 256 +
+ source[offset + 1] * 65536 +
+ source[offset] * 16777216);
+ },
+ getBigInt64LE(source, offset) {
+ const hi = BigInt(source[offset + 4] +
+ source[offset + 5] * 256 +
+ source[offset + 6] * 65536 +
+ (source[offset + 7] << 24));
+ const lo = BigInt(source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ return (hi << 32n) + lo;
+ },
+ getFloat64LE: isBigEndian
+ ? (source, offset) => {
+ FLOAT_BYTES[7] = source[offset];
+ FLOAT_BYTES[6] = source[offset + 1];
+ FLOAT_BYTES[5] = source[offset + 2];
+ FLOAT_BYTES[4] = source[offset + 3];
+ FLOAT_BYTES[3] = source[offset + 4];
+ FLOAT_BYTES[2] = source[offset + 5];
+ FLOAT_BYTES[1] = source[offset + 6];
+ FLOAT_BYTES[0] = source[offset + 7];
+ return FLOAT[0];
+ }
+ : (source, offset) => {
+ FLOAT_BYTES[0] = source[offset];
+ FLOAT_BYTES[1] = source[offset + 1];
+ FLOAT_BYTES[2] = source[offset + 2];
+ FLOAT_BYTES[3] = source[offset + 3];
+ FLOAT_BYTES[4] = source[offset + 4];
+ FLOAT_BYTES[5] = source[offset + 5];
+ FLOAT_BYTES[6] = source[offset + 6];
+ FLOAT_BYTES[7] = source[offset + 7];
+ return FLOAT[0];
+ },
+ setInt32BE(destination, offset, value) {
+ destination[offset + 3] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset] = value;
+ return 4;
+ },
+ setInt32LE(destination, offset, value) {
+ destination[offset] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 3] = value;
+ return 4;
+ },
+ setBigInt64LE(destination, offset, value) {
+ const mask32bits = 0xffffffffn;
+ let lo = Number(value & mask32bits);
+ destination[offset] = lo;
+ lo >>= 8;
+ destination[offset + 1] = lo;
+ lo >>= 8;
+ destination[offset + 2] = lo;
+ lo >>= 8;
+ destination[offset + 3] = lo;
+ let hi = Number((value >> 32n) & mask32bits);
+ destination[offset + 4] = hi;
+ hi >>= 8;
+ destination[offset + 5] = hi;
+ hi >>= 8;
+ destination[offset + 6] = hi;
+ hi >>= 8;
+ destination[offset + 7] = hi;
+ return 8;
+ },
+ setFloat64LE: isBigEndian
+ ? (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[7];
+ destination[offset + 1] = FLOAT_BYTES[6];
+ destination[offset + 2] = FLOAT_BYTES[5];
+ destination[offset + 3] = FLOAT_BYTES[4];
+ destination[offset + 4] = FLOAT_BYTES[3];
+ destination[offset + 5] = FLOAT_BYTES[2];
+ destination[offset + 6] = FLOAT_BYTES[1];
+ destination[offset + 7] = FLOAT_BYTES[0];
+ return 8;
+ }
+ : (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[0];
+ destination[offset + 1] = FLOAT_BYTES[1];
+ destination[offset + 2] = FLOAT_BYTES[2];
+ destination[offset + 3] = FLOAT_BYTES[3];
+ destination[offset + 4] = FLOAT_BYTES[4];
+ destination[offset + 5] = FLOAT_BYTES[5];
+ destination[offset + 6] = FLOAT_BYTES[6];
+ destination[offset + 7] = FLOAT_BYTES[7];
+ return 8;
+ }
+};
+
+class Binary extends BSONValue {
+ get _bsontype() {
+ return 'Binary';
+ }
+ static BSON_BINARY_SUBTYPE_DEFAULT = 0;
+ static BUFFER_SIZE = 256;
+ static SUBTYPE_DEFAULT = 0;
+ static SUBTYPE_FUNCTION = 1;
+ static SUBTYPE_BYTE_ARRAY = 2;
+ static SUBTYPE_UUID_OLD = 3;
+ static SUBTYPE_UUID = 4;
+ static SUBTYPE_MD5 = 5;
+ static SUBTYPE_ENCRYPTED = 6;
+ static SUBTYPE_COLUMN = 7;
+ static SUBTYPE_SENSITIVE = 8;
+ static SUBTYPE_VECTOR = 9;
+ static SUBTYPE_USER_DEFINED = 128;
+ static VECTOR_TYPE = Object.freeze({
+ Int8: 0x03,
+ Float32: 0x27,
+ PackedBit: 0x10
+ });
+ buffer;
+ sub_type;
+ position;
+ constructor(buffer, subType) {
+ super();
+ if (!(buffer == null) &&
+ typeof buffer === 'string' &&
+ !ArrayBuffer.isView(buffer) &&
+ !isAnyArrayBuffer(buffer) &&
+ !Array.isArray(buffer)) {
+ throw new BSONError('Binary can only be constructed from Uint8Array or number[]');
+ }
+ this.sub_type = subType ?? Binary.BSON_BINARY_SUBTYPE_DEFAULT;
+ if (buffer == null) {
+ this.buffer = ByteUtils.allocate(Binary.BUFFER_SIZE);
+ this.position = 0;
+ }
+ else {
+ this.buffer = Array.isArray(buffer)
+ ? ByteUtils.fromNumberArray(buffer)
+ : ByteUtils.toLocalBufferType(buffer);
+ this.position = this.buffer.byteLength;
+ }
+ }
+ put(byteValue) {
+ if (typeof byteValue === 'string' && byteValue.length !== 1) {
+ throw new BSONError('only accepts single character String');
+ }
+ else if (typeof byteValue !== 'number' && byteValue.length !== 1)
+ throw new BSONError('only accepts single character Uint8Array or Array');
+ let decodedByte;
+ if (typeof byteValue === 'string') {
+ decodedByte = byteValue.charCodeAt(0);
+ }
+ else if (typeof byteValue === 'number') {
+ decodedByte = byteValue;
+ }
+ else {
+ decodedByte = byteValue[0];
+ }
+ if (decodedByte < 0 || decodedByte > 255) {
+ throw new BSONError('only accepts number in a valid unsigned byte range 0-255');
+ }
+ if (this.buffer.byteLength > this.position) {
+ this.buffer[this.position++] = decodedByte;
+ }
+ else {
+ const newSpace = ByteUtils.allocate(Binary.BUFFER_SIZE + this.buffer.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ this.buffer[this.position++] = decodedByte;
+ }
+ }
+ write(sequence, offset) {
+ offset = typeof offset === 'number' ? offset : this.position;
+ if (this.buffer.byteLength < offset + sequence.length) {
+ const newSpace = ByteUtils.allocate(this.buffer.byteLength + sequence.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ }
+ if (ArrayBuffer.isView(sequence)) {
+ this.buffer.set(ByteUtils.toLocalBufferType(sequence), offset);
+ this.position =
+ offset + sequence.byteLength > this.position ? offset + sequence.length : this.position;
+ }
+ else if (typeof sequence === 'string') {
+ throw new BSONError('input cannot be string');
+ }
+ }
+ read(position, length) {
+ length = length && length > 0 ? length : this.position;
+ const end = position + length;
+ return this.buffer.subarray(position, end > this.position ? this.position : end);
+ }
+ value() {
+ return this.buffer.length === this.position
+ ? this.buffer
+ : this.buffer.subarray(0, this.position);
+ }
+ length() {
+ return this.position;
+ }
+ toJSON() {
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.buffer.subarray(0, this.position));
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ if (encoding === 'utf8' || encoding === 'utf-8')
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (this.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(this);
+ }
+ const base64String = ByteUtils.toBase64(this.buffer);
+ const subType = Number(this.sub_type).toString(16);
+ if (options.legacy) {
+ return {
+ $binary: base64String,
+ $type: subType.length === 1 ? '0' + subType : subType
+ };
+ }
+ return {
+ $binary: {
+ base64: base64String,
+ subType: subType.length === 1 ? '0' + subType : subType
+ }
+ };
+ }
+ toUUID() {
+ if (this.sub_type === Binary.SUBTYPE_UUID) {
+ return new UUID(this.buffer.subarray(0, this.position));
+ }
+ throw new BSONError(`Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${Binary.SUBTYPE_UUID}" is currently supported.`);
+ }
+ static createFromHexString(hex, subType) {
+ return new Binary(ByteUtils.fromHex(hex), subType);
+ }
+ static createFromBase64(base64, subType) {
+ return new Binary(ByteUtils.fromBase64(base64), subType);
+ }
+ static fromExtendedJSON(doc, options) {
+ options = options || {};
+ let data;
+ let type;
+ if ('$binary' in doc) {
+ if (options.legacy && typeof doc.$binary === 'string' && '$type' in doc) {
+ type = doc.$type ? parseInt(doc.$type, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary);
+ }
+ else {
+ if (typeof doc.$binary !== 'string') {
+ type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary.base64);
+ }
+ }
+ }
+ else if ('$uuid' in doc) {
+ type = 4;
+ data = UUID.bytesFromString(doc.$uuid);
+ }
+ if (!data) {
+ throw new BSONError(`Unexpected Binary Extended JSON format ${JSON.stringify(doc)}`);
+ }
+ return type === BSON_BINARY_SUBTYPE_UUID_NEW ? new UUID(data) : new Binary(data, type);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const base64 = ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ const base64Arg = inspect(base64, options);
+ const subTypeArg = inspect(this.sub_type, options);
+ return `Binary.createFromBase64(${base64Arg}, ${subTypeArg})`;
+ }
+ toInt8Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Int8) {
+ throw new BSONError('Binary datatype field is not Int8');
+ }
+ validateBinaryVector(this);
+ return new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toFloat32Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Float32) {
+ throw new BSONError('Binary datatype field is not Float32');
+ }
+ validateBinaryVector(this);
+ const floatBytes = new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(floatBytes);
+ return new Float32Array(floatBytes.buffer);
+ }
+ toPackedBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ return new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ const byteCount = this.length() - 2;
+ const bitCount = byteCount * 8 - this.buffer[1];
+ const bits = new Int8Array(bitCount);
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = (bitOffset / 8) | 0;
+ const byte = this.buffer[byteOffset + 2];
+ const shift = 7 - (bitOffset % 8);
+ const bit = (byte >> shift) & 1;
+ bits[bitOffset] = bit;
+ }
+ return bits;
+ }
+ static fromInt8Array(array) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.Int8;
+ buffer[1] = 0;
+ const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ buffer.set(intBytes, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromFloat32Array(array) {
+ const binaryBytes = ByteUtils.allocate(array.byteLength + 2);
+ binaryBytes[0] = Binary.VECTOR_TYPE.Float32;
+ binaryBytes[1] = 0;
+ const floatBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ binaryBytes.set(floatBytes, 2);
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(new Uint8Array(binaryBytes.buffer, 2));
+ const bin = new this(binaryBytes, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromPackedBits(array, padding = 0) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.PackedBit;
+ buffer[1] = padding;
+ buffer.set(array, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromBits(bits) {
+ const byteLength = (bits.length + 7) >>> 3;
+ const bytes = new Uint8Array(byteLength + 2);
+ bytes[0] = Binary.VECTOR_TYPE.PackedBit;
+ const remainder = bits.length % 8;
+ bytes[1] = remainder === 0 ? 0 : 8 - remainder;
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = bitOffset >>> 3;
+ const bit = bits[bitOffset];
+ if (bit !== 0 && bit !== 1) {
+ throw new BSONError(`Invalid bit value at ${bitOffset}: must be 0 or 1, found ${bits[bitOffset]}`);
+ }
+ if (bit === 0)
+ continue;
+ const shift = 7 - (bitOffset % 8);
+ bytes[byteOffset + 2] |= bit << shift;
+ }
+ return new this(bytes, Binary.SUBTYPE_VECTOR);
+ }
+}
+function validateBinaryVector(vector) {
+ if (vector.sub_type !== Binary.SUBTYPE_VECTOR)
+ return;
+ const size = vector.position;
+ const datatype = vector.buffer[0];
+ const padding = vector.buffer[1];
+ if ((datatype === Binary.VECTOR_TYPE.Float32 || datatype === Binary.VECTOR_TYPE.Int8) &&
+ padding !== 0) {
+ throw new BSONError('Invalid Vector: padding must be zero for int8 and float32 vectors');
+ }
+ if (datatype === Binary.VECTOR_TYPE.Float32) {
+ if (size !== 0 && size - 2 !== 0 && (size - 2) % 4 !== 0) {
+ throw new BSONError('Invalid Vector: Float32 vector must contain a multiple of 4 bytes');
+ }
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding !== 0 && size === 2) {
+ throw new BSONError('Invalid Vector: padding must be zero for packed bit vectors that are empty');
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding > 7) {
+ throw new BSONError(`Invalid Vector: padding must be a value between 0 and 7. found: ${padding}`);
+ }
+}
+const UUID_BYTE_LENGTH = 16;
+const UUID_WITHOUT_DASHES = /^[0-9A-F]{32}$/i;
+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;
+class UUID extends Binary {
+ constructor(input) {
+ let bytes;
+ if (input == null) {
+ bytes = UUID.generate();
+ }
+ else if (input instanceof UUID) {
+ bytes = ByteUtils.toLocalBufferType(new Uint8Array(input.buffer));
+ }
+ else if (ArrayBuffer.isView(input) && input.byteLength === UUID_BYTE_LENGTH) {
+ bytes = ByteUtils.toLocalBufferType(input);
+ }
+ else if (typeof input === 'string') {
+ bytes = UUID.bytesFromString(input);
+ }
+ else {
+ 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).');
+ }
+ super(bytes, BSON_BINARY_SUBTYPE_UUID_NEW);
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ }
+ toHexString(includeDashes = true) {
+ if (includeDashes) {
+ return [
+ ByteUtils.toHex(this.buffer.subarray(0, 4)),
+ ByteUtils.toHex(this.buffer.subarray(4, 6)),
+ ByteUtils.toHex(this.buffer.subarray(6, 8)),
+ ByteUtils.toHex(this.buffer.subarray(8, 10)),
+ ByteUtils.toHex(this.buffer.subarray(10, 16))
+ ].join('-');
+ }
+ return ByteUtils.toHex(this.buffer);
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.id);
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ equals(otherId) {
+ if (!otherId) {
+ return false;
+ }
+ if (otherId instanceof UUID) {
+ return ByteUtils.equals(otherId.id, this.id);
+ }
+ try {
+ return ByteUtils.equals(new UUID(otherId).id, this.id);
+ }
+ catch {
+ return false;
+ }
+ }
+ toBinary() {
+ return new Binary(this.id, Binary.SUBTYPE_UUID);
+ }
+ static generate() {
+ const bytes = ByteUtils.randomBytes(UUID_BYTE_LENGTH);
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
+ return bytes;
+ }
+ static isValid(input) {
+ if (!input) {
+ return false;
+ }
+ if (typeof input === 'string') {
+ return UUID.isValidUUIDString(input);
+ }
+ if (isUint8Array(input)) {
+ return input.byteLength === UUID_BYTE_LENGTH;
+ }
+ return (input._bsontype === 'Binary' &&
+ input.sub_type === this.SUBTYPE_UUID &&
+ input.buffer.byteLength === 16);
+ }
+ static createFromHexString(hexString) {
+ const buffer = UUID.bytesFromString(hexString);
+ return new UUID(buffer);
+ }
+ static createFromBase64(base64) {
+ return new UUID(ByteUtils.fromBase64(base64));
+ }
+ static bytesFromString(representation) {
+ if (!UUID.isValidUUIDString(representation)) {
+ throw new BSONError('UUID string representation must be 32 hex digits or canonical hyphenated representation');
+ }
+ return ByteUtils.fromHex(representation.replace(/-/g, ''));
+ }
+ static isValidUUIDString(representation) {
+ return UUID_WITHOUT_DASHES.test(representation) || UUID_WITH_DASHES.test(representation);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new UUID(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+class Code extends BSONValue {
+ get _bsontype() {
+ return 'Code';
+ }
+ code;
+ scope;
+ constructor(code, scope) {
+ super();
+ this.code = code.toString();
+ this.scope = scope ?? null;
+ }
+ toJSON() {
+ if (this.scope != null) {
+ return { code: this.code, scope: this.scope };
+ }
+ return { code: this.code };
+ }
+ toExtendedJSON() {
+ if (this.scope) {
+ return { $code: this.code, $scope: this.scope };
+ }
+ return { $code: this.code };
+ }
+ static fromExtendedJSON(doc) {
+ return new Code(doc.$code, doc.$scope);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ let parametersString = inspect(this.code, options);
+ const multiLineFn = parametersString.includes('\n');
+ if (this.scope != null) {
+ parametersString += `,${multiLineFn ? '\n' : ' '}${inspect(this.scope, options)}`;
+ }
+ const endingNewline = multiLineFn && this.scope === null;
+ return `new Code(${multiLineFn ? '\n' : ''}${parametersString}${endingNewline ? '\n' : ''})`;
+ }
+}
+
+function isDBRefLike(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '$id' in value &&
+ value.$id != null &&
+ '$ref' in value &&
+ typeof value.$ref === 'string' &&
+ (!('$db' in value) || ('$db' in value && typeof value.$db === 'string')));
+}
+class DBRef extends BSONValue {
+ get _bsontype() {
+ return 'DBRef';
+ }
+ collection;
+ oid;
+ db;
+ fields;
+ constructor(collection, oid, db, fields) {
+ super();
+ const parts = collection.split('.');
+ if (parts.length === 2) {
+ db = parts.shift();
+ collection = parts.shift();
+ }
+ this.collection = collection;
+ this.oid = oid;
+ this.db = db;
+ this.fields = fields || {};
+ }
+ get namespace() {
+ return this.collection;
+ }
+ set namespace(value) {
+ this.collection = value;
+ }
+ toJSON() {
+ const o = Object.assign({
+ $ref: this.collection,
+ $id: this.oid
+ }, this.fields);
+ if (this.db != null)
+ o.$db = this.db;
+ return o;
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ let o = {
+ $ref: this.collection,
+ $id: this.oid
+ };
+ if (options.legacy) {
+ return o;
+ }
+ if (this.db)
+ o.$db = this.db;
+ o = Object.assign(o, this.fields);
+ return o;
+ }
+ static fromExtendedJSON(doc) {
+ const copy = Object.assign({}, doc);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(doc.$ref, doc.$id, doc.$db, copy);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const args = [
+ inspect(this.namespace, options),
+ inspect(this.oid, options),
+ ...(this.db ? [inspect(this.db, options)] : []),
+ ...(Object.keys(this.fields).length > 0 ? [inspect(this.fields, options)] : [])
+ ];
+ args[1] = inspect === defaultInspect ? `new ObjectId(${args[1]})` : args[1];
+ return `new DBRef(${args.join(', ')})`;
+ }
+}
+
+function removeLeadingZerosAndExplicitPlus(str) {
+ if (str === '') {
+ return str;
+ }
+ let startIndex = 0;
+ const isNegative = str[startIndex] === '-';
+ const isExplicitlyPositive = str[startIndex] === '+';
+ if (isExplicitlyPositive || isNegative) {
+ startIndex += 1;
+ }
+ let foundInsignificantZero = false;
+ for (; startIndex < str.length && str[startIndex] === '0'; ++startIndex) {
+ foundInsignificantZero = true;
+ }
+ if (!foundInsignificantZero) {
+ return isExplicitlyPositive ? str.slice(1) : str;
+ }
+ return `${isNegative ? '-' : ''}${str.length === startIndex ? '0' : str.slice(startIndex)}`;
+}
+function validateStringCharacters(str, radix) {
+ radix = radix ?? 10;
+ const validCharacters = '0123456789abcdefghijklmnopqrstuvwxyz'.slice(0, radix);
+ const regex = new RegExp(`[^-+${validCharacters}]`, 'i');
+ return regex.test(str) ? false : str;
+}
+
+let wasm = undefined;
+try {
+ 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;
+}
+catch {
+}
+const TWO_PWR_16_DBL = 1 << 16;
+const TWO_PWR_24_DBL = 1 << 24;
+const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+const TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+const TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+const INT_CACHE = {};
+const UINT_CACHE = {};
+const MAX_INT64_STRING_LENGTH = 20;
+const DECIMAL_REG_EX = /^(\+?0|(\+|-)?[1-9][0-9]*)$/;
+class Long extends BSONValue {
+ get _bsontype() {
+ return 'Long';
+ }
+ get __isLong__() {
+ return true;
+ }
+ high;
+ low;
+ unsigned;
+ constructor(lowOrValue = 0, highOrUnsigned, unsigned) {
+ super();
+ const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
+ const high = typeof highOrUnsigned === 'number' ? highOrUnsigned : 0;
+ const res = typeof lowOrValue === 'string'
+ ? Long.fromString(lowOrValue, unsignedBool)
+ : typeof lowOrValue === 'bigint'
+ ? Long.fromBigInt(lowOrValue, unsignedBool)
+ : { low: lowOrValue | 0, high: high | 0, unsigned: unsignedBool };
+ this.low = res.low;
+ this.high = res.high;
+ this.unsigned = res.unsigned;
+ }
+ static TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
+ static MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true);
+ static ZERO = Long.fromInt(0);
+ static UZERO = Long.fromInt(0, true);
+ static ONE = Long.fromInt(1);
+ static UONE = Long.fromInt(1, true);
+ static NEG_ONE = Long.fromInt(-1);
+ static MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
+ static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false);
+ static fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+ }
+ static fromInt(value, unsigned) {
+ let obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if ((cache = 0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, (value | 0) < 0 ? -1 : 0, true);
+ if (cache)
+ UINT_CACHE[value] = obj;
+ return obj;
+ }
+ else {
+ value |= 0;
+ if ((cache = -128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache)
+ INT_CACHE[value] = obj;
+ return obj;
+ }
+ }
+ static fromNumber(value, unsigned) {
+ if (isNaN(value))
+ return unsigned ? Long.UZERO : Long.ZERO;
+ if (unsigned) {
+ if (value < 0)
+ return Long.UZERO;
+ if (value >= TWO_PWR_64_DBL)
+ return Long.MAX_UNSIGNED_VALUE;
+ }
+ else {
+ if (value <= -TWO_PWR_63_DBL)
+ return Long.MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL)
+ return Long.MAX_VALUE;
+ }
+ if (value < 0)
+ return Long.fromNumber(-value, unsigned).neg();
+ return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
+ }
+ static fromBigInt(value, unsigned) {
+ const FROM_BIGINT_BIT_MASK = 0xffffffffn;
+ const FROM_BIGINT_BIT_SHIFT = 32n;
+ return new Long(Number(value & FROM_BIGINT_BIT_MASK), Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK), unsigned);
+ }
+ static _fromString(str, unsigned, radix) {
+ if (str.length === 0)
+ throw new BSONError('empty string');
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ let p;
+ if ((p = str.indexOf('-')) > 0)
+ throw new BSONError('interior hyphen');
+ else if (p === 0) {
+ return Long._fromString(str.substring(1), unsigned, radix).neg();
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 8));
+ let result = Long.ZERO;
+ for (let i = 0; i < str.length; i += 8) {
+ const size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ const power = Long.fromNumber(Math.pow(radix, size));
+ result = result.mul(power).add(Long.fromNumber(value));
+ }
+ else {
+ result = result.mul(radixToPower);
+ result = result.add(Long.fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+ }
+ static fromStringStrict(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str.trim() !== str) {
+ throw new BSONError(`Input: '${str}' contains leading and/or trailing whitespace`);
+ }
+ if (!validateStringCharacters(str, radix)) {
+ throw new BSONError(`Input: '${str}' contains invalid characters for radix: ${radix}`);
+ }
+ const cleanedStr = removeLeadingZerosAndExplicitPlus(str);
+ const result = Long._fromString(cleanedStr, unsigned, radix);
+ if (result.toString(radix).toLowerCase() !== cleanedStr.toLowerCase()) {
+ throw new BSONError(`Input: ${str} is not representable as ${result.unsigned ? 'an unsigned' : 'a signed'} 64-bit Long ${radix != null ? `with radix: ${radix}` : ''}`);
+ }
+ return result;
+ }
+ static fromString(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str === 'NaN' && radix < 24) {
+ return Long.ZERO;
+ }
+ else if ((str === 'Infinity' || str === '+Infinity' || str === '-Infinity') && radix < 35) {
+ return Long.ZERO;
+ }
+ return Long._fromString(str, unsigned, radix);
+ }
+ static fromBytes(bytes, unsigned, le) {
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
+ }
+ static fromBytesLE(bytes, unsigned) {
+ 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);
+ }
+ static fromBytesBE(bytes, unsigned) {
+ 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);
+ }
+ static isLong(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '__isLong__' in value &&
+ value.__isLong__ === true);
+ }
+ static fromValue(val, unsigned) {
+ if (typeof val === 'number')
+ return Long.fromNumber(val, unsigned);
+ if (typeof val === 'string')
+ return Long.fromString(val, unsigned);
+ return Long.fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
+ }
+ add(addend) {
+ if (!Long.isLong(addend))
+ addend = Long.fromValue(addend);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = addend.high >>> 16;
+ const b32 = addend.high & 0xffff;
+ const b16 = addend.low >>> 16;
+ const b00 = addend.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 + b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ and(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+ }
+ compare(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.eq(other))
+ return 0;
+ const thisNeg = this.isNegative(), otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg)
+ return -1;
+ if (!thisNeg && otherNeg)
+ return 1;
+ if (!this.unsigned)
+ return this.sub(other).isNegative() ? -1 : 1;
+ return other.high >>> 0 > this.high >>> 0 ||
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
+ ? -1
+ : 1;
+ }
+ comp(other) {
+ return this.compare(other);
+ }
+ divide(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (divisor.isZero())
+ throw new BSONError('division by zero');
+ if (wasm) {
+ if (!this.unsigned &&
+ this.high === -2147483648 &&
+ divisor.low === -1 &&
+ divisor.high === -1) {
+ return this;
+ }
+ const low = (this.unsigned ? wasm.div_u : wasm.div_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (this.isZero())
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ let approx, rem, res;
+ if (!this.unsigned) {
+ if (this.eq(Long.MIN_VALUE)) {
+ if (divisor.eq(Long.ONE) || divisor.eq(Long.NEG_ONE))
+ return Long.MIN_VALUE;
+ else if (divisor.eq(Long.MIN_VALUE))
+ return Long.ONE;
+ else {
+ const halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(Long.ZERO)) {
+ return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
+ }
+ else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ }
+ else if (divisor.eq(Long.MIN_VALUE))
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative())
+ return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ }
+ else if (divisor.isNegative())
+ return this.div(divisor.neg()).neg();
+ res = Long.ZERO;
+ }
+ else {
+ if (!divisor.unsigned)
+ divisor = divisor.toUnsigned();
+ if (divisor.gt(this))
+ return Long.UZERO;
+ if (divisor.gt(this.shru(1)))
+ return Long.UONE;
+ res = Long.UZERO;
+ }
+ rem = this;
+ while (rem.gte(divisor)) {
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+ const log2 = Math.ceil(Math.log(approx) / Math.LN2);
+ const delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);
+ let approxRes = Long.fromNumber(approx);
+ let approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = Long.fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+ if (approxRes.isZero())
+ approxRes = Long.ONE;
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+ }
+ div(divisor) {
+ return this.divide(divisor);
+ }
+ equals(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
+ return false;
+ return this.high === other.high && this.low === other.low;
+ }
+ eq(other) {
+ return this.equals(other);
+ }
+ getHighBits() {
+ return this.high;
+ }
+ getHighBitsUnsigned() {
+ return this.high >>> 0;
+ }
+ getLowBits() {
+ return this.low;
+ }
+ getLowBitsUnsigned() {
+ return this.low >>> 0;
+ }
+ getNumBitsAbs() {
+ if (this.isNegative()) {
+ return this.eq(Long.MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ }
+ const val = this.high !== 0 ? this.high : this.low;
+ let bit;
+ for (bit = 31; bit > 0; bit--)
+ if ((val & (1 << bit)) !== 0)
+ break;
+ return this.high !== 0 ? bit + 33 : bit + 1;
+ }
+ greaterThan(other) {
+ return this.comp(other) > 0;
+ }
+ gt(other) {
+ return this.greaterThan(other);
+ }
+ greaterThanOrEqual(other) {
+ return this.comp(other) >= 0;
+ }
+ gte(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ ge(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ isEven() {
+ return (this.low & 1) === 0;
+ }
+ isNegative() {
+ return !this.unsigned && this.high < 0;
+ }
+ isOdd() {
+ return (this.low & 1) === 1;
+ }
+ isPositive() {
+ return this.unsigned || this.high >= 0;
+ }
+ isZero() {
+ return this.high === 0 && this.low === 0;
+ }
+ lessThan(other) {
+ return this.comp(other) < 0;
+ }
+ lt(other) {
+ return this.lessThan(other);
+ }
+ lessThanOrEqual(other) {
+ return this.comp(other) <= 0;
+ }
+ lte(other) {
+ return this.lessThanOrEqual(other);
+ }
+ modulo(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (wasm) {
+ const low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ return this.sub(this.div(divisor).mul(divisor));
+ }
+ mod(divisor) {
+ return this.modulo(divisor);
+ }
+ rem(divisor) {
+ return this.modulo(divisor);
+ }
+ multiply(multiplier) {
+ if (this.isZero())
+ return Long.ZERO;
+ if (!Long.isLong(multiplier))
+ multiplier = Long.fromValue(multiplier);
+ if (wasm) {
+ const low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (multiplier.isZero())
+ return Long.ZERO;
+ if (this.eq(Long.MIN_VALUE))
+ return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (multiplier.eq(Long.MIN_VALUE))
+ return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (this.isNegative()) {
+ if (multiplier.isNegative())
+ return this.neg().mul(multiplier.neg());
+ else
+ return this.neg().mul(multiplier).neg();
+ }
+ else if (multiplier.isNegative())
+ return this.mul(multiplier.neg()).neg();
+ if (this.lt(Long.TWO_PWR_24) && multiplier.lt(Long.TWO_PWR_24))
+ return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = multiplier.high >>> 16;
+ const b32 = multiplier.high & 0xffff;
+ const b16 = multiplier.low >>> 16;
+ const b00 = multiplier.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ mul(multiplier) {
+ return this.multiply(multiplier);
+ }
+ negate() {
+ if (!this.unsigned && this.eq(Long.MIN_VALUE))
+ return Long.MIN_VALUE;
+ return this.not().add(Long.ONE);
+ }
+ neg() {
+ return this.negate();
+ }
+ not() {
+ return Long.fromBits(~this.low, ~this.high, this.unsigned);
+ }
+ notEquals(other) {
+ return !this.equals(other);
+ }
+ neq(other) {
+ return this.notEquals(other);
+ }
+ ne(other) {
+ return this.notEquals(other);
+ }
+ or(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+ }
+ shiftLeft(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
+ else
+ return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
+ }
+ shl(numBits) {
+ return this.shiftLeft(numBits);
+ }
+ shiftRight(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
+ else
+ return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
+ }
+ shr(numBits) {
+ return this.shiftRight(numBits);
+ }
+ shiftRightUnsigned(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ numBits &= 63;
+ if (numBits === 0)
+ return this;
+ else {
+ const high = this.high;
+ if (numBits < 32) {
+ const low = this.low;
+ return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
+ }
+ else if (numBits === 32)
+ return Long.fromBits(high, 0, this.unsigned);
+ else
+ return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
+ }
+ }
+ shr_u(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ shru(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ subtract(subtrahend) {
+ if (!Long.isLong(subtrahend))
+ subtrahend = Long.fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+ }
+ sub(subtrahend) {
+ return this.subtract(subtrahend);
+ }
+ toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+ }
+ toNumber() {
+ if (this.unsigned)
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+ }
+ toBigInt() {
+ return BigInt(this.toString());
+ }
+ toBytes(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+ }
+ toBytesLE() {
+ const hi = this.high, lo = this.low;
+ return [
+ lo & 0xff,
+ (lo >>> 8) & 0xff,
+ (lo >>> 16) & 0xff,
+ lo >>> 24,
+ hi & 0xff,
+ (hi >>> 8) & 0xff,
+ (hi >>> 16) & 0xff,
+ hi >>> 24
+ ];
+ }
+ toBytesBE() {
+ const hi = this.high, lo = this.low;
+ return [
+ hi >>> 24,
+ (hi >>> 16) & 0xff,
+ (hi >>> 8) & 0xff,
+ hi & 0xff,
+ lo >>> 24,
+ (lo >>> 16) & 0xff,
+ (lo >>> 8) & 0xff,
+ lo & 0xff
+ ];
+ }
+ toSigned() {
+ if (!this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, false);
+ }
+ toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ if (this.isZero())
+ return '0';
+ if (this.isNegative()) {
+ if (this.eq(Long.MIN_VALUE)) {
+ const radixLong = Long.fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ }
+ else
+ return '-' + this.neg().toString(radix);
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
+ let rem = this;
+ let result = '';
+ while (true) {
+ const remDiv = rem.div(radixToPower);
+ const intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0;
+ let digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero()) {
+ return digits + result;
+ }
+ else {
+ while (digits.length < 6)
+ digits = '0' + digits;
+ result = '' + digits + result;
+ }
+ }
+ }
+ toUnsigned() {
+ if (this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, true);
+ }
+ xor(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+ }
+ eqz() {
+ return this.isZero();
+ }
+ le(other) {
+ return this.lessThanOrEqual(other);
+ }
+ toExtendedJSON(options) {
+ if (options && options.relaxed)
+ return this.toNumber();
+ return { $numberLong: this.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ const { useBigInt64 = false, relaxed = true } = { ...options };
+ if (doc.$numberLong.length > MAX_INT64_STRING_LENGTH) {
+ throw new BSONError('$numberLong string is too long');
+ }
+ if (!DECIMAL_REG_EX.test(doc.$numberLong)) {
+ throw new BSONError(`$numberLong string "${doc.$numberLong}" is in an invalid format`);
+ }
+ if (useBigInt64) {
+ const bigIntResult = BigInt(doc.$numberLong);
+ return BigInt.asIntN(64, bigIntResult);
+ }
+ const longResult = Long.fromString(doc.$numberLong);
+ if (relaxed) {
+ return longResult.toNumber();
+ }
+ return longResult;
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const longVal = inspect(this.toString(), options);
+ const unsignedVal = this.unsigned ? `, ${inspect(this.unsigned, options)}` : '';
+ return `new Long(${longVal}${unsignedVal})`;
+ }
+}
+
+const PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/;
+const PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i;
+const PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i;
+const EXPONENT_MAX = 6111;
+const EXPONENT_MIN = -6176;
+const EXPONENT_BIAS = 6176;
+const MAX_DIGITS = 34;
+const NAN_BUFFER = ByteUtils.fromNumberArray([
+ 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_NEGATIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_POSITIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const EXPONENT_REGEX = /^([-+])?(\d+)?$/;
+const COMBINATION_MASK = 0x1f;
+const EXPONENT_MASK = 0x3fff;
+const COMBINATION_INFINITY = 30;
+const COMBINATION_NAN = 31;
+function isDigit(value) {
+ return !isNaN(parseInt(value, 10));
+}
+function divideu128(value) {
+ const DIVISOR = Long.fromNumber(1000 * 1000 * 1000);
+ let _rem = Long.fromNumber(0);
+ if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) {
+ return { quotient: value, rem: _rem };
+ }
+ for (let i = 0; i <= 3; i++) {
+ _rem = _rem.shiftLeft(32);
+ _rem = _rem.add(new Long(value.parts[i], 0));
+ value.parts[i] = _rem.div(DIVISOR).low;
+ _rem = _rem.modulo(DIVISOR);
+ }
+ return { quotient: value, rem: _rem };
+}
+function multiply64x2(left, right) {
+ if (!left && !right) {
+ return { high: Long.fromNumber(0), low: Long.fromNumber(0) };
+ }
+ const leftHigh = left.shiftRightUnsigned(32);
+ const leftLow = new Long(left.getLowBits(), 0);
+ const rightHigh = right.shiftRightUnsigned(32);
+ const rightLow = new Long(right.getLowBits(), 0);
+ let productHigh = leftHigh.multiply(rightHigh);
+ let productMid = leftHigh.multiply(rightLow);
+ const productMid2 = leftLow.multiply(rightHigh);
+ let productLow = leftLow.multiply(rightLow);
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productMid = new Long(productMid.getLowBits(), 0)
+ .add(productMid2)
+ .add(productLow.shiftRightUnsigned(32));
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));
+ return { high: productHigh, low: productLow };
+}
+function lessThan(left, right) {
+ const uhleft = left.high >>> 0;
+ const uhright = right.high >>> 0;
+ if (uhleft < uhright) {
+ return true;
+ }
+ else if (uhleft === uhright) {
+ const ulleft = left.low >>> 0;
+ const ulright = right.low >>> 0;
+ if (ulleft < ulright)
+ return true;
+ }
+ return false;
+}
+function invalidErr(string, message) {
+ throw new BSONError(`"${string}" is not a valid Decimal128 string - ${message}`);
+}
+class Decimal128 extends BSONValue {
+ get _bsontype() {
+ return 'Decimal128';
+ }
+ bytes;
+ constructor(bytes) {
+ super();
+ if (typeof bytes === 'string') {
+ this.bytes = Decimal128.fromString(bytes).bytes;
+ }
+ else if (bytes instanceof Uint8Array || isUint8Array(bytes)) {
+ if (bytes.byteLength !== 16) {
+ throw new BSONError('Decimal128 must take a Buffer of 16 bytes');
+ }
+ this.bytes = bytes;
+ }
+ else {
+ throw new BSONError('Decimal128 must take a Buffer or string');
+ }
+ }
+ static fromString(representation) {
+ return Decimal128._fromString(representation, { allowRounding: false });
+ }
+ static fromStringWithRounding(representation) {
+ return Decimal128._fromString(representation, { allowRounding: true });
+ }
+ static _fromString(representation, options) {
+ let isNegative = false;
+ let sawSign = false;
+ let sawRadix = false;
+ let foundNonZero = false;
+ let significantDigits = 0;
+ let nDigitsRead = 0;
+ let nDigits = 0;
+ let radixPosition = 0;
+ let firstNonZero = 0;
+ const digits = [0];
+ let nDigitsStored = 0;
+ let digitsInsert = 0;
+ let lastDigit = 0;
+ let exponent = 0;
+ let significandHigh = new Long(0, 0);
+ let significandLow = new Long(0, 0);
+ let biasedExponent = 0;
+ let index = 0;
+ if (representation.length >= 7000) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ const stringMatch = representation.match(PARSE_STRING_REGEXP);
+ const infMatch = representation.match(PARSE_INF_REGEXP);
+ const nanMatch = representation.match(PARSE_NAN_REGEXP);
+ if ((!stringMatch && !infMatch && !nanMatch) || representation.length === 0) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ if (stringMatch) {
+ const unsignedNumber = stringMatch[2];
+ const e = stringMatch[4];
+ const expSign = stringMatch[5];
+ const expNumber = stringMatch[6];
+ if (e && expNumber === undefined)
+ invalidErr(representation, 'missing exponent power');
+ if (e && unsignedNumber === undefined)
+ invalidErr(representation, 'missing exponent base');
+ if (e === undefined && (expSign || expNumber)) {
+ invalidErr(representation, 'missing e before exponent');
+ }
+ }
+ if (representation[index] === '+' || representation[index] === '-') {
+ sawSign = true;
+ isNegative = representation[index++] === '-';
+ }
+ if (!isDigit(representation[index]) && representation[index] !== '.') {
+ if (representation[index] === 'i' || representation[index] === 'I') {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ else if (representation[index] === 'N') {
+ return new Decimal128(NAN_BUFFER);
+ }
+ }
+ while (isDigit(representation[index]) || representation[index] === '.') {
+ if (representation[index] === '.') {
+ if (sawRadix)
+ invalidErr(representation, 'contains multiple periods');
+ sawRadix = true;
+ index = index + 1;
+ continue;
+ }
+ if (nDigitsStored < MAX_DIGITS) {
+ if (representation[index] !== '0' || foundNonZero) {
+ if (!foundNonZero) {
+ firstNonZero = nDigitsRead;
+ }
+ foundNonZero = true;
+ digits[digitsInsert++] = parseInt(representation[index], 10);
+ nDigitsStored = nDigitsStored + 1;
+ }
+ }
+ if (foundNonZero)
+ nDigits = nDigits + 1;
+ if (sawRadix)
+ radixPosition = radixPosition + 1;
+ nDigitsRead = nDigitsRead + 1;
+ index = index + 1;
+ }
+ if (sawRadix && !nDigitsRead)
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ if (representation[index] === 'e' || representation[index] === 'E') {
+ const match = representation.substr(++index).match(EXPONENT_REGEX);
+ if (!match || !match[2])
+ return new Decimal128(NAN_BUFFER);
+ exponent = parseInt(match[0], 10);
+ index = index + match[0].length;
+ }
+ if (representation[index])
+ return new Decimal128(NAN_BUFFER);
+ if (!nDigitsStored) {
+ digits[0] = 0;
+ nDigits = 1;
+ nDigitsStored = 1;
+ significantDigits = 0;
+ }
+ else {
+ lastDigit = nDigitsStored - 1;
+ significantDigits = nDigits;
+ if (significantDigits !== 1) {
+ while (representation[firstNonZero + significantDigits - 1 + Number(sawSign) + Number(sawRadix)] === '0') {
+ significantDigits = significantDigits - 1;
+ }
+ }
+ }
+ if (exponent <= radixPosition && radixPosition > exponent + (1 << 14)) {
+ exponent = EXPONENT_MIN;
+ }
+ else {
+ exponent = exponent - radixPosition;
+ }
+ while (exponent > EXPONENT_MAX) {
+ lastDigit = lastDigit + 1;
+ if (lastDigit >= MAX_DIGITS) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ exponent = exponent - 1;
+ }
+ if (options.allowRounding) {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0 && significantDigits < nDigitsStored) {
+ exponent = EXPONENT_MIN;
+ significantDigits = 0;
+ break;
+ }
+ if (nDigitsStored < nDigits) {
+ nDigits = nDigits - 1;
+ }
+ else {
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ const digitsString = digits.join('');
+ if (digitsString.match(/^0+$/)) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ let endOfString = nDigitsRead;
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ let roundBit = 0;
+ if (roundDigit >= 5) {
+ roundBit = 1;
+ if (roundDigit === 5) {
+ roundBit = digits[lastDigit] % 2 === 1 ? 1 : 0;
+ for (let i = firstNonZero + lastDigit + 2; i < endOfString; i++) {
+ if (parseInt(representation[i], 10)) {
+ roundBit = 1;
+ break;
+ }
+ }
+ }
+ }
+ if (roundBit) {
+ let dIdx = lastDigit;
+ for (; dIdx >= 0; dIdx--) {
+ if (++digits[dIdx] > 9) {
+ digits[dIdx] = 0;
+ if (dIdx === 0) {
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ digits[dIdx] = 1;
+ }
+ else {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ }
+ }
+ else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ else {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MIN;
+ break;
+ }
+ invalidErr(representation, 'exponent underflow');
+ }
+ if (nDigitsStored < nDigits) {
+ if (representation[nDigits - 1 + Number(sawSign) + Number(sawRadix)] !== '0' &&
+ significantDigits !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ nDigits = nDigits - 1;
+ }
+ else {
+ if (digits[lastDigit] !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ if (roundDigit !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ }
+ }
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ if (significantDigits === 0) {
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ }
+ else if (lastDigit < 17) {
+ let dIdx = 0;
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ significandHigh = new Long(0, 0);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ else {
+ let dIdx = 0;
+ significandHigh = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit - 17; dIdx++) {
+ significandHigh = significandHigh.multiply(Long.fromNumber(10));
+ significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));
+ }
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ const significand = multiply64x2(significandHigh, Long.fromString('100000000000000000'));
+ significand.low = significand.low.add(significandLow);
+ if (lessThan(significand.low, significandLow)) {
+ significand.high = significand.high.add(Long.fromNumber(1));
+ }
+ biasedExponent = exponent + EXPONENT_BIAS;
+ const dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };
+ if (significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1))) {
+ dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));
+ }
+ else {
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));
+ }
+ dec.low = significand.low;
+ if (isNegative) {
+ dec.high = dec.high.or(Long.fromString('9223372036854775808'));
+ }
+ const buffer = ByteUtils.allocateUnsafe(16);
+ index = 0;
+ buffer[index++] = dec.low.low & 0xff;
+ buffer[index++] = (dec.low.low >> 8) & 0xff;
+ buffer[index++] = (dec.low.low >> 16) & 0xff;
+ buffer[index++] = (dec.low.low >> 24) & 0xff;
+ buffer[index++] = dec.low.high & 0xff;
+ buffer[index++] = (dec.low.high >> 8) & 0xff;
+ buffer[index++] = (dec.low.high >> 16) & 0xff;
+ buffer[index++] = (dec.low.high >> 24) & 0xff;
+ buffer[index++] = dec.high.low & 0xff;
+ buffer[index++] = (dec.high.low >> 8) & 0xff;
+ buffer[index++] = (dec.high.low >> 16) & 0xff;
+ buffer[index++] = (dec.high.low >> 24) & 0xff;
+ buffer[index++] = dec.high.high & 0xff;
+ buffer[index++] = (dec.high.high >> 8) & 0xff;
+ buffer[index++] = (dec.high.high >> 16) & 0xff;
+ buffer[index++] = (dec.high.high >> 24) & 0xff;
+ return new Decimal128(buffer);
+ }
+ toString() {
+ let biased_exponent;
+ let significand_digits = 0;
+ const significand = new Array(36);
+ for (let i = 0; i < significand.length; i++)
+ significand[i] = 0;
+ let index = 0;
+ let is_zero = false;
+ let significand_msb;
+ let significand128 = { parts: [0, 0, 0, 0] };
+ let j, k;
+ const string = [];
+ index = 0;
+ const buffer = this.bytes;
+ const low = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midl = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midh = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const high = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ index = 0;
+ const dec = {
+ low: new Long(low, midl),
+ high: new Long(midh, high)
+ };
+ if (dec.high.lessThan(Long.ZERO)) {
+ string.push('-');
+ }
+ const combination = (high >> 26) & COMBINATION_MASK;
+ if (combination >> 3 === 3) {
+ if (combination === COMBINATION_INFINITY) {
+ return string.join('') + 'Infinity';
+ }
+ else if (combination === COMBINATION_NAN) {
+ return 'NaN';
+ }
+ else {
+ biased_exponent = (high >> 15) & EXPONENT_MASK;
+ significand_msb = 0x08 + ((high >> 14) & 0x01);
+ }
+ }
+ else {
+ significand_msb = (high >> 14) & 0x07;
+ biased_exponent = (high >> 17) & EXPONENT_MASK;
+ }
+ const exponent = biased_exponent - EXPONENT_BIAS;
+ significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);
+ significand128.parts[1] = midh;
+ significand128.parts[2] = midl;
+ significand128.parts[3] = low;
+ if (significand128.parts[0] === 0 &&
+ significand128.parts[1] === 0 &&
+ significand128.parts[2] === 0 &&
+ significand128.parts[3] === 0) {
+ is_zero = true;
+ }
+ else {
+ for (k = 3; k >= 0; k--) {
+ let least_digits = 0;
+ const result = divideu128(significand128);
+ significand128 = result.quotient;
+ least_digits = result.rem.low;
+ if (!least_digits)
+ continue;
+ for (j = 8; j >= 0; j--) {
+ significand[k * 9 + j] = least_digits % 10;
+ least_digits = Math.floor(least_digits / 10);
+ }
+ }
+ }
+ if (is_zero) {
+ significand_digits = 1;
+ significand[index] = 0;
+ }
+ else {
+ significand_digits = 36;
+ while (!significand[index]) {
+ significand_digits = significand_digits - 1;
+ index = index + 1;
+ }
+ }
+ const scientific_exponent = significand_digits - 1 + exponent;
+ if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) {
+ if (significand_digits > 34) {
+ string.push(`${0}`);
+ if (exponent > 0)
+ string.push(`E+${exponent}`);
+ else if (exponent < 0)
+ string.push(`E${exponent}`);
+ return string.join('');
+ }
+ string.push(`${significand[index++]}`);
+ significand_digits = significand_digits - 1;
+ if (significand_digits) {
+ string.push('.');
+ }
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ string.push('E');
+ if (scientific_exponent > 0) {
+ string.push(`+${scientific_exponent}`);
+ }
+ else {
+ string.push(`${scientific_exponent}`);
+ }
+ }
+ else {
+ if (exponent >= 0) {
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ let radix_position = significand_digits + exponent;
+ if (radix_position > 0) {
+ for (let i = 0; i < radix_position; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ string.push('0');
+ }
+ string.push('.');
+ while (radix_position++ < 0) {
+ string.push('0');
+ }
+ for (let i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ }
+ return string.join('');
+ }
+ toJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ toExtendedJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ static fromExtendedJSON(doc) {
+ return Decimal128.fromString(doc.$numberDecimal);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const d128string = inspect(this.toString(), options);
+ return `new Decimal128(${d128string})`;
+ }
+}
+
+class Double extends BSONValue {
+ get _bsontype() {
+ return 'Double';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value;
+ }
+ static fromString(value) {
+ const coercedValue = Number(value);
+ if (value === 'NaN')
+ return new Double(NaN);
+ if (value === 'Infinity')
+ return new Double(Infinity);
+ if (value === '-Infinity')
+ return new Double(-Infinity);
+ if (!Number.isFinite(coercedValue)) {
+ throw new BSONError(`Input: ${value} is not representable as a Double`);
+ }
+ if (value.trim() !== value) {
+ throw new BSONError(`Input: '${value}' contains whitespace`);
+ }
+ if (value === '') {
+ throw new BSONError(`Input is an empty string`);
+ }
+ if (/[^-0-9.+eE]/.test(value)) {
+ throw new BSONError(`Input: '${value}' is not in decimal or exponential notation`);
+ }
+ return new Double(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toExtendedJSON(options) {
+ if (options && (options.legacy || (options.relaxed && isFinite(this.value)))) {
+ return this.value;
+ }
+ if (Object.is(Math.sign(this.value), -0)) {
+ return { $numberDouble: '-0.0' };
+ }
+ return {
+ $numberDouble: Number.isInteger(this.value) ? this.value.toFixed(1) : this.value.toString()
+ };
+ }
+ static fromExtendedJSON(doc, options) {
+ const doubleValue = parseFloat(doc.$numberDouble);
+ return options && options.relaxed ? doubleValue : new Double(doubleValue);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Double(${inspect(this.value, options)})`;
+ }
+}
+
+class Int32 extends BSONValue {
+ get _bsontype() {
+ return 'Int32';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value | 0;
+ }
+ static fromString(value) {
+ const cleanedValue = removeLeadingZerosAndExplicitPlus(value);
+ const coercedValue = Number(value);
+ if (BSON_INT32_MAX < coercedValue) {
+ throw new BSONError(`Input: '${value}' is larger than the maximum value for Int32`);
+ }
+ else if (BSON_INT32_MIN > coercedValue) {
+ throw new BSONError(`Input: '${value}' is smaller than the minimum value for Int32`);
+ }
+ else if (!Number.isSafeInteger(coercedValue)) {
+ throw new BSONError(`Input: '${value}' is not a safe integer`);
+ }
+ else if (coercedValue.toString() !== cleanedValue) {
+ throw new BSONError(`Input: '${value}' is not a valid Int32 string`);
+ }
+ return new Int32(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON(options) {
+ if (options && (options.relaxed || options.legacy))
+ return this.value;
+ return { $numberInt: this.value.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new Int32(doc.$numberInt);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Int32(${inspect(this.value, options)})`;
+ }
+}
+
+class MaxKey extends BSONValue {
+ get _bsontype() {
+ return 'MaxKey';
+ }
+ toExtendedJSON() {
+ return { $maxKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MaxKey();
+ }
+ inspect() {
+ return 'new MaxKey()';
+ }
+}
+
+class MinKey extends BSONValue {
+ get _bsontype() {
+ return 'MinKey';
+ }
+ toExtendedJSON() {
+ return { $minKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MinKey();
+ }
+ inspect() {
+ return 'new MinKey()';
+ }
+}
+
+let PROCESS_UNIQUE = null;
+const __idCache = new WeakMap();
+class ObjectId extends BSONValue {
+ get _bsontype() {
+ return 'ObjectId';
+ }
+ static index = Math.floor(Math.random() * 0xffffff);
+ static cacheHexString;
+ buffer;
+ constructor(inputId) {
+ super();
+ let workingId;
+ if (typeof inputId === 'object' && inputId && 'id' in inputId) {
+ if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
+ throw new BSONError('Argument passed in must have an id that is of type string or Buffer');
+ }
+ if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
+ workingId = ByteUtils.fromHex(inputId.toHexString());
+ }
+ else {
+ workingId = inputId.id;
+ }
+ }
+ else {
+ workingId = inputId;
+ }
+ if (workingId == null) {
+ this.buffer = ObjectId.generate();
+ }
+ else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
+ this.buffer = ByteUtils.toLocalBufferType(workingId);
+ }
+ else if (typeof workingId === 'string') {
+ if (ObjectId.validateHexString(workingId)) {
+ this.buffer = ByteUtils.fromHex(workingId);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, workingId);
+ }
+ }
+ else {
+ throw new BSONError('input must be a 24 character hex string, 12 byte Uint8Array, or an integer');
+ }
+ }
+ else {
+ throw new BSONError('Argument passed in does not match the accepted types');
+ }
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, ByteUtils.toHex(value));
+ }
+ }
+ static validateHexString(string) {
+ if (string?.length !== 24)
+ return false;
+ for (let i = 0; i < 24; i++) {
+ const char = string.charCodeAt(i);
+ if ((char >= 48 && char <= 57) ||
+ (char >= 97 && char <= 102) ||
+ (char >= 65 && char <= 70)) {
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+ toHexString() {
+ if (ObjectId.cacheHexString) {
+ const __id = __idCache.get(this);
+ if (__id)
+ return __id;
+ }
+ const hexString = ByteUtils.toHex(this.id);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, hexString);
+ }
+ return hexString;
+ }
+ static getInc() {
+ return (ObjectId.index = (ObjectId.index + 1) % 0xffffff);
+ }
+ static generate(time) {
+ if ('number' !== typeof time) {
+ time = Math.floor(Date.now() / 1000);
+ }
+ const inc = ObjectId.getInc();
+ const buffer = ByteUtils.allocateUnsafe(12);
+ NumberUtils.setInt32BE(buffer, 0, time);
+ if (PROCESS_UNIQUE === null) {
+ PROCESS_UNIQUE = ByteUtils.randomBytes(5);
+ }
+ buffer[4] = PROCESS_UNIQUE[0];
+ buffer[5] = PROCESS_UNIQUE[1];
+ buffer[6] = PROCESS_UNIQUE[2];
+ buffer[7] = PROCESS_UNIQUE[3];
+ buffer[8] = PROCESS_UNIQUE[4];
+ buffer[11] = inc & 0xff;
+ buffer[10] = (inc >> 8) & 0xff;
+ buffer[9] = (inc >> 16) & 0xff;
+ return buffer;
+ }
+ toString(encoding) {
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ if (encoding === 'hex')
+ return this.toHexString();
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ static is(variable) {
+ return (variable != null &&
+ typeof variable === 'object' &&
+ '_bsontype' in variable &&
+ variable._bsontype === 'ObjectId');
+ }
+ equals(otherId) {
+ if (otherId === undefined || otherId === null) {
+ return false;
+ }
+ if (ObjectId.is(otherId)) {
+ return (this.buffer[11] === otherId.buffer[11] && ByteUtils.equals(this.buffer, otherId.buffer));
+ }
+ if (typeof otherId === 'string') {
+ return otherId.toLowerCase() === this.toHexString();
+ }
+ if (typeof otherId === 'object' && typeof otherId.toHexString === 'function') {
+ const otherIdString = otherId.toHexString();
+ const thisIdString = this.toHexString();
+ return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
+ }
+ return false;
+ }
+ getTimestamp() {
+ const timestamp = new Date();
+ const time = NumberUtils.getUint32BE(this.buffer, 0);
+ timestamp.setTime(Math.floor(time) * 1000);
+ return timestamp;
+ }
+ static createPk() {
+ return new ObjectId();
+ }
+ serializeInto(uint8array, index) {
+ uint8array[index] = this.buffer[0];
+ uint8array[index + 1] = this.buffer[1];
+ uint8array[index + 2] = this.buffer[2];
+ uint8array[index + 3] = this.buffer[3];
+ uint8array[index + 4] = this.buffer[4];
+ uint8array[index + 5] = this.buffer[5];
+ uint8array[index + 6] = this.buffer[6];
+ uint8array[index + 7] = this.buffer[7];
+ uint8array[index + 8] = this.buffer[8];
+ uint8array[index + 9] = this.buffer[9];
+ uint8array[index + 10] = this.buffer[10];
+ uint8array[index + 11] = this.buffer[11];
+ return 12;
+ }
+ static createFromTime(time) {
+ const buffer = ByteUtils.allocate(12);
+ for (let i = 11; i >= 4; i--)
+ buffer[i] = 0;
+ NumberUtils.setInt32BE(buffer, 0, time);
+ return new ObjectId(buffer);
+ }
+ static createFromHexString(hexString) {
+ if (hexString?.length !== 24) {
+ throw new BSONError('hex string must be 24 characters');
+ }
+ return new ObjectId(ByteUtils.fromHex(hexString));
+ }
+ static createFromBase64(base64) {
+ if (base64?.length !== 16) {
+ throw new BSONError('base64 string must be 16 characters');
+ }
+ return new ObjectId(ByteUtils.fromBase64(base64));
+ }
+ static isValid(id) {
+ if (id == null)
+ return false;
+ if (typeof id === 'string')
+ return ObjectId.validateHexString(id);
+ try {
+ new ObjectId(id);
+ return true;
+ }
+ catch {
+ return false;
+ }
+ }
+ toExtendedJSON() {
+ if (this.toHexString)
+ return { $oid: this.toHexString() };
+ return { $oid: this.toString('hex') };
+ }
+ static fromExtendedJSON(doc) {
+ return new ObjectId(doc.$oid);
+ }
+ isCached() {
+ return ObjectId.cacheHexString && __idCache.has(this);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new ObjectId(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+function internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined) {
+ let totalLength = 4 + 1;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined);
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ }
+ for (const key of Object.keys(object)) {
+ totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined);
+ }
+ }
+ return totalLength;
+}
+function calculateElement(name, value, serializeFunctions = false, isArray = false, ignoreUndefined = false) {
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ switch (typeof value) {
+ case 'string':
+ return 1 + ByteUtils.utf8ByteLength(name) + 1 + 4 + ByteUtils.utf8ByteLength(value) + 1;
+ case 'number':
+ if (Math.floor(value) === value &&
+ value >= JS_INT_MIN &&
+ value <= JS_INT_MAX) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (4 + 1);
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ case 'undefined':
+ if (isArray || !ignoreUndefined)
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ return 0;
+ case 'boolean':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 1);
+ case 'object':
+ if (value != null &&
+ typeof value._bsontype === 'string' &&
+ value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value == null || value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ }
+ else if (value._bsontype === 'ObjectId') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (12 + 1);
+ }
+ else if (value instanceof Date || isDate(value)) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (ArrayBuffer.isView(value) ||
+ value instanceof ArrayBuffer ||
+ isAnyArrayBuffer(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 4 + 1) + value.byteLength);
+ }
+ else if (value._bsontype === 'Long' ||
+ value._bsontype === 'Double' ||
+ value._bsontype === 'Timestamp') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (16 + 1);
+ }
+ else if (value._bsontype === 'Code') {
+ if (value.scope != null && Object.keys(value.scope).length > 0) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1 +
+ internalCalculateObjectSize(value.scope, serializeFunctions, ignoreUndefined));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1);
+ }
+ }
+ else if (value._bsontype === 'Binary') {
+ const binary = value;
+ if (binary.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ (binary.position + 1 + 4 + 1 + 4));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (binary.position + 1 + 4 + 1));
+ }
+ }
+ else if (value._bsontype === 'Symbol') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ ByteUtils.utf8ByteLength(value.value) +
+ 4 +
+ 1 +
+ 1);
+ }
+ else if (value._bsontype === 'DBRef') {
+ const ordered_values = Object.assign({
+ $ref: value.collection,
+ $id: value.oid
+ }, value.fields);
+ if (value.db != null) {
+ ordered_values['$db'] = value.db;
+ }
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ internalCalculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined));
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.source) +
+ 1 +
+ (value.global ? 1 : 0) +
+ (value.ignoreCase ? 1 : 0) +
+ (value.multiline ? 1 : 0) +
+ 1);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.pattern) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.options) +
+ 1);
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ internalCalculateObjectSize(value, serializeFunctions, ignoreUndefined) +
+ 1);
+ }
+ case 'function':
+ if (serializeFunctions) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.toString()) +
+ 1);
+ }
+ return 0;
+ case 'bigint':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ case 'symbol':
+ return 0;
+ default:
+ throw new BSONError(`Unrecognized JS type: ${typeof value}`);
+ }
+}
+
+function alphabetize(str) {
+ return str.split('').sort().join('');
+}
+class BSONRegExp extends BSONValue {
+ get _bsontype() {
+ return 'BSONRegExp';
+ }
+ pattern;
+ options;
+ constructor(pattern, options) {
+ super();
+ this.pattern = pattern;
+ this.options = alphabetize(options ?? '');
+ if (this.pattern.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}`);
+ }
+ if (this.options.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex options cannot contain null bytes, found: ${JSON.stringify(this.options)}`);
+ }
+ for (let i = 0; i < this.options.length; i++) {
+ if (!(this.options[i] === 'i' ||
+ this.options[i] === 'm' ||
+ this.options[i] === 'x' ||
+ this.options[i] === 'l' ||
+ this.options[i] === 's' ||
+ this.options[i] === 'u')) {
+ throw new BSONError(`The regular expression option [${this.options[i]}] is not supported`);
+ }
+ }
+ }
+ static parseOptions(options) {
+ return options ? options.split('').sort().join('') : '';
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (options.legacy) {
+ return { $regex: this.pattern, $options: this.options };
+ }
+ return { $regularExpression: { pattern: this.pattern, options: this.options } };
+ }
+ static fromExtendedJSON(doc) {
+ if ('$regex' in doc) {
+ if (typeof doc.$regex !== 'string') {
+ if (doc.$regex._bsontype === 'BSONRegExp') {
+ return doc;
+ }
+ }
+ else {
+ return new BSONRegExp(doc.$regex, BSONRegExp.parseOptions(doc.$options));
+ }
+ }
+ if ('$regularExpression' in doc) {
+ return new BSONRegExp(doc.$regularExpression.pattern, BSONRegExp.parseOptions(doc.$regularExpression.options));
+ }
+ throw new BSONError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(doc)}`);
+ }
+ inspect(depth, options, inspect) {
+ const stylize = getStylizeFunction(options) ?? (v => v);
+ inspect ??= defaultInspect;
+ const pattern = stylize(inspect(this.pattern), 'regexp');
+ const flags = stylize(inspect(this.options), 'regexp');
+ return `new BSONRegExp(${pattern}, ${flags})`;
+ }
+}
+
+class BSONSymbol extends BSONValue {
+ get _bsontype() {
+ return 'BSONSymbol';
+ }
+ value;
+ constructor(value) {
+ super();
+ this.value = value;
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON() {
+ return { $symbol: this.value };
+ }
+ static fromExtendedJSON(doc) {
+ return new BSONSymbol(doc.$symbol);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new BSONSymbol(${inspect(this.value, options)})`;
+ }
+}
+
+const LongWithoutOverridesClass = Long;
+class Timestamp extends LongWithoutOverridesClass {
+ get _bsontype() {
+ return 'Timestamp';
+ }
+ get [bsonType]() {
+ return 'Timestamp';
+ }
+ static MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
+ get i() {
+ return this.low >>> 0;
+ }
+ get t() {
+ return this.high >>> 0;
+ }
+ constructor(low) {
+ if (low == null) {
+ super(0, 0, true);
+ }
+ else if (typeof low === 'bigint') {
+ super(low, true);
+ }
+ else if (Long.isLong(low)) {
+ super(low.low, low.high, true);
+ }
+ else if (typeof low === 'object' && 't' in low && 'i' in low) {
+ if (typeof low.t !== 'number' && (typeof low.t !== 'object' || low.t._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t as a number');
+ }
+ if (typeof low.i !== 'number' && (typeof low.i !== 'object' || low.i._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i as a number');
+ }
+ const t = Number(low.t);
+ const i = Number(low.i);
+ if (t < 0 || Number.isNaN(t)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive t');
+ }
+ if (i < 0 || Number.isNaN(i)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive i');
+ }
+ if (t > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t equal or less than uint32 max');
+ }
+ if (i > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i equal or less than uint32 max');
+ }
+ super(i, t, true);
+ }
+ else {
+ throw new BSONError('A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }');
+ }
+ }
+ toJSON() {
+ return {
+ $timestamp: this.toString()
+ };
+ }
+ static fromInt(value) {
+ return new Timestamp(Long.fromInt(value, true));
+ }
+ static fromNumber(value) {
+ return new Timestamp(Long.fromNumber(value, true));
+ }
+ static fromBits(lowBits, highBits) {
+ return new Timestamp({ i: lowBits, t: highBits });
+ }
+ static fromString(str, optRadix) {
+ return new Timestamp(Long.fromString(str, true, optRadix));
+ }
+ toExtendedJSON() {
+ return { $timestamp: { t: this.t, i: this.i } };
+ }
+ static fromExtendedJSON(doc) {
+ const i = Long.isLong(doc.$timestamp.i)
+ ? doc.$timestamp.i.getLowBitsUnsigned()
+ : doc.$timestamp.i;
+ const t = Long.isLong(doc.$timestamp.t)
+ ? doc.$timestamp.t.getLowBitsUnsigned()
+ : doc.$timestamp.t;
+ return new Timestamp({ t, i });
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const t = inspect(this.t, options);
+ const i = inspect(this.i, options);
+ return `new Timestamp({ t: ${t}, i: ${i} })`;
+ }
+}
+
+const JS_INT_MAX_LONG = Long.fromNumber(JS_INT_MAX);
+const JS_INT_MIN_LONG = Long.fromNumber(JS_INT_MIN);
+function internalDeserialize(buffer, options, isArray) {
+ options = options == null ? {} : options;
+ const index = options && options.index ? options.index : 0;
+ const size = NumberUtils.getInt32LE(buffer, index);
+ if (size < 5) {
+ throw new BSONError(`bson size must be >= 5, is ${size}`);
+ }
+ if (options.allowObjectSmallerThanBufferSize && buffer.length < size) {
+ throw new BSONError(`buffer length ${buffer.length} must be >= bson size ${size}`);
+ }
+ if (!options.allowObjectSmallerThanBufferSize && buffer.length !== size) {
+ throw new BSONError(`buffer length ${buffer.length} must === bson size ${size}`);
+ }
+ if (size + index > buffer.byteLength) {
+ throw new BSONError(`(bson size ${size} + options.index ${index} must be <= buffer length ${buffer.byteLength})`);
+ }
+ if (buffer[index + size - 1] !== 0) {
+ throw new BSONError("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");
+ }
+ return deserializeObject(buffer, index, options, isArray);
+}
+const allowedDBRefKeys = /^\$ref$|^\$id$|^\$db$/;
+function deserializeObject(buffer, index, options, isArray = false) {
+ const fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];
+ const raw = options['raw'] == null ? false : options['raw'];
+ const bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false;
+ const promoteBuffers = options.promoteBuffers ?? false;
+ const promoteLongs = options.promoteLongs ?? true;
+ const promoteValues = options.promoteValues ?? true;
+ const useBigInt64 = options.useBigInt64 ?? false;
+ if (useBigInt64 && !promoteValues) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ if (useBigInt64 && !promoteLongs) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ const validation = options.validation == null ? { utf8: true } : options.validation;
+ let globalUTFValidation = true;
+ let validationSetting;
+ let utf8KeysSet;
+ const utf8ValidatedKeys = validation.utf8;
+ if (typeof utf8ValidatedKeys === 'boolean') {
+ validationSetting = utf8ValidatedKeys;
+ }
+ else {
+ globalUTFValidation = false;
+ const utf8ValidationValues = Object.keys(utf8ValidatedKeys).map(function (key) {
+ return utf8ValidatedKeys[key];
+ });
+ if (utf8ValidationValues.length === 0) {
+ throw new BSONError('UTF-8 validation setting cannot be empty');
+ }
+ if (typeof utf8ValidationValues[0] !== 'boolean') {
+ throw new BSONError('Invalid UTF-8 validation option, must specify boolean values');
+ }
+ validationSetting = utf8ValidationValues[0];
+ if (!utf8ValidationValues.every(item => item === validationSetting)) {
+ throw new BSONError('Invalid UTF-8 validation option - keys must be all true or all false');
+ }
+ }
+ if (!globalUTFValidation) {
+ utf8KeysSet = new Set();
+ for (const key of Object.keys(utf8ValidatedKeys)) {
+ utf8KeysSet.add(key);
+ }
+ }
+ const startIndex = index;
+ if (buffer.length < 5)
+ throw new BSONError('corrupt bson message < 5 bytes long');
+ const size = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (size < 5 || size > buffer.length)
+ throw new BSONError('corrupt bson message');
+ const object = isArray ? [] : {};
+ let arrayIndex = 0;
+ let isPossibleDBRef = isArray ? false : null;
+ while (true) {
+ const elementType = buffer[index++];
+ if (elementType === 0)
+ break;
+ let i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.byteLength)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const name = isArray ? arrayIndex++ : ByteUtils.toUTF8(buffer, index, i, false);
+ let shouldValidateKey = true;
+ if (globalUTFValidation || utf8KeysSet?.has(name)) {
+ shouldValidateKey = validationSetting;
+ }
+ else {
+ shouldValidateKey = !validationSetting;
+ }
+ if (isPossibleDBRef !== false && name[0] === '$') {
+ isPossibleDBRef = allowedDBRefKeys.test(name);
+ }
+ let value;
+ index = i + 1;
+ if (elementType === BSON_DATA_STRING) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ value = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_OID) {
+ const oid = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oid[i] = buffer[index + i];
+ value = new ObjectId(oid);
+ index = index + 12;
+ }
+ else if (elementType === BSON_DATA_INT && promoteValues === false) {
+ value = new Int32(NumberUtils.getInt32LE(buffer, index));
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_INT) {
+ value = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_NUMBER) {
+ value = NumberUtils.getFloat64LE(buffer, index);
+ index += 8;
+ if (promoteValues === false)
+ value = new Double(value);
+ }
+ else if (elementType === BSON_DATA_DATE) {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ value = new Date(new Long(lowBits, highBits).toNumber());
+ }
+ else if (elementType === BSON_DATA_BOOLEAN) {
+ if (buffer[index] !== 0 && buffer[index] !== 1)
+ throw new BSONError('illegal boolean type value');
+ value = buffer[index++] === 1;
+ }
+ else if (elementType === BSON_DATA_OBJECT) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ if (objectSize <= 0 || objectSize > buffer.length - index)
+ throw new BSONError('bad embedded document length in bson');
+ if (raw) {
+ value = buffer.subarray(index, index + objectSize);
+ }
+ else {
+ let objectOptions = options;
+ if (!globalUTFValidation) {
+ objectOptions = { ...options, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, objectOptions, false);
+ }
+ index = index + objectSize;
+ }
+ else if (elementType === BSON_DATA_ARRAY) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ let arrayOptions = options;
+ const stopIndex = index + objectSize;
+ if (fieldsAsRaw && fieldsAsRaw[name]) {
+ arrayOptions = { ...options, raw: true };
+ }
+ if (!globalUTFValidation) {
+ arrayOptions = { ...arrayOptions, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, arrayOptions, true);
+ index = index + objectSize;
+ if (buffer[index - 1] !== 0)
+ throw new BSONError('invalid array terminator byte');
+ if (index !== stopIndex)
+ throw new BSONError('corrupted array bson');
+ }
+ else if (elementType === BSON_DATA_UNDEFINED) {
+ value = undefined;
+ }
+ else if (elementType === BSON_DATA_NULL) {
+ value = null;
+ }
+ else if (elementType === BSON_DATA_LONG) {
+ if (useBigInt64) {
+ value = NumberUtils.getBigInt64LE(buffer, index);
+ index += 8;
+ }
+ else {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ const long = new Long(lowBits, highBits);
+ if (promoteLongs && promoteValues === true) {
+ value =
+ long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG)
+ ? long.toNumber()
+ : long;
+ }
+ else {
+ value = long;
+ }
+ }
+ }
+ else if (elementType === BSON_DATA_DECIMAL128) {
+ const bytes = ByteUtils.allocateUnsafe(16);
+ for (let i = 0; i < 16; i++)
+ bytes[i] = buffer[index + i];
+ index = index + 16;
+ value = new Decimal128(bytes);
+ }
+ else if (elementType === BSON_DATA_BINARY) {
+ let binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ const totalBinarySize = binarySize;
+ const subType = buffer[index++];
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found');
+ if (binarySize > buffer.byteLength)
+ throw new BSONError('Binary type size larger than document size');
+ if (subType === Binary.SUBTYPE_BYTE_ARRAY) {
+ binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found for subtype 0x02');
+ if (binarySize > totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too long binary size');
+ if (binarySize < totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too short binary size');
+ }
+ if (promoteBuffers && promoteValues) {
+ value = ByteUtils.toLocalBufferType(buffer.subarray(index, index + binarySize));
+ }
+ else {
+ value = new Binary(buffer.subarray(index, index + binarySize), subType);
+ if (subType === BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
+ value = value.toUUID();
+ }
+ }
+ index = index + binarySize;
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === false) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ const optionsArray = new Array(regExpOptions.length);
+ for (i = 0; i < regExpOptions.length; i++) {
+ switch (regExpOptions[i]) {
+ case 'm':
+ optionsArray[i] = 'm';
+ break;
+ case 's':
+ optionsArray[i] = 'g';
+ break;
+ case 'i':
+ optionsArray[i] = 'i';
+ break;
+ }
+ }
+ value = new RegExp(source, optionsArray.join(''));
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === true) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ value = new BSONRegExp(source, regExpOptions);
+ }
+ else if (elementType === BSON_DATA_SYMBOL) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const symbol = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = promoteValues ? symbol : new BSONSymbol(symbol);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_TIMESTAMP) {
+ value = new Timestamp({
+ i: NumberUtils.getUint32LE(buffer, index),
+ t: NumberUtils.getUint32LE(buffer, index + 4)
+ });
+ index += 8;
+ }
+ else if (elementType === BSON_DATA_MIN_KEY) {
+ value = new MinKey();
+ }
+ else if (elementType === BSON_DATA_MAX_KEY) {
+ value = new MaxKey();
+ }
+ else if (elementType === BSON_DATA_CODE) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = new Code(functionString);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_CODE_W_SCOPE) {
+ const totalSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (totalSize < 4 + 4 + 4 + 1) {
+ throw new BSONError('code_w_scope total size shorter minimum expected length');
+ }
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ const scopeObject = deserializeObject(buffer, _index, options, false);
+ index = index + objectSize;
+ if (totalSize < 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too short, truncating scope');
+ }
+ if (totalSize > 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too long, clips outer document');
+ }
+ value = new Code(functionString, scopeObject);
+ }
+ else if (elementType === BSON_DATA_DBPOINTER) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0)
+ throw new BSONError('bad string length in bson');
+ const namespace = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const oidBuffer = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oidBuffer[i] = buffer[index + i];
+ const oid = new ObjectId(oidBuffer);
+ index = index + 12;
+ value = new DBRef(namespace, oid);
+ }
+ else {
+ throw new BSONError(`Detected unknown BSON type ${elementType.toString(16)} for fieldname "${name}"`);
+ }
+ if (name === '__proto__') {
+ Object.defineProperty(object, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ object[name] = value;
+ }
+ }
+ if (size !== index - startIndex) {
+ if (isArray)
+ throw new BSONError('corrupt array bson');
+ throw new BSONError('corrupt object bson');
+ }
+ if (!isPossibleDBRef)
+ return object;
+ if (isDBRefLike(object)) {
+ const copy = Object.assign({}, object);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(object.$ref, object.$id, object.$db, copy);
+ }
+ return object;
+}
+
+const regexp = /\x00/;
+const ignoreKeys = new Set(['$db', '$ref', '$id', '$clusterTime']);
+function serializeString(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_STRING;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes + 1;
+ buffer[index - 1] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value, index + 4);
+ NumberUtils.setInt32LE(buffer, index, size + 1);
+ index = index + 4 + size;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeNumber(buffer, key, value, index) {
+ const isNegativeZero = Object.is(value, -0);
+ const type = !isNegativeZero &&
+ Number.isSafeInteger(value) &&
+ value <= BSON_INT32_MAX &&
+ value >= BSON_INT32_MIN
+ ? BSON_DATA_INT
+ : BSON_DATA_NUMBER;
+ buffer[index++] = type;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0x00;
+ if (type === BSON_DATA_INT) {
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ }
+ else {
+ index += NumberUtils.setFloat64LE(buffer, index, value);
+ }
+ return index;
+}
+function serializeBigInt(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_LONG;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index += numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setBigInt64LE(buffer, index, value);
+ return index;
+}
+function serializeNull(buffer, key, _, index) {
+ buffer[index++] = BSON_DATA_NULL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeBoolean(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BOOLEAN;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ buffer[index++] = value ? 1 : 0;
+ return index;
+}
+function serializeDate(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DATE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const dateInMilis = Long.fromNumber(value.getTime());
+ const lowBits = dateInMilis.getLowBits();
+ const highBits = dateInMilis.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.source && value.source.match(regexp) != null) {
+ throw new BSONError('value ' + value.source + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.source, index);
+ buffer[index++] = 0x00;
+ if (value.ignoreCase)
+ buffer[index++] = 0x69;
+ if (value.global)
+ buffer[index++] = 0x73;
+ if (value.multiline)
+ buffer[index++] = 0x6d;
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeBSONRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.pattern.match(regexp) != null) {
+ throw new BSONError('pattern ' + value.pattern + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.pattern, index);
+ buffer[index++] = 0x00;
+ const sortedOptions = value.options.split('').sort().join('');
+ index = index + ByteUtils.encodeUTF8Into(buffer, sortedOptions, index);
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeMinMax(buffer, key, value, index) {
+ if (value === null) {
+ buffer[index++] = BSON_DATA_NULL;
+ }
+ else if (value._bsontype === 'MinKey') {
+ buffer[index++] = BSON_DATA_MIN_KEY;
+ }
+ else {
+ buffer[index++] = BSON_DATA_MAX_KEY;
+ }
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeObjectId(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_OID;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += value.serializeInto(buffer, index);
+ return index;
+}
+function serializeBuffer(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = value.length;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = BSON_BINARY_SUBTYPE_DEFAULT;
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = value[i];
+ }
+ else {
+ buffer.set(value, index);
+ }
+ index = index + size;
+ return index;
+}
+function serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path.has(value)) {
+ throw new BSONError('Cannot convert circular structure to BSON');
+ }
+ path.add(value);
+ buffer[index++] = Array.isArray(value) ? BSON_DATA_ARRAY : BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ path.delete(value);
+ return endIndex;
+}
+function serializeDecimal128(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DECIMAL128;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ for (let i = 0; i < 16; i++)
+ buffer[index + i] = value.bytes[i];
+ return index + 16;
+}
+function serializeLong(buffer, key, value, index) {
+ buffer[index++] =
+ value._bsontype === 'Long' ? BSON_DATA_LONG : BSON_DATA_TIMESTAMP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const lowBits = value.getLowBits();
+ const highBits = value.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeInt32(buffer, key, value, index) {
+ value = value.valueOf();
+ buffer[index++] = BSON_DATA_INT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ return index;
+}
+function serializeDouble(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_NUMBER;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setFloat64LE(buffer, index, value.value);
+ return index;
+}
+function serializeFunction(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeCode(buffer, key, value, index, checkKeys = false, depth = 0, serializeFunctions = false, ignoreUndefined = true, path) {
+ if (value.scope && typeof value.scope === 'object') {
+ buffer[index++] = BSON_DATA_CODE_W_SCOPE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ const functionString = value.code;
+ index = index + 4;
+ const codeSize = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, codeSize);
+ buffer[index + 4 + codeSize - 1] = 0;
+ index = index + codeSize + 4;
+ const endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ index = endIndex - 1;
+ const totalSize = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, startIndex, totalSize);
+ buffer[index++] = 0;
+ }
+ else {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.code.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ }
+ return index;
+}
+function serializeBinary(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const data = value.buffer;
+ let size = value.position;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY)
+ size = size + 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = value.sub_type;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ size = size - 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ }
+ if (value.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(value);
+ }
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = data[i];
+ }
+ else {
+ buffer.set(data, index);
+ }
+ index = index + value.position;
+ return index;
+}
+function serializeSymbol(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_SYMBOL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value.value, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path) {
+ buffer[index++] = BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ let output = {
+ $ref: value.collection || value.namespace,
+ $id: value.oid
+ };
+ if (value.db != null) {
+ output.$db = value.db;
+ }
+ output = Object.assign(output, value.fields);
+ const endIndex = serializeInto(buffer, output, false, index, depth + 1, serializeFunctions, true, path);
+ const size = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, index, size);
+ return endIndex;
+}
+function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path == null) {
+ if (object == null) {
+ buffer[0] = 0x05;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ buffer[4] = 0x00;
+ return 5;
+ }
+ if (Array.isArray(object)) {
+ throw new BSONError('serialize does not support an array as the root input');
+ }
+ if (typeof object !== 'object') {
+ throw new BSONError('serialize does not support non-object as the root input');
+ }
+ else if ('_bsontype' in object && typeof object._bsontype === 'string') {
+ throw new BSONError(`BSON types cannot be serialized as a document`);
+ }
+ else if (isDate(object) ||
+ isRegExp(object) ||
+ isUint8Array(object) ||
+ isAnyArrayBuffer(object)) {
+ throw new BSONError(`date, regexp, typedarray, and arraybuffer cannot be BSON documents`);
+ }
+ path = new Set();
+ }
+ path.add(object);
+ let index = startingIndex + 4;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ const key = `${i}`;
+ let value = object[i];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (value === undefined) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else if (object instanceof Map || isMap(object)) {
+ const iterator = object.entries();
+ let done = false;
+ while (!done) {
+ const entry = iterator.next();
+ done = !!entry.done;
+ if (done)
+ continue;
+ const key = entry.value ? entry.value[0] : undefined;
+ let value = entry.value ? entry.value[1] : undefined;
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ if (object != null && typeof object !== 'object') {
+ throw new BSONError('toBSON function did not return an object');
+ }
+ }
+ for (const key of Object.keys(object)) {
+ let value = object[key];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ path.delete(object);
+ buffer[index++] = 0x00;
+ const size = index - startingIndex;
+ startingIndex += NumberUtils.setInt32LE(buffer, startingIndex, size);
+ return index;
+}
+
+function isBSONType(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '_bsontype' in value &&
+ typeof value._bsontype === 'string');
+}
+const keysToCodecs = {
+ $oid: ObjectId,
+ $binary: Binary,
+ $uuid: Binary,
+ $symbol: BSONSymbol,
+ $numberInt: Int32,
+ $numberDecimal: Decimal128,
+ $numberDouble: Double,
+ $numberLong: Long,
+ $minKey: MinKey,
+ $maxKey: MaxKey,
+ $regex: BSONRegExp,
+ $regularExpression: BSONRegExp,
+ $timestamp: Timestamp
+};
+function deserializeValue(value, options = {}) {
+ if (typeof value === 'number') {
+ const in32BitRange = value <= BSON_INT32_MAX && value >= BSON_INT32_MIN;
+ const in64BitRange = value <= BSON_INT64_MAX && value >= BSON_INT64_MIN;
+ if (options.relaxed || options.legacy) {
+ return value;
+ }
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (in32BitRange) {
+ return new Int32(value);
+ }
+ if (in64BitRange) {
+ if (options.useBigInt64) {
+ return BigInt(value);
+ }
+ return Long.fromNumber(value);
+ }
+ }
+ return new Double(value);
+ }
+ if (value == null || typeof value !== 'object')
+ return value;
+ if (value.$undefined)
+ return null;
+ const keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);
+ for (let i = 0; i < keys.length; i++) {
+ const c = keysToCodecs[keys[i]];
+ if (c)
+ return c.fromExtendedJSON(value, options);
+ }
+ if (value.$date != null) {
+ const d = value.$date;
+ const date = new Date();
+ if (options.legacy) {
+ if (typeof d === 'number')
+ date.setTime(d);
+ else if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ else {
+ if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (Long.isLong(d))
+ date.setTime(d.toNumber());
+ else if (typeof d === 'number' && options.relaxed)
+ date.setTime(d);
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ return date;
+ }
+ if (value.$code != null) {
+ const copy = Object.assign({}, value);
+ if (value.$scope) {
+ copy.$scope = deserializeValue(value.$scope);
+ }
+ return Code.fromExtendedJSON(value);
+ }
+ if (isDBRefLike(value) || value.$dbPointer) {
+ const v = value.$ref ? value : value.$dbPointer;
+ if (v instanceof DBRef)
+ return v;
+ const dollarKeys = Object.keys(v).filter(k => k.startsWith('$'));
+ let valid = true;
+ dollarKeys.forEach(k => {
+ if (['$ref', '$id', '$db'].indexOf(k) === -1)
+ valid = false;
+ });
+ if (valid)
+ return DBRef.fromExtendedJSON(v);
+ }
+ return value;
+}
+function serializeArray(array, options) {
+ return array.map((v, index) => {
+ options.seenObjects.push({ propertyName: `index ${index}`, obj: null });
+ try {
+ return serializeValue(v, options);
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ });
+}
+function getISOString(date) {
+ const isoStr = date.toISOString();
+ return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';
+}
+function serializeValue(value, options) {
+ if (value instanceof Map || isMap(value)) {
+ const obj = Object.create(null);
+ for (const [k, v] of value) {
+ if (typeof k !== 'string') {
+ throw new BSONError('Can only serialize maps with string keys');
+ }
+ obj[k] = v;
+ }
+ return serializeValue(obj, options);
+ }
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null) {
+ const index = options.seenObjects.findIndex(entry => entry.obj === value);
+ if (index !== -1) {
+ const props = options.seenObjects.map(entry => entry.propertyName);
+ const leadingPart = props
+ .slice(0, index)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const alreadySeen = props[index];
+ const circularPart = ' -> ' +
+ props
+ .slice(index + 1, props.length - 1)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const current = props[props.length - 1];
+ const leadingSpace = ' '.repeat(leadingPart.length + alreadySeen.length / 2);
+ const dashes = '-'.repeat(circularPart.length + (alreadySeen.length + current.length) / 2 - 1);
+ throw new BSONError('Converting circular structure to EJSON:\n' +
+ ` ${leadingPart}${alreadySeen}${circularPart}${current}\n` +
+ ` ${leadingSpace}\\${dashes}/`);
+ }
+ options.seenObjects[options.seenObjects.length - 1].obj = value;
+ }
+ if (Array.isArray(value))
+ return serializeArray(value, options);
+ if (value === undefined)
+ return options.ignoreUndefined ? undefined : null;
+ if (value instanceof Date || isDate(value)) {
+ const dateNum = value.getTime(), inRange = dateNum > -1 && dateNum < 253402318800000;
+ if (options.legacy) {
+ return options.relaxed && inRange
+ ? { $date: value.getTime() }
+ : { $date: getISOString(value) };
+ }
+ return options.relaxed && inRange
+ ? { $date: getISOString(value) }
+ : { $date: { $numberLong: value.getTime().toString() } };
+ }
+ if (typeof value === 'number' && (!options.relaxed || !isFinite(value))) {
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return { $numberInt: value.toString() };
+ }
+ if (value >= BSON_INT64_MIN && value <= BSON_INT64_MAX) {
+ return { $numberLong: value.toString() };
+ }
+ }
+ return { $numberDouble: Object.is(value, -0) ? '-0.0' : value.toString() };
+ }
+ if (typeof value === 'bigint') {
+ if (!options.relaxed) {
+ return { $numberLong: BigInt.asIntN(64, value).toString() };
+ }
+ return Number(BigInt.asIntN(64, value));
+ }
+ if (value instanceof RegExp || isRegExp(value)) {
+ let flags = value.flags;
+ if (flags === undefined) {
+ const match = value.toString().match(/[gimuy]*$/);
+ if (match) {
+ flags = match[0];
+ }
+ }
+ const rx = new BSONRegExp(value.source, flags);
+ return rx.toExtendedJSON(options);
+ }
+ if (value != null && typeof value === 'object')
+ return serializeDocument(value, options);
+ return value;
+}
+const BSON_TYPE_MAPPINGS = {
+ Binary: (o) => new Binary(o.value(), o.sub_type),
+ Code: (o) => new Code(o.code, o.scope),
+ DBRef: (o) => new DBRef(o.collection || o.namespace, o.oid, o.db, o.fields),
+ Decimal128: (o) => new Decimal128(o.bytes),
+ Double: (o) => new Double(o.value),
+ Int32: (o) => new Int32(o.value),
+ 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_),
+ MaxKey: () => new MaxKey(),
+ MinKey: () => new MinKey(),
+ ObjectId: (o) => new ObjectId(o),
+ BSONRegExp: (o) => new BSONRegExp(o.pattern, o.options),
+ BSONSymbol: (o) => new BSONSymbol(o.value),
+ Timestamp: (o) => Timestamp.fromBits(o.low, o.high)
+};
+function serializeDocument(doc, options) {
+ if (doc == null || typeof doc !== 'object')
+ throw new BSONError('not an object instance');
+ const bsontype = doc._bsontype;
+ if (typeof bsontype === 'undefined') {
+ const _doc = {};
+ for (const name of Object.keys(doc)) {
+ options.seenObjects.push({ propertyName: name, obj: null });
+ try {
+ const value = serializeValue(doc[name], options);
+ if (name === '__proto__') {
+ Object.defineProperty(_doc, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ _doc[name] = value;
+ }
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ }
+ return _doc;
+ }
+ else if (doc != null &&
+ typeof doc === 'object' &&
+ typeof doc._bsontype === 'string' &&
+ doc[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (isBSONType(doc)) {
+ let outDoc = doc;
+ if (typeof outDoc.toExtendedJSON !== 'function') {
+ const mapper = BSON_TYPE_MAPPINGS[doc._bsontype];
+ if (!mapper) {
+ throw new BSONError('Unrecognized or invalid _bsontype: ' + doc._bsontype);
+ }
+ outDoc = mapper(outDoc);
+ }
+ if (bsontype === 'Code' && outDoc.scope) {
+ outDoc = new Code(outDoc.code, serializeValue(outDoc.scope, options));
+ }
+ else if (bsontype === 'DBRef' && outDoc.oid) {
+ outDoc = new DBRef(serializeValue(outDoc.collection, options), serializeValue(outDoc.oid, options), serializeValue(outDoc.db, options), serializeValue(outDoc.fields, options));
+ }
+ return outDoc.toExtendedJSON(options);
+ }
+ else {
+ throw new BSONError('_bsontype must be a string, but was: ' + typeof bsontype);
+ }
+}
+function parse(text, options) {
+ const ejsonOptions = {
+ useBigInt64: options?.useBigInt64 ?? false,
+ relaxed: options?.relaxed ?? true,
+ legacy: options?.legacy ?? false
+ };
+ return JSON.parse(text, (key, value) => {
+ if (key.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Document field names cannot contain null bytes, found: ${JSON.stringify(key)}`);
+ }
+ return deserializeValue(value, ejsonOptions);
+ });
+}
+function stringify(value, replacer, space, options) {
+ if (space != null && typeof space === 'object') {
+ options = space;
+ space = 0;
+ }
+ if (replacer != null && typeof replacer === 'object' && !Array.isArray(replacer)) {
+ options = replacer;
+ replacer = undefined;
+ space = 0;
+ }
+ const serializeOptions = Object.assign({ relaxed: true, legacy: false }, options, {
+ seenObjects: [{ propertyName: '(root)', obj: null }]
+ });
+ const doc = serializeValue(value, serializeOptions);
+ return JSON.stringify(doc, replacer, space);
+}
+function EJSONserialize(value, options) {
+ options = options || {};
+ return JSON.parse(stringify(value, options));
+}
+function EJSONdeserialize(ejson, options) {
+ options = options || {};
+ return parse(JSON.stringify(ejson), options);
+}
+const EJSON = Object.create(null);
+EJSON.parse = parse;
+EJSON.stringify = stringify;
+EJSON.serialize = EJSONserialize;
+EJSON.deserialize = EJSONdeserialize;
+Object.freeze(EJSON);
+
+const BSONElementType = {
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: 255,
+ maxKey: 127
+};
+function getSize(source, offset) {
+ try {
+ return NumberUtils.getNonnegativeInt32LE(source, offset);
+ }
+ catch (cause) {
+ throw new BSONOffsetError('BSON size cannot be negative', offset, { cause });
+ }
+}
+function findNull(bytes, offset) {
+ let nullTerminatorOffset = offset;
+ for (; bytes[nullTerminatorOffset] !== 0x00; nullTerminatorOffset++)
+ ;
+ if (nullTerminatorOffset === bytes.length - 1) {
+ throw new BSONOffsetError('Null terminator not found', offset);
+ }
+ return nullTerminatorOffset;
+}
+function parseToElements(bytes, startOffset = 0) {
+ startOffset ??= 0;
+ if (bytes.length < 5) {
+ throw new BSONOffsetError(`Input must be at least 5 bytes, got ${bytes.length} bytes`, startOffset);
+ }
+ const documentSize = getSize(bytes, startOffset);
+ if (documentSize > bytes.length - startOffset) {
+ throw new BSONOffsetError(`Parsed documentSize (${documentSize} bytes) does not match input length (${bytes.length} bytes)`, startOffset);
+ }
+ if (bytes[startOffset + documentSize - 1] !== 0x00) {
+ throw new BSONOffsetError('BSON documents must end in 0x00', startOffset + documentSize);
+ }
+ const elements = [];
+ let offset = startOffset + 4;
+ while (offset <= documentSize + startOffset) {
+ const type = bytes[offset];
+ offset += 1;
+ if (type === 0) {
+ if (offset - startOffset !== documentSize) {
+ throw new BSONOffsetError(`Invalid 0x00 type byte`, offset);
+ }
+ break;
+ }
+ const nameOffset = offset;
+ const nameLength = findNull(bytes, offset) - nameOffset;
+ offset += nameLength + 1;
+ let length;
+ if (type === BSONElementType.double ||
+ type === BSONElementType.long ||
+ type === BSONElementType.date ||
+ type === BSONElementType.timestamp) {
+ length = 8;
+ }
+ else if (type === BSONElementType.int) {
+ length = 4;
+ }
+ else if (type === BSONElementType.objectId) {
+ length = 12;
+ }
+ else if (type === BSONElementType.decimal) {
+ length = 16;
+ }
+ else if (type === BSONElementType.bool) {
+ length = 1;
+ }
+ else if (type === BSONElementType.null ||
+ type === BSONElementType.undefined ||
+ type === BSONElementType.maxKey ||
+ type === BSONElementType.minKey) {
+ length = 0;
+ }
+ else if (type === BSONElementType.regex) {
+ length = findNull(bytes, findNull(bytes, offset) + 1) + 1 - offset;
+ }
+ else if (type === BSONElementType.object ||
+ type === BSONElementType.array ||
+ type === BSONElementType.javascriptWithScope) {
+ length = getSize(bytes, offset);
+ }
+ else if (type === BSONElementType.string ||
+ type === BSONElementType.binData ||
+ type === BSONElementType.dbPointer ||
+ type === BSONElementType.javascript ||
+ type === BSONElementType.symbol) {
+ length = getSize(bytes, offset) + 4;
+ if (type === BSONElementType.binData) {
+ length += 1;
+ }
+ if (type === BSONElementType.dbPointer) {
+ length += 12;
+ }
+ }
+ else {
+ throw new BSONOffsetError(`Invalid 0x${type.toString(16).padStart(2, '0')} type byte`, offset);
+ }
+ if (length > documentSize) {
+ throw new BSONOffsetError('value reports length larger than document', offset);
+ }
+ elements.push([type, nameOffset, nameLength, offset, length]);
+ offset += length;
+ }
+ return elements;
+}
+
+const onDemand = Object.create(null);
+onDemand.parseToElements = parseToElements;
+onDemand.ByteUtils = ByteUtils;
+onDemand.NumberUtils = NumberUtils;
+Object.freeze(onDemand);
+
+const MAXSIZE = 1024 * 1024 * 17;
+let buffer = ByteUtils.allocate(MAXSIZE);
+function setInternalBufferSize(size) {
+ if (buffer.length < size) {
+ buffer = ByteUtils.allocate(size);
+ }
+}
+function serialize(object, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const minInternalBufferSize = typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE;
+ if (buffer.length < minInternalBufferSize) {
+ buffer = ByteUtils.allocate(minInternalBufferSize);
+ }
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ const finishedBuffer = ByteUtils.allocateUnsafe(serializationIndex);
+ finishedBuffer.set(buffer.subarray(0, serializationIndex), 0);
+ return finishedBuffer;
+}
+function serializeWithBufferAndIndex(object, finalBuffer, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const startIndex = typeof options.index === 'number' ? options.index : 0;
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ finalBuffer.set(buffer.subarray(0, serializationIndex), startIndex);
+ return startIndex + serializationIndex - 1;
+}
+function deserialize(buffer, options = {}) {
+ return internalDeserialize(ByteUtils.toLocalBufferType(buffer), options);
+}
+function calculateObjectSize(object, options = {}) {
+ options = options || {};
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ return internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined);
+}
+function deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {
+ const internalOptions = Object.assign({ allowObjectSmallerThanBufferSize: true, index: 0 }, options);
+ const bufferData = ByteUtils.toLocalBufferType(data);
+ let index = startIndex;
+ for (let i = 0; i < numberOfDocuments; i++) {
+ const size = NumberUtils.getInt32LE(bufferData, index);
+ internalOptions.index = index;
+ documents[docStartIndex + i] = internalDeserialize(bufferData, internalOptions);
+ index = index + size;
+ }
+ return index;
+}
+
+var bson = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ BSONError: BSONError,
+ BSONOffsetError: BSONOffsetError,
+ BSONRegExp: BSONRegExp,
+ BSONRuntimeError: BSONRuntimeError,
+ BSONSymbol: BSONSymbol,
+ BSONType: BSONType,
+ BSONValue: BSONValue,
+ BSONVersionError: BSONVersionError,
+ Binary: Binary,
+ ByteUtils: ByteUtils,
+ Code: Code,
+ DBRef: DBRef,
+ Decimal128: Decimal128,
+ Double: Double,
+ EJSON: EJSON,
+ Int32: Int32,
+ Long: Long,
+ MaxKey: MaxKey,
+ MinKey: MinKey,
+ NumberUtils: NumberUtils,
+ ObjectId: ObjectId,
+ Timestamp: Timestamp,
+ UUID: UUID,
+ bsonType: bsonType,
+ calculateObjectSize: calculateObjectSize,
+ deserialize: deserialize,
+ deserializeStream: deserializeStream,
+ onDemand: onDemand,
+ serialize: serialize,
+ serializeWithBufferAndIndex: serializeWithBufferAndIndex,
+ setInternalBufferSize: setInternalBufferSize
+});
+
+export { bson as BSON, BSONError, BSONOffsetError, BSONRegExp, BSONRuntimeError, BSONSymbol, BSONType, BSONValue, BSONVersionError, Binary, ByteUtils, Code, DBRef, Decimal128, Double, EJSON, Int32, Long, MaxKey, MinKey, NumberUtils, ObjectId, Timestamp, UUID, bsonType, calculateObjectSize, deserialize, deserializeStream, onDemand, serialize, serializeWithBufferAndIndex, setInternalBufferSize };
+//# sourceMappingURL=bson.mjs.map
diff --git a/node_modules/bson/lib/bson.mjs.map b/node_modules/bson/lib/bson.mjs.map
new file mode 100644
index 00000000..abe9f8e6
--- /dev/null
+++ b/node_modules/bson/lib/bson.mjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"bson.mjs","sources":["../src/parser/utils.ts","../src/constants.ts","../src/error.ts","../src/parse_utf8.ts","../src/utils/latin.ts","../src/utils/node_byte_utils.ts","../src/utils/web_byte_utils.ts","../src/utils/byte_utils.ts","../src/bson_value.ts","../src/utils/number_utils.ts","../src/binary.ts","../src/code.ts","../src/db_ref.ts","../src/utils/string_utils.ts","../src/long.ts","../src/decimal128.ts","../src/double.ts","../src/int_32.ts","../src/max_key.ts","../src/min_key.ts","../src/objectid.ts","../src/parser/calculate_size.ts","../src/regexp.ts","../src/symbol.ts","../src/timestamp.ts","../src/parser/deserializer.ts","../src/parser/serializer.ts","../src/extended_json.ts","../src/parser/on_demand/parse_to_elements.ts","../src/parser/on_demand/index.ts","../src/bson.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["StringUtils.validateStringCharacters","StringUtils.removeLeadingZerosAndExplicitPlus","constants.JS_INT_MIN","constants.JS_INT_MAX","constants.BSON_INT32_MIN","constants.BSON_INT32_MAX","constants.BSON_VERSION_SYMBOL","constants.BSON_MAJOR_VERSION","constants.BSON_DATA_STRING","constants.BSON_DATA_OID","constants.BSON_DATA_INT","constants.BSON_DATA_NUMBER","constants.BSON_DATA_DATE","constants.BSON_DATA_BOOLEAN","constants.BSON_DATA_OBJECT","constants.BSON_DATA_ARRAY","constants.BSON_DATA_UNDEFINED","constants.BSON_DATA_NULL","constants.BSON_DATA_LONG","constants.BSON_DATA_DECIMAL128","constants.BSON_DATA_BINARY","constants.BSON_BINARY_SUBTYPE_UUID_NEW","constants.BSON_DATA_REGEXP","constants.BSON_DATA_SYMBOL","constants.BSON_DATA_TIMESTAMP","constants.BSON_DATA_MIN_KEY","constants.BSON_DATA_MAX_KEY","constants.BSON_DATA_CODE","constants.BSON_DATA_CODE_W_SCOPE","constants.BSON_DATA_DBPOINTER","constants.BSON_BINARY_SUBTYPE_DEFAULT"],"mappings":"AAAA,MAAM,uCAAuC,GAAG,CAAC,MAAK;IAIpD,MAAM,CAAC,GAAG,MAAM,CAAC,wBAAwB,CACvC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAC3C,MAAM,CAAC,WAAW,CAClB,CAAC,GAAI;IAEP,OAAO,CAAC,KAAc,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1C,CAAC,GAAG;AAEE,SAAU,YAAY,CAAC,KAAc,EAAA;AACzC,IAAA,OAAO,uCAAuC,CAAC,KAAK,CAAC,KAAK,YAAY;AACxE;AAEM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,QACE,OAAO,KAAK,KAAK,QAAQ;AACzB,QAAA,KAAK,IAAI,IAAI;QACb,MAAM,CAAC,WAAW,IAAI,KAAK;AAC3B,SAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,aAAa;YAC1C,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,mBAAmB,CAAC;AAExD;AAEM,SAAU,QAA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AAC,EAAE,CAAC,GAAG,iBAAiB,EAAE,CAAC,EAAE,EAAE;QAE1C,MAAM,IAAI,GAAG,WAAW,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC;AAEtD,QAAA,eAAe,CAAC,KAAK,GAAG,KAAK;AAE7B,QAAA,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC,GAAG,mBAAmB,CAAC,UAAU,EAAE,eAAe,CAAC;AAE/E,QAAA,KAAK,GAAG,KAAK,GAAG,IAAI;IACtB;AAGA,IAAA,OAAO,KAAK;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/node_modules/bson/lib/bson.node.mjs b/node_modules/bson/lib/bson.node.mjs
new file mode 100644
index 00000000..623403e3
--- /dev/null
+++ b/node_modules/bson/lib/bson.node.mjs
@@ -0,0 +1,4712 @@
+const TypedArrayPrototypeGetSymbolToStringTag = (() => {
+ const g = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get;
+ return (value) => g.call(value);
+})();
+function isUint8Array(value) {
+ return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array';
+}
+function isAnyArrayBuffer(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ (value[Symbol.toStringTag] === 'ArrayBuffer' ||
+ value[Symbol.toStringTag] === 'SharedArrayBuffer'));
+}
+function isRegExp(regexp) {
+ return regexp instanceof RegExp || Object.prototype.toString.call(regexp) === '[object RegExp]';
+}
+function isMap(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ value[Symbol.toStringTag] === 'Map');
+}
+function isDate(date) {
+ return date instanceof Date || Object.prototype.toString.call(date) === '[object Date]';
+}
+function defaultInspect(x, _options) {
+ return JSON.stringify(x, (k, v) => {
+ if (typeof v === 'bigint') {
+ return { $numberLong: `${v}` };
+ }
+ else if (isMap(v)) {
+ return Object.fromEntries(v);
+ }
+ return v;
+ });
+}
+function getStylizeFunction(options) {
+ const stylizeExists = options != null &&
+ typeof options === 'object' &&
+ 'stylize' in options &&
+ typeof options.stylize === 'function';
+ if (stylizeExists) {
+ return options.stylize;
+ }
+}
+
+const BSON_MAJOR_VERSION = 7;
+const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version');
+const BSON_INT32_MAX = 0x7fffffff;
+const BSON_INT32_MIN = -2147483648;
+const BSON_INT64_MAX = Math.pow(2, 63) - 1;
+const BSON_INT64_MIN = -Math.pow(2, 63);
+const JS_INT_MAX = Math.pow(2, 53);
+const JS_INT_MIN = -Math.pow(2, 53);
+const BSON_DATA_NUMBER = 1;
+const BSON_DATA_STRING = 2;
+const BSON_DATA_OBJECT = 3;
+const BSON_DATA_ARRAY = 4;
+const BSON_DATA_BINARY = 5;
+const BSON_DATA_UNDEFINED = 6;
+const BSON_DATA_OID = 7;
+const BSON_DATA_BOOLEAN = 8;
+const BSON_DATA_DATE = 9;
+const BSON_DATA_NULL = 10;
+const BSON_DATA_REGEXP = 11;
+const BSON_DATA_DBPOINTER = 12;
+const BSON_DATA_CODE = 13;
+const BSON_DATA_SYMBOL = 14;
+const BSON_DATA_CODE_W_SCOPE = 15;
+const BSON_DATA_INT = 16;
+const BSON_DATA_TIMESTAMP = 17;
+const BSON_DATA_LONG = 18;
+const BSON_DATA_DECIMAL128 = 19;
+const BSON_DATA_MIN_KEY = 0xff;
+const BSON_DATA_MAX_KEY = 0x7f;
+const BSON_BINARY_SUBTYPE_DEFAULT = 0;
+const BSON_BINARY_SUBTYPE_UUID_NEW = 4;
+const BSONType = Object.freeze({
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: -1,
+ maxKey: 127
+});
+
+class BSONError extends Error {
+ get bsonError() {
+ return true;
+ }
+ get name() {
+ return 'BSONError';
+ }
+ constructor(message, options) {
+ super(message, options);
+ }
+ static isBSONError(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ 'bsonError' in value &&
+ value.bsonError === true &&
+ 'name' in value &&
+ 'message' in value &&
+ 'stack' in value);
+ }
+}
+class BSONVersionError extends BSONError {
+ get name() {
+ return 'BSONVersionError';
+ }
+ constructor() {
+ super(`Unsupported BSON version, bson types must be from bson ${BSON_MAJOR_VERSION}.x.x`);
+ }
+}
+class BSONRuntimeError extends BSONError {
+ get name() {
+ return 'BSONRuntimeError';
+ }
+ constructor(message) {
+ super(message);
+ }
+}
+class BSONOffsetError extends BSONError {
+ get name() {
+ return 'BSONOffsetError';
+ }
+ offset;
+ constructor(message, offset, options) {
+ super(`${message}. offset: ${offset}`, options);
+ this.offset = offset;
+ }
+}
+
+let TextDecoderFatal;
+let TextDecoderNonFatal;
+function parseUtf8(buffer, start, end, fatal) {
+ if (fatal) {
+ TextDecoderFatal ??= new TextDecoder('utf8', { fatal: true });
+ try {
+ return TextDecoderFatal.decode(buffer.subarray(start, end));
+ }
+ catch (cause) {
+ throw new BSONError('Invalid UTF-8 string in BSON document', { cause });
+ }
+ }
+ TextDecoderNonFatal ??= new TextDecoder('utf8', { fatal: false });
+ return TextDecoderNonFatal.decode(buffer.subarray(start, end));
+}
+
+function tryReadBasicLatin(uint8array, start, end) {
+ if (uint8array.length === 0) {
+ return '';
+ }
+ const stringByteLength = end - start;
+ if (stringByteLength === 0) {
+ return '';
+ }
+ if (stringByteLength > 20) {
+ return null;
+ }
+ if (stringByteLength === 1 && uint8array[start] < 128) {
+ return String.fromCharCode(uint8array[start]);
+ }
+ if (stringByteLength === 2 && uint8array[start] < 128 && uint8array[start + 1] < 128) {
+ return String.fromCharCode(uint8array[start]) + String.fromCharCode(uint8array[start + 1]);
+ }
+ if (stringByteLength === 3 &&
+ uint8array[start] < 128 &&
+ uint8array[start + 1] < 128 &&
+ uint8array[start + 2] < 128) {
+ return (String.fromCharCode(uint8array[start]) +
+ String.fromCharCode(uint8array[start + 1]) +
+ String.fromCharCode(uint8array[start + 2]));
+ }
+ const latinBytes = [];
+ for (let i = start; i < end; i++) {
+ const byte = uint8array[i];
+ if (byte > 127) {
+ return null;
+ }
+ latinBytes.push(byte);
+ }
+ return String.fromCharCode(...latinBytes);
+}
+function tryWriteBasicLatin(destination, source, offset) {
+ if (source.length === 0)
+ return 0;
+ if (source.length > 25)
+ return null;
+ if (destination.length - offset < source.length)
+ return null;
+ for (let charOffset = 0, destinationOffset = offset; charOffset < source.length; charOffset++, destinationOffset++) {
+ const char = source.charCodeAt(charOffset);
+ if (char > 127)
+ return null;
+ destination[destinationOffset] = char;
+ }
+ return source.length;
+}
+
+function nodejsMathRandomBytes(byteLength) {
+ return nodeJsByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+function nodejsSecureRandomBytes(byteLength) {
+ return crypto.getRandomValues(nodeJsByteUtils.allocate(byteLength));
+}
+const nodejsRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return nodejsSecureRandomBytes;
+ }
+ else {
+ return nodejsMathRandomBytes;
+ }
+})();
+const nodeJsByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialBuffer) {
+ if (Buffer.isBuffer(potentialBuffer)) {
+ return potentialBuffer;
+ }
+ if (ArrayBuffer.isView(potentialBuffer)) {
+ return Buffer.from(potentialBuffer.buffer, potentialBuffer.byteOffset, potentialBuffer.byteLength);
+ }
+ const stringTag = potentialBuffer?.[Symbol.toStringTag] ?? Object.prototype.toString.call(potentialBuffer);
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return Buffer.from(potentialBuffer);
+ }
+ throw new BSONError(`Cannot create Buffer from the passed potentialBuffer.`);
+ },
+ allocate(size) {
+ return Buffer.alloc(size);
+ },
+ allocateUnsafe(size) {
+ return Buffer.allocUnsafe(size);
+ },
+ compare(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).compare(b);
+ },
+ concat(list) {
+ return Buffer.concat(list);
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ return nodeJsByteUtils
+ .toLocalBufferType(source)
+ .copy(target, targetStart ?? 0, sourceStart ?? 0, sourceEnd ?? source.length);
+ },
+ equals(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).equals(b);
+ },
+ fromNumberArray(array) {
+ return Buffer.from(array);
+ },
+ fromBase64(base64) {
+ return Buffer.from(base64, 'base64');
+ },
+ fromUTF8(utf8) {
+ return Buffer.from(utf8, 'utf8');
+ },
+ toBase64(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('base64');
+ },
+ fromISO88591(codePoints) {
+ return Buffer.from(codePoints, 'binary');
+ },
+ toISO88591(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('binary');
+ },
+ fromHex(hex) {
+ return Buffer.from(hex, 'hex');
+ },
+ toHex(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('hex');
+ },
+ toUTF8(buffer, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(buffer, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ const string = nodeJsByteUtils.toLocalBufferType(buffer).toString('utf8', start, end);
+ if (fatal) {
+ for (let i = 0; i < string.length; i++) {
+ if (string.charCodeAt(i) === 0xfffd) {
+ parseUtf8(buffer, start, end, true);
+ break;
+ }
+ }
+ }
+ return string;
+ },
+ utf8ByteLength(input) {
+ return Buffer.byteLength(input, 'utf8');
+ },
+ encodeUTF8Into(buffer, source, byteOffset) {
+ const latinBytesWritten = tryWriteBasicLatin(buffer, source, byteOffset);
+ if (latinBytesWritten != null) {
+ return latinBytesWritten;
+ }
+ return nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8');
+ },
+ randomBytes: nodejsRandomBytes,
+ swap32(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).swap32();
+ }
+};
+
+function isReactNative() {
+ const { navigator } = globalThis;
+ return typeof navigator === 'object' && navigator.product === 'ReactNative';
+}
+function webMathRandomBytes(byteLength) {
+ if (byteLength < 0) {
+ throw new RangeError(`The argument 'byteLength' is invalid. Received ${byteLength}`);
+ }
+ return webByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+const webRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return (byteLength) => {
+ return crypto.getRandomValues(webByteUtils.allocate(byteLength));
+ };
+ }
+ else {
+ if (isReactNative()) {
+ const { console } = globalThis;
+ console?.warn?.('BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.');
+ }
+ return webMathRandomBytes;
+ }
+})();
+const HEX_DIGIT = /(\d|[a-f])/i;
+const webByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialUint8array) {
+ const stringTag = potentialUint8array?.[Symbol.toStringTag] ??
+ Object.prototype.toString.call(potentialUint8array);
+ if (stringTag === 'Uint8Array') {
+ return potentialUint8array;
+ }
+ if (ArrayBuffer.isView(potentialUint8array)) {
+ return new Uint8Array(potentialUint8array.buffer.slice(potentialUint8array.byteOffset, potentialUint8array.byteOffset + potentialUint8array.byteLength));
+ }
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return new Uint8Array(potentialUint8array);
+ }
+ throw new BSONError(`Cannot make a Uint8Array from passed potentialBuffer.`);
+ },
+ allocate(size) {
+ if (typeof size !== 'number') {
+ throw new TypeError(`The "size" argument must be of type number. Received ${String(size)}`);
+ }
+ return new Uint8Array(size);
+ },
+ allocateUnsafe(size) {
+ return webByteUtils.allocate(size);
+ },
+ compare(uint8Array, otherUint8Array) {
+ if (uint8Array === otherUint8Array)
+ return 0;
+ const len = Math.min(uint8Array.length, otherUint8Array.length);
+ for (let i = 0; i < len; i++) {
+ if (uint8Array[i] < otherUint8Array[i])
+ return -1;
+ if (uint8Array[i] > otherUint8Array[i])
+ return 1;
+ }
+ if (uint8Array.length < otherUint8Array.length)
+ return -1;
+ if (uint8Array.length > otherUint8Array.length)
+ return 1;
+ return 0;
+ },
+ concat(uint8Arrays) {
+ if (uint8Arrays.length === 0)
+ return webByteUtils.allocate(0);
+ let totalLength = 0;
+ for (const uint8Array of uint8Arrays) {
+ totalLength += uint8Array.length;
+ }
+ const result = webByteUtils.allocate(totalLength);
+ let offset = 0;
+ for (const uint8Array of uint8Arrays) {
+ result.set(uint8Array, offset);
+ offset += uint8Array.length;
+ }
+ return result;
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ if (sourceEnd !== undefined && sourceEnd < 0) {
+ throw new RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${sourceEnd}`);
+ }
+ sourceEnd = sourceEnd ?? source.length;
+ if (sourceStart !== undefined && (sourceStart < 0 || sourceStart > sourceEnd)) {
+ throw new RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${sourceEnd}. Received ${sourceStart}`);
+ }
+ sourceStart = sourceStart ?? 0;
+ if (targetStart !== undefined && targetStart < 0) {
+ throw new RangeError(`The value of "targetStart" is out of range. It must be >= 0. Received ${targetStart}`);
+ }
+ targetStart = targetStart ?? 0;
+ const srcSlice = source.subarray(sourceStart, sourceEnd);
+ const maxLen = Math.min(srcSlice.length, target.length - targetStart);
+ if (maxLen <= 0) {
+ return 0;
+ }
+ target.set(srcSlice.subarray(0, maxLen), targetStart);
+ return maxLen;
+ },
+ equals(uint8Array, otherUint8Array) {
+ if (uint8Array.byteLength !== otherUint8Array.byteLength) {
+ return false;
+ }
+ for (let i = 0; i < uint8Array.byteLength; i++) {
+ if (uint8Array[i] !== otherUint8Array[i]) {
+ return false;
+ }
+ }
+ return true;
+ },
+ fromNumberArray(array) {
+ return Uint8Array.from(array);
+ },
+ fromBase64(base64) {
+ return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
+ },
+ fromUTF8(utf8) {
+ return new TextEncoder().encode(utf8);
+ },
+ toBase64(uint8array) {
+ return btoa(webByteUtils.toISO88591(uint8array));
+ },
+ fromISO88591(codePoints) {
+ return Uint8Array.from(codePoints, c => c.charCodeAt(0) & 0xff);
+ },
+ toISO88591(uint8array) {
+ return Array.from(Uint16Array.from(uint8array), b => String.fromCharCode(b)).join('');
+ },
+ fromHex(hex) {
+ const evenLengthHex = hex.length % 2 === 0 ? hex : hex.slice(0, hex.length - 1);
+ const buffer = [];
+ for (let i = 0; i < evenLengthHex.length; i += 2) {
+ const firstDigit = evenLengthHex[i];
+ const secondDigit = evenLengthHex[i + 1];
+ if (!HEX_DIGIT.test(firstDigit)) {
+ break;
+ }
+ if (!HEX_DIGIT.test(secondDigit)) {
+ break;
+ }
+ const hexDigit = Number.parseInt(`${firstDigit}${secondDigit}`, 16);
+ buffer.push(hexDigit);
+ }
+ return Uint8Array.from(buffer);
+ },
+ toHex(uint8array) {
+ return Array.from(uint8array, byte => byte.toString(16).padStart(2, '0')).join('');
+ },
+ toUTF8(uint8array, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(uint8array, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ return parseUtf8(uint8array, start, end, fatal);
+ },
+ utf8ByteLength(input) {
+ return new TextEncoder().encode(input).byteLength;
+ },
+ encodeUTF8Into(uint8array, source, byteOffset) {
+ const bytes = new TextEncoder().encode(source);
+ uint8array.set(bytes, byteOffset);
+ return bytes.byteLength;
+ },
+ randomBytes: webRandomBytes,
+ swap32(buffer) {
+ if (buffer.length % 4 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 32-bits');
+ }
+ for (let i = 0; i < buffer.length; i += 4) {
+ const byte0 = buffer[i];
+ const byte1 = buffer[i + 1];
+ const byte2 = buffer[i + 2];
+ const byte3 = buffer[i + 3];
+ buffer[i] = byte3;
+ buffer[i + 1] = byte2;
+ buffer[i + 2] = byte1;
+ buffer[i + 3] = byte0;
+ }
+ return buffer;
+ }
+};
+
+const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true;
+const ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
+
+const bsonType = Symbol.for('@@mdb.bson.type');
+class BSONValue {
+ get [bsonType]() {
+ return this._bsontype;
+ }
+ get [BSON_VERSION_SYMBOL]() {
+ return BSON_MAJOR_VERSION;
+ }
+ [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {
+ return this.inspect(depth, options, inspect);
+ }
+}
+
+const FLOAT = new Float64Array(1);
+const FLOAT_BYTES = new Uint8Array(FLOAT.buffer, 0, 8);
+FLOAT[0] = -1;
+const isBigEndian = FLOAT_BYTES[7] === 0;
+const NumberUtils = {
+ isBigEndian,
+ getNonnegativeInt32LE(source, offset) {
+ if (source[offset + 3] > 127) {
+ throw new RangeError(`Size cannot be negative at offset: ${offset}`);
+ }
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getInt32LE(source, offset) {
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getUint32LE(source, offset) {
+ return (source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ },
+ getUint32BE(source, offset) {
+ return (source[offset + 3] +
+ source[offset + 2] * 256 +
+ source[offset + 1] * 65536 +
+ source[offset] * 16777216);
+ },
+ getBigInt64LE(source, offset) {
+ const hi = BigInt(source[offset + 4] +
+ source[offset + 5] * 256 +
+ source[offset + 6] * 65536 +
+ (source[offset + 7] << 24));
+ const lo = BigInt(source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ return (hi << 32n) + lo;
+ },
+ getFloat64LE: isBigEndian
+ ? (source, offset) => {
+ FLOAT_BYTES[7] = source[offset];
+ FLOAT_BYTES[6] = source[offset + 1];
+ FLOAT_BYTES[5] = source[offset + 2];
+ FLOAT_BYTES[4] = source[offset + 3];
+ FLOAT_BYTES[3] = source[offset + 4];
+ FLOAT_BYTES[2] = source[offset + 5];
+ FLOAT_BYTES[1] = source[offset + 6];
+ FLOAT_BYTES[0] = source[offset + 7];
+ return FLOAT[0];
+ }
+ : (source, offset) => {
+ FLOAT_BYTES[0] = source[offset];
+ FLOAT_BYTES[1] = source[offset + 1];
+ FLOAT_BYTES[2] = source[offset + 2];
+ FLOAT_BYTES[3] = source[offset + 3];
+ FLOAT_BYTES[4] = source[offset + 4];
+ FLOAT_BYTES[5] = source[offset + 5];
+ FLOAT_BYTES[6] = source[offset + 6];
+ FLOAT_BYTES[7] = source[offset + 7];
+ return FLOAT[0];
+ },
+ setInt32BE(destination, offset, value) {
+ destination[offset + 3] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset] = value;
+ return 4;
+ },
+ setInt32LE(destination, offset, value) {
+ destination[offset] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 3] = value;
+ return 4;
+ },
+ setBigInt64LE(destination, offset, value) {
+ const mask32bits = 0xffffffffn;
+ let lo = Number(value & mask32bits);
+ destination[offset] = lo;
+ lo >>= 8;
+ destination[offset + 1] = lo;
+ lo >>= 8;
+ destination[offset + 2] = lo;
+ lo >>= 8;
+ destination[offset + 3] = lo;
+ let hi = Number((value >> 32n) & mask32bits);
+ destination[offset + 4] = hi;
+ hi >>= 8;
+ destination[offset + 5] = hi;
+ hi >>= 8;
+ destination[offset + 6] = hi;
+ hi >>= 8;
+ destination[offset + 7] = hi;
+ return 8;
+ },
+ setFloat64LE: isBigEndian
+ ? (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[7];
+ destination[offset + 1] = FLOAT_BYTES[6];
+ destination[offset + 2] = FLOAT_BYTES[5];
+ destination[offset + 3] = FLOAT_BYTES[4];
+ destination[offset + 4] = FLOAT_BYTES[3];
+ destination[offset + 5] = FLOAT_BYTES[2];
+ destination[offset + 6] = FLOAT_BYTES[1];
+ destination[offset + 7] = FLOAT_BYTES[0];
+ return 8;
+ }
+ : (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[0];
+ destination[offset + 1] = FLOAT_BYTES[1];
+ destination[offset + 2] = FLOAT_BYTES[2];
+ destination[offset + 3] = FLOAT_BYTES[3];
+ destination[offset + 4] = FLOAT_BYTES[4];
+ destination[offset + 5] = FLOAT_BYTES[5];
+ destination[offset + 6] = FLOAT_BYTES[6];
+ destination[offset + 7] = FLOAT_BYTES[7];
+ return 8;
+ }
+};
+
+class Binary extends BSONValue {
+ get _bsontype() {
+ return 'Binary';
+ }
+ static BSON_BINARY_SUBTYPE_DEFAULT = 0;
+ static BUFFER_SIZE = 256;
+ static SUBTYPE_DEFAULT = 0;
+ static SUBTYPE_FUNCTION = 1;
+ static SUBTYPE_BYTE_ARRAY = 2;
+ static SUBTYPE_UUID_OLD = 3;
+ static SUBTYPE_UUID = 4;
+ static SUBTYPE_MD5 = 5;
+ static SUBTYPE_ENCRYPTED = 6;
+ static SUBTYPE_COLUMN = 7;
+ static SUBTYPE_SENSITIVE = 8;
+ static SUBTYPE_VECTOR = 9;
+ static SUBTYPE_USER_DEFINED = 128;
+ static VECTOR_TYPE = Object.freeze({
+ Int8: 0x03,
+ Float32: 0x27,
+ PackedBit: 0x10
+ });
+ buffer;
+ sub_type;
+ position;
+ constructor(buffer, subType) {
+ super();
+ if (!(buffer == null) &&
+ typeof buffer === 'string' &&
+ !ArrayBuffer.isView(buffer) &&
+ !isAnyArrayBuffer(buffer) &&
+ !Array.isArray(buffer)) {
+ throw new BSONError('Binary can only be constructed from Uint8Array or number[]');
+ }
+ this.sub_type = subType ?? Binary.BSON_BINARY_SUBTYPE_DEFAULT;
+ if (buffer == null) {
+ this.buffer = ByteUtils.allocate(Binary.BUFFER_SIZE);
+ this.position = 0;
+ }
+ else {
+ this.buffer = Array.isArray(buffer)
+ ? ByteUtils.fromNumberArray(buffer)
+ : ByteUtils.toLocalBufferType(buffer);
+ this.position = this.buffer.byteLength;
+ }
+ }
+ put(byteValue) {
+ if (typeof byteValue === 'string' && byteValue.length !== 1) {
+ throw new BSONError('only accepts single character String');
+ }
+ else if (typeof byteValue !== 'number' && byteValue.length !== 1)
+ throw new BSONError('only accepts single character Uint8Array or Array');
+ let decodedByte;
+ if (typeof byteValue === 'string') {
+ decodedByte = byteValue.charCodeAt(0);
+ }
+ else if (typeof byteValue === 'number') {
+ decodedByte = byteValue;
+ }
+ else {
+ decodedByte = byteValue[0];
+ }
+ if (decodedByte < 0 || decodedByte > 255) {
+ throw new BSONError('only accepts number in a valid unsigned byte range 0-255');
+ }
+ if (this.buffer.byteLength > this.position) {
+ this.buffer[this.position++] = decodedByte;
+ }
+ else {
+ const newSpace = ByteUtils.allocate(Binary.BUFFER_SIZE + this.buffer.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ this.buffer[this.position++] = decodedByte;
+ }
+ }
+ write(sequence, offset) {
+ offset = typeof offset === 'number' ? offset : this.position;
+ if (this.buffer.byteLength < offset + sequence.length) {
+ const newSpace = ByteUtils.allocate(this.buffer.byteLength + sequence.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ }
+ if (ArrayBuffer.isView(sequence)) {
+ this.buffer.set(ByteUtils.toLocalBufferType(sequence), offset);
+ this.position =
+ offset + sequence.byteLength > this.position ? offset + sequence.length : this.position;
+ }
+ else if (typeof sequence === 'string') {
+ throw new BSONError('input cannot be string');
+ }
+ }
+ read(position, length) {
+ length = length && length > 0 ? length : this.position;
+ const end = position + length;
+ return this.buffer.subarray(position, end > this.position ? this.position : end);
+ }
+ value() {
+ return this.buffer.length === this.position
+ ? this.buffer
+ : this.buffer.subarray(0, this.position);
+ }
+ length() {
+ return this.position;
+ }
+ toJSON() {
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.buffer.subarray(0, this.position));
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ if (encoding === 'utf8' || encoding === 'utf-8')
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (this.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(this);
+ }
+ const base64String = ByteUtils.toBase64(this.buffer);
+ const subType = Number(this.sub_type).toString(16);
+ if (options.legacy) {
+ return {
+ $binary: base64String,
+ $type: subType.length === 1 ? '0' + subType : subType
+ };
+ }
+ return {
+ $binary: {
+ base64: base64String,
+ subType: subType.length === 1 ? '0' + subType : subType
+ }
+ };
+ }
+ toUUID() {
+ if (this.sub_type === Binary.SUBTYPE_UUID) {
+ return new UUID(this.buffer.subarray(0, this.position));
+ }
+ throw new BSONError(`Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${Binary.SUBTYPE_UUID}" is currently supported.`);
+ }
+ static createFromHexString(hex, subType) {
+ return new Binary(ByteUtils.fromHex(hex), subType);
+ }
+ static createFromBase64(base64, subType) {
+ return new Binary(ByteUtils.fromBase64(base64), subType);
+ }
+ static fromExtendedJSON(doc, options) {
+ options = options || {};
+ let data;
+ let type;
+ if ('$binary' in doc) {
+ if (options.legacy && typeof doc.$binary === 'string' && '$type' in doc) {
+ type = doc.$type ? parseInt(doc.$type, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary);
+ }
+ else {
+ if (typeof doc.$binary !== 'string') {
+ type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary.base64);
+ }
+ }
+ }
+ else if ('$uuid' in doc) {
+ type = 4;
+ data = UUID.bytesFromString(doc.$uuid);
+ }
+ if (!data) {
+ throw new BSONError(`Unexpected Binary Extended JSON format ${JSON.stringify(doc)}`);
+ }
+ return type === BSON_BINARY_SUBTYPE_UUID_NEW ? new UUID(data) : new Binary(data, type);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const base64 = ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ const base64Arg = inspect(base64, options);
+ const subTypeArg = inspect(this.sub_type, options);
+ return `Binary.createFromBase64(${base64Arg}, ${subTypeArg})`;
+ }
+ toInt8Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Int8) {
+ throw new BSONError('Binary datatype field is not Int8');
+ }
+ validateBinaryVector(this);
+ return new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toFloat32Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Float32) {
+ throw new BSONError('Binary datatype field is not Float32');
+ }
+ validateBinaryVector(this);
+ const floatBytes = new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(floatBytes);
+ return new Float32Array(floatBytes.buffer);
+ }
+ toPackedBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ return new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ const byteCount = this.length() - 2;
+ const bitCount = byteCount * 8 - this.buffer[1];
+ const bits = new Int8Array(bitCount);
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = (bitOffset / 8) | 0;
+ const byte = this.buffer[byteOffset + 2];
+ const shift = 7 - (bitOffset % 8);
+ const bit = (byte >> shift) & 1;
+ bits[bitOffset] = bit;
+ }
+ return bits;
+ }
+ static fromInt8Array(array) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.Int8;
+ buffer[1] = 0;
+ const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ buffer.set(intBytes, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromFloat32Array(array) {
+ const binaryBytes = ByteUtils.allocate(array.byteLength + 2);
+ binaryBytes[0] = Binary.VECTOR_TYPE.Float32;
+ binaryBytes[1] = 0;
+ const floatBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ binaryBytes.set(floatBytes, 2);
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(new Uint8Array(binaryBytes.buffer, 2));
+ const bin = new this(binaryBytes, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromPackedBits(array, padding = 0) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.PackedBit;
+ buffer[1] = padding;
+ buffer.set(array, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromBits(bits) {
+ const byteLength = (bits.length + 7) >>> 3;
+ const bytes = new Uint8Array(byteLength + 2);
+ bytes[0] = Binary.VECTOR_TYPE.PackedBit;
+ const remainder = bits.length % 8;
+ bytes[1] = remainder === 0 ? 0 : 8 - remainder;
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = bitOffset >>> 3;
+ const bit = bits[bitOffset];
+ if (bit !== 0 && bit !== 1) {
+ throw new BSONError(`Invalid bit value at ${bitOffset}: must be 0 or 1, found ${bits[bitOffset]}`);
+ }
+ if (bit === 0)
+ continue;
+ const shift = 7 - (bitOffset % 8);
+ bytes[byteOffset + 2] |= bit << shift;
+ }
+ return new this(bytes, Binary.SUBTYPE_VECTOR);
+ }
+}
+function validateBinaryVector(vector) {
+ if (vector.sub_type !== Binary.SUBTYPE_VECTOR)
+ return;
+ const size = vector.position;
+ const datatype = vector.buffer[0];
+ const padding = vector.buffer[1];
+ if ((datatype === Binary.VECTOR_TYPE.Float32 || datatype === Binary.VECTOR_TYPE.Int8) &&
+ padding !== 0) {
+ throw new BSONError('Invalid Vector: padding must be zero for int8 and float32 vectors');
+ }
+ if (datatype === Binary.VECTOR_TYPE.Float32) {
+ if (size !== 0 && size - 2 !== 0 && (size - 2) % 4 !== 0) {
+ throw new BSONError('Invalid Vector: Float32 vector must contain a multiple of 4 bytes');
+ }
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding !== 0 && size === 2) {
+ throw new BSONError('Invalid Vector: padding must be zero for packed bit vectors that are empty');
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding > 7) {
+ throw new BSONError(`Invalid Vector: padding must be a value between 0 and 7. found: ${padding}`);
+ }
+}
+const UUID_BYTE_LENGTH = 16;
+const UUID_WITHOUT_DASHES = /^[0-9A-F]{32}$/i;
+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;
+class UUID extends Binary {
+ constructor(input) {
+ let bytes;
+ if (input == null) {
+ bytes = UUID.generate();
+ }
+ else if (input instanceof UUID) {
+ bytes = ByteUtils.toLocalBufferType(new Uint8Array(input.buffer));
+ }
+ else if (ArrayBuffer.isView(input) && input.byteLength === UUID_BYTE_LENGTH) {
+ bytes = ByteUtils.toLocalBufferType(input);
+ }
+ else if (typeof input === 'string') {
+ bytes = UUID.bytesFromString(input);
+ }
+ else {
+ 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).');
+ }
+ super(bytes, BSON_BINARY_SUBTYPE_UUID_NEW);
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ }
+ toHexString(includeDashes = true) {
+ if (includeDashes) {
+ return [
+ ByteUtils.toHex(this.buffer.subarray(0, 4)),
+ ByteUtils.toHex(this.buffer.subarray(4, 6)),
+ ByteUtils.toHex(this.buffer.subarray(6, 8)),
+ ByteUtils.toHex(this.buffer.subarray(8, 10)),
+ ByteUtils.toHex(this.buffer.subarray(10, 16))
+ ].join('-');
+ }
+ return ByteUtils.toHex(this.buffer);
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.id);
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ equals(otherId) {
+ if (!otherId) {
+ return false;
+ }
+ if (otherId instanceof UUID) {
+ return ByteUtils.equals(otherId.id, this.id);
+ }
+ try {
+ return ByteUtils.equals(new UUID(otherId).id, this.id);
+ }
+ catch {
+ return false;
+ }
+ }
+ toBinary() {
+ return new Binary(this.id, Binary.SUBTYPE_UUID);
+ }
+ static generate() {
+ const bytes = ByteUtils.randomBytes(UUID_BYTE_LENGTH);
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
+ return bytes;
+ }
+ static isValid(input) {
+ if (!input) {
+ return false;
+ }
+ if (typeof input === 'string') {
+ return UUID.isValidUUIDString(input);
+ }
+ if (isUint8Array(input)) {
+ return input.byteLength === UUID_BYTE_LENGTH;
+ }
+ return (input._bsontype === 'Binary' &&
+ input.sub_type === this.SUBTYPE_UUID &&
+ input.buffer.byteLength === 16);
+ }
+ static createFromHexString(hexString) {
+ const buffer = UUID.bytesFromString(hexString);
+ return new UUID(buffer);
+ }
+ static createFromBase64(base64) {
+ return new UUID(ByteUtils.fromBase64(base64));
+ }
+ static bytesFromString(representation) {
+ if (!UUID.isValidUUIDString(representation)) {
+ throw new BSONError('UUID string representation must be 32 hex digits or canonical hyphenated representation');
+ }
+ return ByteUtils.fromHex(representation.replace(/-/g, ''));
+ }
+ static isValidUUIDString(representation) {
+ return UUID_WITHOUT_DASHES.test(representation) || UUID_WITH_DASHES.test(representation);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new UUID(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+class Code extends BSONValue {
+ get _bsontype() {
+ return 'Code';
+ }
+ code;
+ scope;
+ constructor(code, scope) {
+ super();
+ this.code = code.toString();
+ this.scope = scope ?? null;
+ }
+ toJSON() {
+ if (this.scope != null) {
+ return { code: this.code, scope: this.scope };
+ }
+ return { code: this.code };
+ }
+ toExtendedJSON() {
+ if (this.scope) {
+ return { $code: this.code, $scope: this.scope };
+ }
+ return { $code: this.code };
+ }
+ static fromExtendedJSON(doc) {
+ return new Code(doc.$code, doc.$scope);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ let parametersString = inspect(this.code, options);
+ const multiLineFn = parametersString.includes('\n');
+ if (this.scope != null) {
+ parametersString += `,${multiLineFn ? '\n' : ' '}${inspect(this.scope, options)}`;
+ }
+ const endingNewline = multiLineFn && this.scope === null;
+ return `new Code(${multiLineFn ? '\n' : ''}${parametersString}${endingNewline ? '\n' : ''})`;
+ }
+}
+
+function isDBRefLike(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '$id' in value &&
+ value.$id != null &&
+ '$ref' in value &&
+ typeof value.$ref === 'string' &&
+ (!('$db' in value) || ('$db' in value && typeof value.$db === 'string')));
+}
+class DBRef extends BSONValue {
+ get _bsontype() {
+ return 'DBRef';
+ }
+ collection;
+ oid;
+ db;
+ fields;
+ constructor(collection, oid, db, fields) {
+ super();
+ const parts = collection.split('.');
+ if (parts.length === 2) {
+ db = parts.shift();
+ collection = parts.shift();
+ }
+ this.collection = collection;
+ this.oid = oid;
+ this.db = db;
+ this.fields = fields || {};
+ }
+ get namespace() {
+ return this.collection;
+ }
+ set namespace(value) {
+ this.collection = value;
+ }
+ toJSON() {
+ const o = Object.assign({
+ $ref: this.collection,
+ $id: this.oid
+ }, this.fields);
+ if (this.db != null)
+ o.$db = this.db;
+ return o;
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ let o = {
+ $ref: this.collection,
+ $id: this.oid
+ };
+ if (options.legacy) {
+ return o;
+ }
+ if (this.db)
+ o.$db = this.db;
+ o = Object.assign(o, this.fields);
+ return o;
+ }
+ static fromExtendedJSON(doc) {
+ const copy = Object.assign({}, doc);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(doc.$ref, doc.$id, doc.$db, copy);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const args = [
+ inspect(this.namespace, options),
+ inspect(this.oid, options),
+ ...(this.db ? [inspect(this.db, options)] : []),
+ ...(Object.keys(this.fields).length > 0 ? [inspect(this.fields, options)] : [])
+ ];
+ args[1] = inspect === defaultInspect ? `new ObjectId(${args[1]})` : args[1];
+ return `new DBRef(${args.join(', ')})`;
+ }
+}
+
+function removeLeadingZerosAndExplicitPlus(str) {
+ if (str === '') {
+ return str;
+ }
+ let startIndex = 0;
+ const isNegative = str[startIndex] === '-';
+ const isExplicitlyPositive = str[startIndex] === '+';
+ if (isExplicitlyPositive || isNegative) {
+ startIndex += 1;
+ }
+ let foundInsignificantZero = false;
+ for (; startIndex < str.length && str[startIndex] === '0'; ++startIndex) {
+ foundInsignificantZero = true;
+ }
+ if (!foundInsignificantZero) {
+ return isExplicitlyPositive ? str.slice(1) : str;
+ }
+ return `${isNegative ? '-' : ''}${str.length === startIndex ? '0' : str.slice(startIndex)}`;
+}
+function validateStringCharacters(str, radix) {
+ radix = radix ?? 10;
+ const validCharacters = '0123456789abcdefghijklmnopqrstuvwxyz'.slice(0, radix);
+ const regex = new RegExp(`[^-+${validCharacters}]`, 'i');
+ return regex.test(str) ? false : str;
+}
+
+let wasm = undefined;
+try {
+ 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;
+}
+catch {
+}
+const TWO_PWR_16_DBL = 1 << 16;
+const TWO_PWR_24_DBL = 1 << 24;
+const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+const TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+const TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+const INT_CACHE = {};
+const UINT_CACHE = {};
+const MAX_INT64_STRING_LENGTH = 20;
+const DECIMAL_REG_EX = /^(\+?0|(\+|-)?[1-9][0-9]*)$/;
+class Long extends BSONValue {
+ get _bsontype() {
+ return 'Long';
+ }
+ get __isLong__() {
+ return true;
+ }
+ high;
+ low;
+ unsigned;
+ constructor(lowOrValue = 0, highOrUnsigned, unsigned) {
+ super();
+ const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
+ const high = typeof highOrUnsigned === 'number' ? highOrUnsigned : 0;
+ const res = typeof lowOrValue === 'string'
+ ? Long.fromString(lowOrValue, unsignedBool)
+ : typeof lowOrValue === 'bigint'
+ ? Long.fromBigInt(lowOrValue, unsignedBool)
+ : { low: lowOrValue | 0, high: high | 0, unsigned: unsignedBool };
+ this.low = res.low;
+ this.high = res.high;
+ this.unsigned = res.unsigned;
+ }
+ static TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
+ static MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true);
+ static ZERO = Long.fromInt(0);
+ static UZERO = Long.fromInt(0, true);
+ static ONE = Long.fromInt(1);
+ static UONE = Long.fromInt(1, true);
+ static NEG_ONE = Long.fromInt(-1);
+ static MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
+ static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false);
+ static fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+ }
+ static fromInt(value, unsigned) {
+ let obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if ((cache = 0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, (value | 0) < 0 ? -1 : 0, true);
+ if (cache)
+ UINT_CACHE[value] = obj;
+ return obj;
+ }
+ else {
+ value |= 0;
+ if ((cache = -128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache)
+ INT_CACHE[value] = obj;
+ return obj;
+ }
+ }
+ static fromNumber(value, unsigned) {
+ if (isNaN(value))
+ return unsigned ? Long.UZERO : Long.ZERO;
+ if (unsigned) {
+ if (value < 0)
+ return Long.UZERO;
+ if (value >= TWO_PWR_64_DBL)
+ return Long.MAX_UNSIGNED_VALUE;
+ }
+ else {
+ if (value <= -TWO_PWR_63_DBL)
+ return Long.MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL)
+ return Long.MAX_VALUE;
+ }
+ if (value < 0)
+ return Long.fromNumber(-value, unsigned).neg();
+ return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
+ }
+ static fromBigInt(value, unsigned) {
+ const FROM_BIGINT_BIT_MASK = 0xffffffffn;
+ const FROM_BIGINT_BIT_SHIFT = 32n;
+ return new Long(Number(value & FROM_BIGINT_BIT_MASK), Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK), unsigned);
+ }
+ static _fromString(str, unsigned, radix) {
+ if (str.length === 0)
+ throw new BSONError('empty string');
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ let p;
+ if ((p = str.indexOf('-')) > 0)
+ throw new BSONError('interior hyphen');
+ else if (p === 0) {
+ return Long._fromString(str.substring(1), unsigned, radix).neg();
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 8));
+ let result = Long.ZERO;
+ for (let i = 0; i < str.length; i += 8) {
+ const size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ const power = Long.fromNumber(Math.pow(radix, size));
+ result = result.mul(power).add(Long.fromNumber(value));
+ }
+ else {
+ result = result.mul(radixToPower);
+ result = result.add(Long.fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+ }
+ static fromStringStrict(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str.trim() !== str) {
+ throw new BSONError(`Input: '${str}' contains leading and/or trailing whitespace`);
+ }
+ if (!validateStringCharacters(str, radix)) {
+ throw new BSONError(`Input: '${str}' contains invalid characters for radix: ${radix}`);
+ }
+ const cleanedStr = removeLeadingZerosAndExplicitPlus(str);
+ const result = Long._fromString(cleanedStr, unsigned, radix);
+ if (result.toString(radix).toLowerCase() !== cleanedStr.toLowerCase()) {
+ throw new BSONError(`Input: ${str} is not representable as ${result.unsigned ? 'an unsigned' : 'a signed'} 64-bit Long ${radix != null ? `with radix: ${radix}` : ''}`);
+ }
+ return result;
+ }
+ static fromString(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str === 'NaN' && radix < 24) {
+ return Long.ZERO;
+ }
+ else if ((str === 'Infinity' || str === '+Infinity' || str === '-Infinity') && radix < 35) {
+ return Long.ZERO;
+ }
+ return Long._fromString(str, unsigned, radix);
+ }
+ static fromBytes(bytes, unsigned, le) {
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
+ }
+ static fromBytesLE(bytes, unsigned) {
+ 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);
+ }
+ static fromBytesBE(bytes, unsigned) {
+ 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);
+ }
+ static isLong(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '__isLong__' in value &&
+ value.__isLong__ === true);
+ }
+ static fromValue(val, unsigned) {
+ if (typeof val === 'number')
+ return Long.fromNumber(val, unsigned);
+ if (typeof val === 'string')
+ return Long.fromString(val, unsigned);
+ return Long.fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
+ }
+ add(addend) {
+ if (!Long.isLong(addend))
+ addend = Long.fromValue(addend);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = addend.high >>> 16;
+ const b32 = addend.high & 0xffff;
+ const b16 = addend.low >>> 16;
+ const b00 = addend.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 + b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ and(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+ }
+ compare(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.eq(other))
+ return 0;
+ const thisNeg = this.isNegative(), otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg)
+ return -1;
+ if (!thisNeg && otherNeg)
+ return 1;
+ if (!this.unsigned)
+ return this.sub(other).isNegative() ? -1 : 1;
+ return other.high >>> 0 > this.high >>> 0 ||
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
+ ? -1
+ : 1;
+ }
+ comp(other) {
+ return this.compare(other);
+ }
+ divide(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (divisor.isZero())
+ throw new BSONError('division by zero');
+ if (wasm) {
+ if (!this.unsigned &&
+ this.high === -2147483648 &&
+ divisor.low === -1 &&
+ divisor.high === -1) {
+ return this;
+ }
+ const low = (this.unsigned ? wasm.div_u : wasm.div_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (this.isZero())
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ let approx, rem, res;
+ if (!this.unsigned) {
+ if (this.eq(Long.MIN_VALUE)) {
+ if (divisor.eq(Long.ONE) || divisor.eq(Long.NEG_ONE))
+ return Long.MIN_VALUE;
+ else if (divisor.eq(Long.MIN_VALUE))
+ return Long.ONE;
+ else {
+ const halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(Long.ZERO)) {
+ return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
+ }
+ else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ }
+ else if (divisor.eq(Long.MIN_VALUE))
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative())
+ return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ }
+ else if (divisor.isNegative())
+ return this.div(divisor.neg()).neg();
+ res = Long.ZERO;
+ }
+ else {
+ if (!divisor.unsigned)
+ divisor = divisor.toUnsigned();
+ if (divisor.gt(this))
+ return Long.UZERO;
+ if (divisor.gt(this.shru(1)))
+ return Long.UONE;
+ res = Long.UZERO;
+ }
+ rem = this;
+ while (rem.gte(divisor)) {
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+ const log2 = Math.ceil(Math.log(approx) / Math.LN2);
+ const delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);
+ let approxRes = Long.fromNumber(approx);
+ let approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = Long.fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+ if (approxRes.isZero())
+ approxRes = Long.ONE;
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+ }
+ div(divisor) {
+ return this.divide(divisor);
+ }
+ equals(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
+ return false;
+ return this.high === other.high && this.low === other.low;
+ }
+ eq(other) {
+ return this.equals(other);
+ }
+ getHighBits() {
+ return this.high;
+ }
+ getHighBitsUnsigned() {
+ return this.high >>> 0;
+ }
+ getLowBits() {
+ return this.low;
+ }
+ getLowBitsUnsigned() {
+ return this.low >>> 0;
+ }
+ getNumBitsAbs() {
+ if (this.isNegative()) {
+ return this.eq(Long.MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ }
+ const val = this.high !== 0 ? this.high : this.low;
+ let bit;
+ for (bit = 31; bit > 0; bit--)
+ if ((val & (1 << bit)) !== 0)
+ break;
+ return this.high !== 0 ? bit + 33 : bit + 1;
+ }
+ greaterThan(other) {
+ return this.comp(other) > 0;
+ }
+ gt(other) {
+ return this.greaterThan(other);
+ }
+ greaterThanOrEqual(other) {
+ return this.comp(other) >= 0;
+ }
+ gte(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ ge(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ isEven() {
+ return (this.low & 1) === 0;
+ }
+ isNegative() {
+ return !this.unsigned && this.high < 0;
+ }
+ isOdd() {
+ return (this.low & 1) === 1;
+ }
+ isPositive() {
+ return this.unsigned || this.high >= 0;
+ }
+ isZero() {
+ return this.high === 0 && this.low === 0;
+ }
+ lessThan(other) {
+ return this.comp(other) < 0;
+ }
+ lt(other) {
+ return this.lessThan(other);
+ }
+ lessThanOrEqual(other) {
+ return this.comp(other) <= 0;
+ }
+ lte(other) {
+ return this.lessThanOrEqual(other);
+ }
+ modulo(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (wasm) {
+ const low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ return this.sub(this.div(divisor).mul(divisor));
+ }
+ mod(divisor) {
+ return this.modulo(divisor);
+ }
+ rem(divisor) {
+ return this.modulo(divisor);
+ }
+ multiply(multiplier) {
+ if (this.isZero())
+ return Long.ZERO;
+ if (!Long.isLong(multiplier))
+ multiplier = Long.fromValue(multiplier);
+ if (wasm) {
+ const low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (multiplier.isZero())
+ return Long.ZERO;
+ if (this.eq(Long.MIN_VALUE))
+ return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (multiplier.eq(Long.MIN_VALUE))
+ return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (this.isNegative()) {
+ if (multiplier.isNegative())
+ return this.neg().mul(multiplier.neg());
+ else
+ return this.neg().mul(multiplier).neg();
+ }
+ else if (multiplier.isNegative())
+ return this.mul(multiplier.neg()).neg();
+ if (this.lt(Long.TWO_PWR_24) && multiplier.lt(Long.TWO_PWR_24))
+ return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = multiplier.high >>> 16;
+ const b32 = multiplier.high & 0xffff;
+ const b16 = multiplier.low >>> 16;
+ const b00 = multiplier.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ mul(multiplier) {
+ return this.multiply(multiplier);
+ }
+ negate() {
+ if (!this.unsigned && this.eq(Long.MIN_VALUE))
+ return Long.MIN_VALUE;
+ return this.not().add(Long.ONE);
+ }
+ neg() {
+ return this.negate();
+ }
+ not() {
+ return Long.fromBits(~this.low, ~this.high, this.unsigned);
+ }
+ notEquals(other) {
+ return !this.equals(other);
+ }
+ neq(other) {
+ return this.notEquals(other);
+ }
+ ne(other) {
+ return this.notEquals(other);
+ }
+ or(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+ }
+ shiftLeft(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
+ else
+ return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
+ }
+ shl(numBits) {
+ return this.shiftLeft(numBits);
+ }
+ shiftRight(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
+ else
+ return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
+ }
+ shr(numBits) {
+ return this.shiftRight(numBits);
+ }
+ shiftRightUnsigned(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ numBits &= 63;
+ if (numBits === 0)
+ return this;
+ else {
+ const high = this.high;
+ if (numBits < 32) {
+ const low = this.low;
+ return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
+ }
+ else if (numBits === 32)
+ return Long.fromBits(high, 0, this.unsigned);
+ else
+ return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
+ }
+ }
+ shr_u(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ shru(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ subtract(subtrahend) {
+ if (!Long.isLong(subtrahend))
+ subtrahend = Long.fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+ }
+ sub(subtrahend) {
+ return this.subtract(subtrahend);
+ }
+ toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+ }
+ toNumber() {
+ if (this.unsigned)
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+ }
+ toBigInt() {
+ return BigInt(this.toString());
+ }
+ toBytes(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+ }
+ toBytesLE() {
+ const hi = this.high, lo = this.low;
+ return [
+ lo & 0xff,
+ (lo >>> 8) & 0xff,
+ (lo >>> 16) & 0xff,
+ lo >>> 24,
+ hi & 0xff,
+ (hi >>> 8) & 0xff,
+ (hi >>> 16) & 0xff,
+ hi >>> 24
+ ];
+ }
+ toBytesBE() {
+ const hi = this.high, lo = this.low;
+ return [
+ hi >>> 24,
+ (hi >>> 16) & 0xff,
+ (hi >>> 8) & 0xff,
+ hi & 0xff,
+ lo >>> 24,
+ (lo >>> 16) & 0xff,
+ (lo >>> 8) & 0xff,
+ lo & 0xff
+ ];
+ }
+ toSigned() {
+ if (!this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, false);
+ }
+ toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ if (this.isZero())
+ return '0';
+ if (this.isNegative()) {
+ if (this.eq(Long.MIN_VALUE)) {
+ const radixLong = Long.fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ }
+ else
+ return '-' + this.neg().toString(radix);
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
+ let rem = this;
+ let result = '';
+ while (true) {
+ const remDiv = rem.div(radixToPower);
+ const intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0;
+ let digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero()) {
+ return digits + result;
+ }
+ else {
+ while (digits.length < 6)
+ digits = '0' + digits;
+ result = '' + digits + result;
+ }
+ }
+ }
+ toUnsigned() {
+ if (this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, true);
+ }
+ xor(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+ }
+ eqz() {
+ return this.isZero();
+ }
+ le(other) {
+ return this.lessThanOrEqual(other);
+ }
+ toExtendedJSON(options) {
+ if (options && options.relaxed)
+ return this.toNumber();
+ return { $numberLong: this.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ const { useBigInt64 = false, relaxed = true } = { ...options };
+ if (doc.$numberLong.length > MAX_INT64_STRING_LENGTH) {
+ throw new BSONError('$numberLong string is too long');
+ }
+ if (!DECIMAL_REG_EX.test(doc.$numberLong)) {
+ throw new BSONError(`$numberLong string "${doc.$numberLong}" is in an invalid format`);
+ }
+ if (useBigInt64) {
+ const bigIntResult = BigInt(doc.$numberLong);
+ return BigInt.asIntN(64, bigIntResult);
+ }
+ const longResult = Long.fromString(doc.$numberLong);
+ if (relaxed) {
+ return longResult.toNumber();
+ }
+ return longResult;
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const longVal = inspect(this.toString(), options);
+ const unsignedVal = this.unsigned ? `, ${inspect(this.unsigned, options)}` : '';
+ return `new Long(${longVal}${unsignedVal})`;
+ }
+}
+
+const PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/;
+const PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i;
+const PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i;
+const EXPONENT_MAX = 6111;
+const EXPONENT_MIN = -6176;
+const EXPONENT_BIAS = 6176;
+const MAX_DIGITS = 34;
+const NAN_BUFFER = ByteUtils.fromNumberArray([
+ 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_NEGATIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_POSITIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const EXPONENT_REGEX = /^([-+])?(\d+)?$/;
+const COMBINATION_MASK = 0x1f;
+const EXPONENT_MASK = 0x3fff;
+const COMBINATION_INFINITY = 30;
+const COMBINATION_NAN = 31;
+function isDigit(value) {
+ return !isNaN(parseInt(value, 10));
+}
+function divideu128(value) {
+ const DIVISOR = Long.fromNumber(1000 * 1000 * 1000);
+ let _rem = Long.fromNumber(0);
+ if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) {
+ return { quotient: value, rem: _rem };
+ }
+ for (let i = 0; i <= 3; i++) {
+ _rem = _rem.shiftLeft(32);
+ _rem = _rem.add(new Long(value.parts[i], 0));
+ value.parts[i] = _rem.div(DIVISOR).low;
+ _rem = _rem.modulo(DIVISOR);
+ }
+ return { quotient: value, rem: _rem };
+}
+function multiply64x2(left, right) {
+ if (!left && !right) {
+ return { high: Long.fromNumber(0), low: Long.fromNumber(0) };
+ }
+ const leftHigh = left.shiftRightUnsigned(32);
+ const leftLow = new Long(left.getLowBits(), 0);
+ const rightHigh = right.shiftRightUnsigned(32);
+ const rightLow = new Long(right.getLowBits(), 0);
+ let productHigh = leftHigh.multiply(rightHigh);
+ let productMid = leftHigh.multiply(rightLow);
+ const productMid2 = leftLow.multiply(rightHigh);
+ let productLow = leftLow.multiply(rightLow);
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productMid = new Long(productMid.getLowBits(), 0)
+ .add(productMid2)
+ .add(productLow.shiftRightUnsigned(32));
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));
+ return { high: productHigh, low: productLow };
+}
+function lessThan(left, right) {
+ const uhleft = left.high >>> 0;
+ const uhright = right.high >>> 0;
+ if (uhleft < uhright) {
+ return true;
+ }
+ else if (uhleft === uhright) {
+ const ulleft = left.low >>> 0;
+ const ulright = right.low >>> 0;
+ if (ulleft < ulright)
+ return true;
+ }
+ return false;
+}
+function invalidErr(string, message) {
+ throw new BSONError(`"${string}" is not a valid Decimal128 string - ${message}`);
+}
+class Decimal128 extends BSONValue {
+ get _bsontype() {
+ return 'Decimal128';
+ }
+ bytes;
+ constructor(bytes) {
+ super();
+ if (typeof bytes === 'string') {
+ this.bytes = Decimal128.fromString(bytes).bytes;
+ }
+ else if (bytes instanceof Uint8Array || isUint8Array(bytes)) {
+ if (bytes.byteLength !== 16) {
+ throw new BSONError('Decimal128 must take a Buffer of 16 bytes');
+ }
+ this.bytes = bytes;
+ }
+ else {
+ throw new BSONError('Decimal128 must take a Buffer or string');
+ }
+ }
+ static fromString(representation) {
+ return Decimal128._fromString(representation, { allowRounding: false });
+ }
+ static fromStringWithRounding(representation) {
+ return Decimal128._fromString(representation, { allowRounding: true });
+ }
+ static _fromString(representation, options) {
+ let isNegative = false;
+ let sawSign = false;
+ let sawRadix = false;
+ let foundNonZero = false;
+ let significantDigits = 0;
+ let nDigitsRead = 0;
+ let nDigits = 0;
+ let radixPosition = 0;
+ let firstNonZero = 0;
+ const digits = [0];
+ let nDigitsStored = 0;
+ let digitsInsert = 0;
+ let lastDigit = 0;
+ let exponent = 0;
+ let significandHigh = new Long(0, 0);
+ let significandLow = new Long(0, 0);
+ let biasedExponent = 0;
+ let index = 0;
+ if (representation.length >= 7000) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ const stringMatch = representation.match(PARSE_STRING_REGEXP);
+ const infMatch = representation.match(PARSE_INF_REGEXP);
+ const nanMatch = representation.match(PARSE_NAN_REGEXP);
+ if ((!stringMatch && !infMatch && !nanMatch) || representation.length === 0) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ if (stringMatch) {
+ const unsignedNumber = stringMatch[2];
+ const e = stringMatch[4];
+ const expSign = stringMatch[5];
+ const expNumber = stringMatch[6];
+ if (e && expNumber === undefined)
+ invalidErr(representation, 'missing exponent power');
+ if (e && unsignedNumber === undefined)
+ invalidErr(representation, 'missing exponent base');
+ if (e === undefined && (expSign || expNumber)) {
+ invalidErr(representation, 'missing e before exponent');
+ }
+ }
+ if (representation[index] === '+' || representation[index] === '-') {
+ sawSign = true;
+ isNegative = representation[index++] === '-';
+ }
+ if (!isDigit(representation[index]) && representation[index] !== '.') {
+ if (representation[index] === 'i' || representation[index] === 'I') {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ else if (representation[index] === 'N') {
+ return new Decimal128(NAN_BUFFER);
+ }
+ }
+ while (isDigit(representation[index]) || representation[index] === '.') {
+ if (representation[index] === '.') {
+ if (sawRadix)
+ invalidErr(representation, 'contains multiple periods');
+ sawRadix = true;
+ index = index + 1;
+ continue;
+ }
+ if (nDigitsStored < MAX_DIGITS) {
+ if (representation[index] !== '0' || foundNonZero) {
+ if (!foundNonZero) {
+ firstNonZero = nDigitsRead;
+ }
+ foundNonZero = true;
+ digits[digitsInsert++] = parseInt(representation[index], 10);
+ nDigitsStored = nDigitsStored + 1;
+ }
+ }
+ if (foundNonZero)
+ nDigits = nDigits + 1;
+ if (sawRadix)
+ radixPosition = radixPosition + 1;
+ nDigitsRead = nDigitsRead + 1;
+ index = index + 1;
+ }
+ if (sawRadix && !nDigitsRead)
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ if (representation[index] === 'e' || representation[index] === 'E') {
+ const match = representation.substr(++index).match(EXPONENT_REGEX);
+ if (!match || !match[2])
+ return new Decimal128(NAN_BUFFER);
+ exponent = parseInt(match[0], 10);
+ index = index + match[0].length;
+ }
+ if (representation[index])
+ return new Decimal128(NAN_BUFFER);
+ if (!nDigitsStored) {
+ digits[0] = 0;
+ nDigits = 1;
+ nDigitsStored = 1;
+ significantDigits = 0;
+ }
+ else {
+ lastDigit = nDigitsStored - 1;
+ significantDigits = nDigits;
+ if (significantDigits !== 1) {
+ while (representation[firstNonZero + significantDigits - 1 + Number(sawSign) + Number(sawRadix)] === '0') {
+ significantDigits = significantDigits - 1;
+ }
+ }
+ }
+ if (exponent <= radixPosition && radixPosition > exponent + (1 << 14)) {
+ exponent = EXPONENT_MIN;
+ }
+ else {
+ exponent = exponent - radixPosition;
+ }
+ while (exponent > EXPONENT_MAX) {
+ lastDigit = lastDigit + 1;
+ if (lastDigit >= MAX_DIGITS) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ exponent = exponent - 1;
+ }
+ if (options.allowRounding) {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0 && significantDigits < nDigitsStored) {
+ exponent = EXPONENT_MIN;
+ significantDigits = 0;
+ break;
+ }
+ if (nDigitsStored < nDigits) {
+ nDigits = nDigits - 1;
+ }
+ else {
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ const digitsString = digits.join('');
+ if (digitsString.match(/^0+$/)) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ let endOfString = nDigitsRead;
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ let roundBit = 0;
+ if (roundDigit >= 5) {
+ roundBit = 1;
+ if (roundDigit === 5) {
+ roundBit = digits[lastDigit] % 2 === 1 ? 1 : 0;
+ for (let i = firstNonZero + lastDigit + 2; i < endOfString; i++) {
+ if (parseInt(representation[i], 10)) {
+ roundBit = 1;
+ break;
+ }
+ }
+ }
+ }
+ if (roundBit) {
+ let dIdx = lastDigit;
+ for (; dIdx >= 0; dIdx--) {
+ if (++digits[dIdx] > 9) {
+ digits[dIdx] = 0;
+ if (dIdx === 0) {
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ digits[dIdx] = 1;
+ }
+ else {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ }
+ }
+ else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ else {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MIN;
+ break;
+ }
+ invalidErr(representation, 'exponent underflow');
+ }
+ if (nDigitsStored < nDigits) {
+ if (representation[nDigits - 1 + Number(sawSign) + Number(sawRadix)] !== '0' &&
+ significantDigits !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ nDigits = nDigits - 1;
+ }
+ else {
+ if (digits[lastDigit] !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ if (roundDigit !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ }
+ }
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ if (significantDigits === 0) {
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ }
+ else if (lastDigit < 17) {
+ let dIdx = 0;
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ significandHigh = new Long(0, 0);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ else {
+ let dIdx = 0;
+ significandHigh = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit - 17; dIdx++) {
+ significandHigh = significandHigh.multiply(Long.fromNumber(10));
+ significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));
+ }
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ const significand = multiply64x2(significandHigh, Long.fromString('100000000000000000'));
+ significand.low = significand.low.add(significandLow);
+ if (lessThan(significand.low, significandLow)) {
+ significand.high = significand.high.add(Long.fromNumber(1));
+ }
+ biasedExponent = exponent + EXPONENT_BIAS;
+ const dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };
+ if (significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1))) {
+ dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));
+ }
+ else {
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));
+ }
+ dec.low = significand.low;
+ if (isNegative) {
+ dec.high = dec.high.or(Long.fromString('9223372036854775808'));
+ }
+ const buffer = ByteUtils.allocateUnsafe(16);
+ index = 0;
+ buffer[index++] = dec.low.low & 0xff;
+ buffer[index++] = (dec.low.low >> 8) & 0xff;
+ buffer[index++] = (dec.low.low >> 16) & 0xff;
+ buffer[index++] = (dec.low.low >> 24) & 0xff;
+ buffer[index++] = dec.low.high & 0xff;
+ buffer[index++] = (dec.low.high >> 8) & 0xff;
+ buffer[index++] = (dec.low.high >> 16) & 0xff;
+ buffer[index++] = (dec.low.high >> 24) & 0xff;
+ buffer[index++] = dec.high.low & 0xff;
+ buffer[index++] = (dec.high.low >> 8) & 0xff;
+ buffer[index++] = (dec.high.low >> 16) & 0xff;
+ buffer[index++] = (dec.high.low >> 24) & 0xff;
+ buffer[index++] = dec.high.high & 0xff;
+ buffer[index++] = (dec.high.high >> 8) & 0xff;
+ buffer[index++] = (dec.high.high >> 16) & 0xff;
+ buffer[index++] = (dec.high.high >> 24) & 0xff;
+ return new Decimal128(buffer);
+ }
+ toString() {
+ let biased_exponent;
+ let significand_digits = 0;
+ const significand = new Array(36);
+ for (let i = 0; i < significand.length; i++)
+ significand[i] = 0;
+ let index = 0;
+ let is_zero = false;
+ let significand_msb;
+ let significand128 = { parts: [0, 0, 0, 0] };
+ let j, k;
+ const string = [];
+ index = 0;
+ const buffer = this.bytes;
+ const low = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midl = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midh = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const high = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ index = 0;
+ const dec = {
+ low: new Long(low, midl),
+ high: new Long(midh, high)
+ };
+ if (dec.high.lessThan(Long.ZERO)) {
+ string.push('-');
+ }
+ const combination = (high >> 26) & COMBINATION_MASK;
+ if (combination >> 3 === 3) {
+ if (combination === COMBINATION_INFINITY) {
+ return string.join('') + 'Infinity';
+ }
+ else if (combination === COMBINATION_NAN) {
+ return 'NaN';
+ }
+ else {
+ biased_exponent = (high >> 15) & EXPONENT_MASK;
+ significand_msb = 0x08 + ((high >> 14) & 0x01);
+ }
+ }
+ else {
+ significand_msb = (high >> 14) & 0x07;
+ biased_exponent = (high >> 17) & EXPONENT_MASK;
+ }
+ const exponent = biased_exponent - EXPONENT_BIAS;
+ significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);
+ significand128.parts[1] = midh;
+ significand128.parts[2] = midl;
+ significand128.parts[3] = low;
+ if (significand128.parts[0] === 0 &&
+ significand128.parts[1] === 0 &&
+ significand128.parts[2] === 0 &&
+ significand128.parts[3] === 0) {
+ is_zero = true;
+ }
+ else {
+ for (k = 3; k >= 0; k--) {
+ let least_digits = 0;
+ const result = divideu128(significand128);
+ significand128 = result.quotient;
+ least_digits = result.rem.low;
+ if (!least_digits)
+ continue;
+ for (j = 8; j >= 0; j--) {
+ significand[k * 9 + j] = least_digits % 10;
+ least_digits = Math.floor(least_digits / 10);
+ }
+ }
+ }
+ if (is_zero) {
+ significand_digits = 1;
+ significand[index] = 0;
+ }
+ else {
+ significand_digits = 36;
+ while (!significand[index]) {
+ significand_digits = significand_digits - 1;
+ index = index + 1;
+ }
+ }
+ const scientific_exponent = significand_digits - 1 + exponent;
+ if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) {
+ if (significand_digits > 34) {
+ string.push(`${0}`);
+ if (exponent > 0)
+ string.push(`E+${exponent}`);
+ else if (exponent < 0)
+ string.push(`E${exponent}`);
+ return string.join('');
+ }
+ string.push(`${significand[index++]}`);
+ significand_digits = significand_digits - 1;
+ if (significand_digits) {
+ string.push('.');
+ }
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ string.push('E');
+ if (scientific_exponent > 0) {
+ string.push(`+${scientific_exponent}`);
+ }
+ else {
+ string.push(`${scientific_exponent}`);
+ }
+ }
+ else {
+ if (exponent >= 0) {
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ let radix_position = significand_digits + exponent;
+ if (radix_position > 0) {
+ for (let i = 0; i < radix_position; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ string.push('0');
+ }
+ string.push('.');
+ while (radix_position++ < 0) {
+ string.push('0');
+ }
+ for (let i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ }
+ return string.join('');
+ }
+ toJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ toExtendedJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ static fromExtendedJSON(doc) {
+ return Decimal128.fromString(doc.$numberDecimal);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const d128string = inspect(this.toString(), options);
+ return `new Decimal128(${d128string})`;
+ }
+}
+
+class Double extends BSONValue {
+ get _bsontype() {
+ return 'Double';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value;
+ }
+ static fromString(value) {
+ const coercedValue = Number(value);
+ if (value === 'NaN')
+ return new Double(NaN);
+ if (value === 'Infinity')
+ return new Double(Infinity);
+ if (value === '-Infinity')
+ return new Double(-Infinity);
+ if (!Number.isFinite(coercedValue)) {
+ throw new BSONError(`Input: ${value} is not representable as a Double`);
+ }
+ if (value.trim() !== value) {
+ throw new BSONError(`Input: '${value}' contains whitespace`);
+ }
+ if (value === '') {
+ throw new BSONError(`Input is an empty string`);
+ }
+ if (/[^-0-9.+eE]/.test(value)) {
+ throw new BSONError(`Input: '${value}' is not in decimal or exponential notation`);
+ }
+ return new Double(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toExtendedJSON(options) {
+ if (options && (options.legacy || (options.relaxed && isFinite(this.value)))) {
+ return this.value;
+ }
+ if (Object.is(Math.sign(this.value), -0)) {
+ return { $numberDouble: '-0.0' };
+ }
+ return {
+ $numberDouble: Number.isInteger(this.value) ? this.value.toFixed(1) : this.value.toString()
+ };
+ }
+ static fromExtendedJSON(doc, options) {
+ const doubleValue = parseFloat(doc.$numberDouble);
+ return options && options.relaxed ? doubleValue : new Double(doubleValue);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Double(${inspect(this.value, options)})`;
+ }
+}
+
+class Int32 extends BSONValue {
+ get _bsontype() {
+ return 'Int32';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value | 0;
+ }
+ static fromString(value) {
+ const cleanedValue = removeLeadingZerosAndExplicitPlus(value);
+ const coercedValue = Number(value);
+ if (BSON_INT32_MAX < coercedValue) {
+ throw new BSONError(`Input: '${value}' is larger than the maximum value for Int32`);
+ }
+ else if (BSON_INT32_MIN > coercedValue) {
+ throw new BSONError(`Input: '${value}' is smaller than the minimum value for Int32`);
+ }
+ else if (!Number.isSafeInteger(coercedValue)) {
+ throw new BSONError(`Input: '${value}' is not a safe integer`);
+ }
+ else if (coercedValue.toString() !== cleanedValue) {
+ throw new BSONError(`Input: '${value}' is not a valid Int32 string`);
+ }
+ return new Int32(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON(options) {
+ if (options && (options.relaxed || options.legacy))
+ return this.value;
+ return { $numberInt: this.value.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new Int32(doc.$numberInt);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Int32(${inspect(this.value, options)})`;
+ }
+}
+
+class MaxKey extends BSONValue {
+ get _bsontype() {
+ return 'MaxKey';
+ }
+ toExtendedJSON() {
+ return { $maxKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MaxKey();
+ }
+ inspect() {
+ return 'new MaxKey()';
+ }
+}
+
+class MinKey extends BSONValue {
+ get _bsontype() {
+ return 'MinKey';
+ }
+ toExtendedJSON() {
+ return { $minKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MinKey();
+ }
+ inspect() {
+ return 'new MinKey()';
+ }
+}
+
+let PROCESS_UNIQUE = null;
+const __idCache = new WeakMap();
+class ObjectId extends BSONValue {
+ get _bsontype() {
+ return 'ObjectId';
+ }
+ static index = Math.floor(Math.random() * 0xffffff);
+ static cacheHexString;
+ buffer;
+ constructor(inputId) {
+ super();
+ let workingId;
+ if (typeof inputId === 'object' && inputId && 'id' in inputId) {
+ if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
+ throw new BSONError('Argument passed in must have an id that is of type string or Buffer');
+ }
+ if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
+ workingId = ByteUtils.fromHex(inputId.toHexString());
+ }
+ else {
+ workingId = inputId.id;
+ }
+ }
+ else {
+ workingId = inputId;
+ }
+ if (workingId == null) {
+ this.buffer = ObjectId.generate();
+ }
+ else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
+ this.buffer = ByteUtils.toLocalBufferType(workingId);
+ }
+ else if (typeof workingId === 'string') {
+ if (ObjectId.validateHexString(workingId)) {
+ this.buffer = ByteUtils.fromHex(workingId);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, workingId);
+ }
+ }
+ else {
+ throw new BSONError('input must be a 24 character hex string, 12 byte Uint8Array, or an integer');
+ }
+ }
+ else {
+ throw new BSONError('Argument passed in does not match the accepted types');
+ }
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, ByteUtils.toHex(value));
+ }
+ }
+ static validateHexString(string) {
+ if (string?.length !== 24)
+ return false;
+ for (let i = 0; i < 24; i++) {
+ const char = string.charCodeAt(i);
+ if ((char >= 48 && char <= 57) ||
+ (char >= 97 && char <= 102) ||
+ (char >= 65 && char <= 70)) {
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+ toHexString() {
+ if (ObjectId.cacheHexString) {
+ const __id = __idCache.get(this);
+ if (__id)
+ return __id;
+ }
+ const hexString = ByteUtils.toHex(this.id);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, hexString);
+ }
+ return hexString;
+ }
+ static getInc() {
+ return (ObjectId.index = (ObjectId.index + 1) % 0xffffff);
+ }
+ static generate(time) {
+ if ('number' !== typeof time) {
+ time = Math.floor(Date.now() / 1000);
+ }
+ const inc = ObjectId.getInc();
+ const buffer = ByteUtils.allocateUnsafe(12);
+ NumberUtils.setInt32BE(buffer, 0, time);
+ if (PROCESS_UNIQUE === null) {
+ PROCESS_UNIQUE = ByteUtils.randomBytes(5);
+ }
+ buffer[4] = PROCESS_UNIQUE[0];
+ buffer[5] = PROCESS_UNIQUE[1];
+ buffer[6] = PROCESS_UNIQUE[2];
+ buffer[7] = PROCESS_UNIQUE[3];
+ buffer[8] = PROCESS_UNIQUE[4];
+ buffer[11] = inc & 0xff;
+ buffer[10] = (inc >> 8) & 0xff;
+ buffer[9] = (inc >> 16) & 0xff;
+ return buffer;
+ }
+ toString(encoding) {
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ if (encoding === 'hex')
+ return this.toHexString();
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ static is(variable) {
+ return (variable != null &&
+ typeof variable === 'object' &&
+ '_bsontype' in variable &&
+ variable._bsontype === 'ObjectId');
+ }
+ equals(otherId) {
+ if (otherId === undefined || otherId === null) {
+ return false;
+ }
+ if (ObjectId.is(otherId)) {
+ return (this.buffer[11] === otherId.buffer[11] && ByteUtils.equals(this.buffer, otherId.buffer));
+ }
+ if (typeof otherId === 'string') {
+ return otherId.toLowerCase() === this.toHexString();
+ }
+ if (typeof otherId === 'object' && typeof otherId.toHexString === 'function') {
+ const otherIdString = otherId.toHexString();
+ const thisIdString = this.toHexString();
+ return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
+ }
+ return false;
+ }
+ getTimestamp() {
+ const timestamp = new Date();
+ const time = NumberUtils.getUint32BE(this.buffer, 0);
+ timestamp.setTime(Math.floor(time) * 1000);
+ return timestamp;
+ }
+ static createPk() {
+ return new ObjectId();
+ }
+ serializeInto(uint8array, index) {
+ uint8array[index] = this.buffer[0];
+ uint8array[index + 1] = this.buffer[1];
+ uint8array[index + 2] = this.buffer[2];
+ uint8array[index + 3] = this.buffer[3];
+ uint8array[index + 4] = this.buffer[4];
+ uint8array[index + 5] = this.buffer[5];
+ uint8array[index + 6] = this.buffer[6];
+ uint8array[index + 7] = this.buffer[7];
+ uint8array[index + 8] = this.buffer[8];
+ uint8array[index + 9] = this.buffer[9];
+ uint8array[index + 10] = this.buffer[10];
+ uint8array[index + 11] = this.buffer[11];
+ return 12;
+ }
+ static createFromTime(time) {
+ const buffer = ByteUtils.allocate(12);
+ for (let i = 11; i >= 4; i--)
+ buffer[i] = 0;
+ NumberUtils.setInt32BE(buffer, 0, time);
+ return new ObjectId(buffer);
+ }
+ static createFromHexString(hexString) {
+ if (hexString?.length !== 24) {
+ throw new BSONError('hex string must be 24 characters');
+ }
+ return new ObjectId(ByteUtils.fromHex(hexString));
+ }
+ static createFromBase64(base64) {
+ if (base64?.length !== 16) {
+ throw new BSONError('base64 string must be 16 characters');
+ }
+ return new ObjectId(ByteUtils.fromBase64(base64));
+ }
+ static isValid(id) {
+ if (id == null)
+ return false;
+ if (typeof id === 'string')
+ return ObjectId.validateHexString(id);
+ try {
+ new ObjectId(id);
+ return true;
+ }
+ catch {
+ return false;
+ }
+ }
+ toExtendedJSON() {
+ if (this.toHexString)
+ return { $oid: this.toHexString() };
+ return { $oid: this.toString('hex') };
+ }
+ static fromExtendedJSON(doc) {
+ return new ObjectId(doc.$oid);
+ }
+ isCached() {
+ return ObjectId.cacheHexString && __idCache.has(this);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new ObjectId(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+function internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined) {
+ let totalLength = 4 + 1;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined);
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ }
+ for (const key of Object.keys(object)) {
+ totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined);
+ }
+ }
+ return totalLength;
+}
+function calculateElement(name, value, serializeFunctions = false, isArray = false, ignoreUndefined = false) {
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ switch (typeof value) {
+ case 'string':
+ return 1 + ByteUtils.utf8ByteLength(name) + 1 + 4 + ByteUtils.utf8ByteLength(value) + 1;
+ case 'number':
+ if (Math.floor(value) === value &&
+ value >= JS_INT_MIN &&
+ value <= JS_INT_MAX) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (4 + 1);
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ case 'undefined':
+ if (isArray || !ignoreUndefined)
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ return 0;
+ case 'boolean':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 1);
+ case 'object':
+ if (value != null &&
+ typeof value._bsontype === 'string' &&
+ value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value == null || value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ }
+ else if (value._bsontype === 'ObjectId') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (12 + 1);
+ }
+ else if (value instanceof Date || isDate(value)) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (ArrayBuffer.isView(value) ||
+ value instanceof ArrayBuffer ||
+ isAnyArrayBuffer(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 4 + 1) + value.byteLength);
+ }
+ else if (value._bsontype === 'Long' ||
+ value._bsontype === 'Double' ||
+ value._bsontype === 'Timestamp') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (16 + 1);
+ }
+ else if (value._bsontype === 'Code') {
+ if (value.scope != null && Object.keys(value.scope).length > 0) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1 +
+ internalCalculateObjectSize(value.scope, serializeFunctions, ignoreUndefined));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1);
+ }
+ }
+ else if (value._bsontype === 'Binary') {
+ const binary = value;
+ if (binary.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ (binary.position + 1 + 4 + 1 + 4));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (binary.position + 1 + 4 + 1));
+ }
+ }
+ else if (value._bsontype === 'Symbol') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ ByteUtils.utf8ByteLength(value.value) +
+ 4 +
+ 1 +
+ 1);
+ }
+ else if (value._bsontype === 'DBRef') {
+ const ordered_values = Object.assign({
+ $ref: value.collection,
+ $id: value.oid
+ }, value.fields);
+ if (value.db != null) {
+ ordered_values['$db'] = value.db;
+ }
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ internalCalculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined));
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.source) +
+ 1 +
+ (value.global ? 1 : 0) +
+ (value.ignoreCase ? 1 : 0) +
+ (value.multiline ? 1 : 0) +
+ 1);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.pattern) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.options) +
+ 1);
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ internalCalculateObjectSize(value, serializeFunctions, ignoreUndefined) +
+ 1);
+ }
+ case 'function':
+ if (serializeFunctions) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.toString()) +
+ 1);
+ }
+ return 0;
+ case 'bigint':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ case 'symbol':
+ return 0;
+ default:
+ throw new BSONError(`Unrecognized JS type: ${typeof value}`);
+ }
+}
+
+function alphabetize(str) {
+ return str.split('').sort().join('');
+}
+class BSONRegExp extends BSONValue {
+ get _bsontype() {
+ return 'BSONRegExp';
+ }
+ pattern;
+ options;
+ constructor(pattern, options) {
+ super();
+ this.pattern = pattern;
+ this.options = alphabetize(options ?? '');
+ if (this.pattern.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}`);
+ }
+ if (this.options.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex options cannot contain null bytes, found: ${JSON.stringify(this.options)}`);
+ }
+ for (let i = 0; i < this.options.length; i++) {
+ if (!(this.options[i] === 'i' ||
+ this.options[i] === 'm' ||
+ this.options[i] === 'x' ||
+ this.options[i] === 'l' ||
+ this.options[i] === 's' ||
+ this.options[i] === 'u')) {
+ throw new BSONError(`The regular expression option [${this.options[i]}] is not supported`);
+ }
+ }
+ }
+ static parseOptions(options) {
+ return options ? options.split('').sort().join('') : '';
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (options.legacy) {
+ return { $regex: this.pattern, $options: this.options };
+ }
+ return { $regularExpression: { pattern: this.pattern, options: this.options } };
+ }
+ static fromExtendedJSON(doc) {
+ if ('$regex' in doc) {
+ if (typeof doc.$regex !== 'string') {
+ if (doc.$regex._bsontype === 'BSONRegExp') {
+ return doc;
+ }
+ }
+ else {
+ return new BSONRegExp(doc.$regex, BSONRegExp.parseOptions(doc.$options));
+ }
+ }
+ if ('$regularExpression' in doc) {
+ return new BSONRegExp(doc.$regularExpression.pattern, BSONRegExp.parseOptions(doc.$regularExpression.options));
+ }
+ throw new BSONError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(doc)}`);
+ }
+ inspect(depth, options, inspect) {
+ const stylize = getStylizeFunction(options) ?? (v => v);
+ inspect ??= defaultInspect;
+ const pattern = stylize(inspect(this.pattern), 'regexp');
+ const flags = stylize(inspect(this.options), 'regexp');
+ return `new BSONRegExp(${pattern}, ${flags})`;
+ }
+}
+
+class BSONSymbol extends BSONValue {
+ get _bsontype() {
+ return 'BSONSymbol';
+ }
+ value;
+ constructor(value) {
+ super();
+ this.value = value;
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON() {
+ return { $symbol: this.value };
+ }
+ static fromExtendedJSON(doc) {
+ return new BSONSymbol(doc.$symbol);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new BSONSymbol(${inspect(this.value, options)})`;
+ }
+}
+
+const LongWithoutOverridesClass = Long;
+class Timestamp extends LongWithoutOverridesClass {
+ get _bsontype() {
+ return 'Timestamp';
+ }
+ get [bsonType]() {
+ return 'Timestamp';
+ }
+ static MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
+ get i() {
+ return this.low >>> 0;
+ }
+ get t() {
+ return this.high >>> 0;
+ }
+ constructor(low) {
+ if (low == null) {
+ super(0, 0, true);
+ }
+ else if (typeof low === 'bigint') {
+ super(low, true);
+ }
+ else if (Long.isLong(low)) {
+ super(low.low, low.high, true);
+ }
+ else if (typeof low === 'object' && 't' in low && 'i' in low) {
+ if (typeof low.t !== 'number' && (typeof low.t !== 'object' || low.t._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t as a number');
+ }
+ if (typeof low.i !== 'number' && (typeof low.i !== 'object' || low.i._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i as a number');
+ }
+ const t = Number(low.t);
+ const i = Number(low.i);
+ if (t < 0 || Number.isNaN(t)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive t');
+ }
+ if (i < 0 || Number.isNaN(i)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive i');
+ }
+ if (t > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t equal or less than uint32 max');
+ }
+ if (i > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i equal or less than uint32 max');
+ }
+ super(i, t, true);
+ }
+ else {
+ throw new BSONError('A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }');
+ }
+ }
+ toJSON() {
+ return {
+ $timestamp: this.toString()
+ };
+ }
+ static fromInt(value) {
+ return new Timestamp(Long.fromInt(value, true));
+ }
+ static fromNumber(value) {
+ return new Timestamp(Long.fromNumber(value, true));
+ }
+ static fromBits(lowBits, highBits) {
+ return new Timestamp({ i: lowBits, t: highBits });
+ }
+ static fromString(str, optRadix) {
+ return new Timestamp(Long.fromString(str, true, optRadix));
+ }
+ toExtendedJSON() {
+ return { $timestamp: { t: this.t, i: this.i } };
+ }
+ static fromExtendedJSON(doc) {
+ const i = Long.isLong(doc.$timestamp.i)
+ ? doc.$timestamp.i.getLowBitsUnsigned()
+ : doc.$timestamp.i;
+ const t = Long.isLong(doc.$timestamp.t)
+ ? doc.$timestamp.t.getLowBitsUnsigned()
+ : doc.$timestamp.t;
+ return new Timestamp({ t, i });
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const t = inspect(this.t, options);
+ const i = inspect(this.i, options);
+ return `new Timestamp({ t: ${t}, i: ${i} })`;
+ }
+}
+
+const JS_INT_MAX_LONG = Long.fromNumber(JS_INT_MAX);
+const JS_INT_MIN_LONG = Long.fromNumber(JS_INT_MIN);
+function internalDeserialize(buffer, options, isArray) {
+ options = options == null ? {} : options;
+ const index = options && options.index ? options.index : 0;
+ const size = NumberUtils.getInt32LE(buffer, index);
+ if (size < 5) {
+ throw new BSONError(`bson size must be >= 5, is ${size}`);
+ }
+ if (options.allowObjectSmallerThanBufferSize && buffer.length < size) {
+ throw new BSONError(`buffer length ${buffer.length} must be >= bson size ${size}`);
+ }
+ if (!options.allowObjectSmallerThanBufferSize && buffer.length !== size) {
+ throw new BSONError(`buffer length ${buffer.length} must === bson size ${size}`);
+ }
+ if (size + index > buffer.byteLength) {
+ throw new BSONError(`(bson size ${size} + options.index ${index} must be <= buffer length ${buffer.byteLength})`);
+ }
+ if (buffer[index + size - 1] !== 0) {
+ throw new BSONError("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");
+ }
+ return deserializeObject(buffer, index, options, isArray);
+}
+const allowedDBRefKeys = /^\$ref$|^\$id$|^\$db$/;
+function deserializeObject(buffer, index, options, isArray = false) {
+ const fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];
+ const raw = options['raw'] == null ? false : options['raw'];
+ const bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false;
+ const promoteBuffers = options.promoteBuffers ?? false;
+ const promoteLongs = options.promoteLongs ?? true;
+ const promoteValues = options.promoteValues ?? true;
+ const useBigInt64 = options.useBigInt64 ?? false;
+ if (useBigInt64 && !promoteValues) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ if (useBigInt64 && !promoteLongs) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ const validation = options.validation == null ? { utf8: true } : options.validation;
+ let globalUTFValidation = true;
+ let validationSetting;
+ let utf8KeysSet;
+ const utf8ValidatedKeys = validation.utf8;
+ if (typeof utf8ValidatedKeys === 'boolean') {
+ validationSetting = utf8ValidatedKeys;
+ }
+ else {
+ globalUTFValidation = false;
+ const utf8ValidationValues = Object.keys(utf8ValidatedKeys).map(function (key) {
+ return utf8ValidatedKeys[key];
+ });
+ if (utf8ValidationValues.length === 0) {
+ throw new BSONError('UTF-8 validation setting cannot be empty');
+ }
+ if (typeof utf8ValidationValues[0] !== 'boolean') {
+ throw new BSONError('Invalid UTF-8 validation option, must specify boolean values');
+ }
+ validationSetting = utf8ValidationValues[0];
+ if (!utf8ValidationValues.every(item => item === validationSetting)) {
+ throw new BSONError('Invalid UTF-8 validation option - keys must be all true or all false');
+ }
+ }
+ if (!globalUTFValidation) {
+ utf8KeysSet = new Set();
+ for (const key of Object.keys(utf8ValidatedKeys)) {
+ utf8KeysSet.add(key);
+ }
+ }
+ const startIndex = index;
+ if (buffer.length < 5)
+ throw new BSONError('corrupt bson message < 5 bytes long');
+ const size = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (size < 5 || size > buffer.length)
+ throw new BSONError('corrupt bson message');
+ const object = isArray ? [] : {};
+ let arrayIndex = 0;
+ let isPossibleDBRef = isArray ? false : null;
+ while (true) {
+ const elementType = buffer[index++];
+ if (elementType === 0)
+ break;
+ let i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.byteLength)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const name = isArray ? arrayIndex++ : ByteUtils.toUTF8(buffer, index, i, false);
+ let shouldValidateKey = true;
+ if (globalUTFValidation || utf8KeysSet?.has(name)) {
+ shouldValidateKey = validationSetting;
+ }
+ else {
+ shouldValidateKey = !validationSetting;
+ }
+ if (isPossibleDBRef !== false && name[0] === '$') {
+ isPossibleDBRef = allowedDBRefKeys.test(name);
+ }
+ let value;
+ index = i + 1;
+ if (elementType === BSON_DATA_STRING) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ value = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_OID) {
+ const oid = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oid[i] = buffer[index + i];
+ value = new ObjectId(oid);
+ index = index + 12;
+ }
+ else if (elementType === BSON_DATA_INT && promoteValues === false) {
+ value = new Int32(NumberUtils.getInt32LE(buffer, index));
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_INT) {
+ value = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_NUMBER) {
+ value = NumberUtils.getFloat64LE(buffer, index);
+ index += 8;
+ if (promoteValues === false)
+ value = new Double(value);
+ }
+ else if (elementType === BSON_DATA_DATE) {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ value = new Date(new Long(lowBits, highBits).toNumber());
+ }
+ else if (elementType === BSON_DATA_BOOLEAN) {
+ if (buffer[index] !== 0 && buffer[index] !== 1)
+ throw new BSONError('illegal boolean type value');
+ value = buffer[index++] === 1;
+ }
+ else if (elementType === BSON_DATA_OBJECT) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ if (objectSize <= 0 || objectSize > buffer.length - index)
+ throw new BSONError('bad embedded document length in bson');
+ if (raw) {
+ value = buffer.subarray(index, index + objectSize);
+ }
+ else {
+ let objectOptions = options;
+ if (!globalUTFValidation) {
+ objectOptions = { ...options, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, objectOptions, false);
+ }
+ index = index + objectSize;
+ }
+ else if (elementType === BSON_DATA_ARRAY) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ let arrayOptions = options;
+ const stopIndex = index + objectSize;
+ if (fieldsAsRaw && fieldsAsRaw[name]) {
+ arrayOptions = { ...options, raw: true };
+ }
+ if (!globalUTFValidation) {
+ arrayOptions = { ...arrayOptions, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, arrayOptions, true);
+ index = index + objectSize;
+ if (buffer[index - 1] !== 0)
+ throw new BSONError('invalid array terminator byte');
+ if (index !== stopIndex)
+ throw new BSONError('corrupted array bson');
+ }
+ else if (elementType === BSON_DATA_UNDEFINED) {
+ value = undefined;
+ }
+ else if (elementType === BSON_DATA_NULL) {
+ value = null;
+ }
+ else if (elementType === BSON_DATA_LONG) {
+ if (useBigInt64) {
+ value = NumberUtils.getBigInt64LE(buffer, index);
+ index += 8;
+ }
+ else {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ const long = new Long(lowBits, highBits);
+ if (promoteLongs && promoteValues === true) {
+ value =
+ long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG)
+ ? long.toNumber()
+ : long;
+ }
+ else {
+ value = long;
+ }
+ }
+ }
+ else if (elementType === BSON_DATA_DECIMAL128) {
+ const bytes = ByteUtils.allocateUnsafe(16);
+ for (let i = 0; i < 16; i++)
+ bytes[i] = buffer[index + i];
+ index = index + 16;
+ value = new Decimal128(bytes);
+ }
+ else if (elementType === BSON_DATA_BINARY) {
+ let binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ const totalBinarySize = binarySize;
+ const subType = buffer[index++];
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found');
+ if (binarySize > buffer.byteLength)
+ throw new BSONError('Binary type size larger than document size');
+ if (subType === Binary.SUBTYPE_BYTE_ARRAY) {
+ binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found for subtype 0x02');
+ if (binarySize > totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too long binary size');
+ if (binarySize < totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too short binary size');
+ }
+ if (promoteBuffers && promoteValues) {
+ value = ByteUtils.toLocalBufferType(buffer.subarray(index, index + binarySize));
+ }
+ else {
+ value = new Binary(buffer.subarray(index, index + binarySize), subType);
+ if (subType === BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
+ value = value.toUUID();
+ }
+ }
+ index = index + binarySize;
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === false) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ const optionsArray = new Array(regExpOptions.length);
+ for (i = 0; i < regExpOptions.length; i++) {
+ switch (regExpOptions[i]) {
+ case 'm':
+ optionsArray[i] = 'm';
+ break;
+ case 's':
+ optionsArray[i] = 'g';
+ break;
+ case 'i':
+ optionsArray[i] = 'i';
+ break;
+ }
+ }
+ value = new RegExp(source, optionsArray.join(''));
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === true) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ value = new BSONRegExp(source, regExpOptions);
+ }
+ else if (elementType === BSON_DATA_SYMBOL) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const symbol = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = promoteValues ? symbol : new BSONSymbol(symbol);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_TIMESTAMP) {
+ value = new Timestamp({
+ i: NumberUtils.getUint32LE(buffer, index),
+ t: NumberUtils.getUint32LE(buffer, index + 4)
+ });
+ index += 8;
+ }
+ else if (elementType === BSON_DATA_MIN_KEY) {
+ value = new MinKey();
+ }
+ else if (elementType === BSON_DATA_MAX_KEY) {
+ value = new MaxKey();
+ }
+ else if (elementType === BSON_DATA_CODE) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = new Code(functionString);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_CODE_W_SCOPE) {
+ const totalSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (totalSize < 4 + 4 + 4 + 1) {
+ throw new BSONError('code_w_scope total size shorter minimum expected length');
+ }
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ const scopeObject = deserializeObject(buffer, _index, options, false);
+ index = index + objectSize;
+ if (totalSize < 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too short, truncating scope');
+ }
+ if (totalSize > 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too long, clips outer document');
+ }
+ value = new Code(functionString, scopeObject);
+ }
+ else if (elementType === BSON_DATA_DBPOINTER) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0)
+ throw new BSONError('bad string length in bson');
+ const namespace = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const oidBuffer = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oidBuffer[i] = buffer[index + i];
+ const oid = new ObjectId(oidBuffer);
+ index = index + 12;
+ value = new DBRef(namespace, oid);
+ }
+ else {
+ throw new BSONError(`Detected unknown BSON type ${elementType.toString(16)} for fieldname "${name}"`);
+ }
+ if (name === '__proto__') {
+ Object.defineProperty(object, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ object[name] = value;
+ }
+ }
+ if (size !== index - startIndex) {
+ if (isArray)
+ throw new BSONError('corrupt array bson');
+ throw new BSONError('corrupt object bson');
+ }
+ if (!isPossibleDBRef)
+ return object;
+ if (isDBRefLike(object)) {
+ const copy = Object.assign({}, object);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(object.$ref, object.$id, object.$db, copy);
+ }
+ return object;
+}
+
+const regexp = /\x00/;
+const ignoreKeys = new Set(['$db', '$ref', '$id', '$clusterTime']);
+function serializeString(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_STRING;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes + 1;
+ buffer[index - 1] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value, index + 4);
+ NumberUtils.setInt32LE(buffer, index, size + 1);
+ index = index + 4 + size;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeNumber(buffer, key, value, index) {
+ const isNegativeZero = Object.is(value, -0);
+ const type = !isNegativeZero &&
+ Number.isSafeInteger(value) &&
+ value <= BSON_INT32_MAX &&
+ value >= BSON_INT32_MIN
+ ? BSON_DATA_INT
+ : BSON_DATA_NUMBER;
+ buffer[index++] = type;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0x00;
+ if (type === BSON_DATA_INT) {
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ }
+ else {
+ index += NumberUtils.setFloat64LE(buffer, index, value);
+ }
+ return index;
+}
+function serializeBigInt(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_LONG;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index += numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setBigInt64LE(buffer, index, value);
+ return index;
+}
+function serializeNull(buffer, key, _, index) {
+ buffer[index++] = BSON_DATA_NULL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeBoolean(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BOOLEAN;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ buffer[index++] = value ? 1 : 0;
+ return index;
+}
+function serializeDate(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DATE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const dateInMilis = Long.fromNumber(value.getTime());
+ const lowBits = dateInMilis.getLowBits();
+ const highBits = dateInMilis.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.source && value.source.match(regexp) != null) {
+ throw new BSONError('value ' + value.source + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.source, index);
+ buffer[index++] = 0x00;
+ if (value.ignoreCase)
+ buffer[index++] = 0x69;
+ if (value.global)
+ buffer[index++] = 0x73;
+ if (value.multiline)
+ buffer[index++] = 0x6d;
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeBSONRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.pattern.match(regexp) != null) {
+ throw new BSONError('pattern ' + value.pattern + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.pattern, index);
+ buffer[index++] = 0x00;
+ const sortedOptions = value.options.split('').sort().join('');
+ index = index + ByteUtils.encodeUTF8Into(buffer, sortedOptions, index);
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeMinMax(buffer, key, value, index) {
+ if (value === null) {
+ buffer[index++] = BSON_DATA_NULL;
+ }
+ else if (value._bsontype === 'MinKey') {
+ buffer[index++] = BSON_DATA_MIN_KEY;
+ }
+ else {
+ buffer[index++] = BSON_DATA_MAX_KEY;
+ }
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeObjectId(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_OID;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += value.serializeInto(buffer, index);
+ return index;
+}
+function serializeBuffer(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = value.length;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = BSON_BINARY_SUBTYPE_DEFAULT;
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = value[i];
+ }
+ else {
+ buffer.set(value, index);
+ }
+ index = index + size;
+ return index;
+}
+function serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path.has(value)) {
+ throw new BSONError('Cannot convert circular structure to BSON');
+ }
+ path.add(value);
+ buffer[index++] = Array.isArray(value) ? BSON_DATA_ARRAY : BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ path.delete(value);
+ return endIndex;
+}
+function serializeDecimal128(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DECIMAL128;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ for (let i = 0; i < 16; i++)
+ buffer[index + i] = value.bytes[i];
+ return index + 16;
+}
+function serializeLong(buffer, key, value, index) {
+ buffer[index++] =
+ value._bsontype === 'Long' ? BSON_DATA_LONG : BSON_DATA_TIMESTAMP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const lowBits = value.getLowBits();
+ const highBits = value.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeInt32(buffer, key, value, index) {
+ value = value.valueOf();
+ buffer[index++] = BSON_DATA_INT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ return index;
+}
+function serializeDouble(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_NUMBER;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setFloat64LE(buffer, index, value.value);
+ return index;
+}
+function serializeFunction(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeCode(buffer, key, value, index, checkKeys = false, depth = 0, serializeFunctions = false, ignoreUndefined = true, path) {
+ if (value.scope && typeof value.scope === 'object') {
+ buffer[index++] = BSON_DATA_CODE_W_SCOPE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ const functionString = value.code;
+ index = index + 4;
+ const codeSize = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, codeSize);
+ buffer[index + 4 + codeSize - 1] = 0;
+ index = index + codeSize + 4;
+ const endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ index = endIndex - 1;
+ const totalSize = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, startIndex, totalSize);
+ buffer[index++] = 0;
+ }
+ else {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.code.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ }
+ return index;
+}
+function serializeBinary(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const data = value.buffer;
+ let size = value.position;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY)
+ size = size + 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = value.sub_type;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ size = size - 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ }
+ if (value.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(value);
+ }
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = data[i];
+ }
+ else {
+ buffer.set(data, index);
+ }
+ index = index + value.position;
+ return index;
+}
+function serializeSymbol(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_SYMBOL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value.value, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path) {
+ buffer[index++] = BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ let output = {
+ $ref: value.collection || value.namespace,
+ $id: value.oid
+ };
+ if (value.db != null) {
+ output.$db = value.db;
+ }
+ output = Object.assign(output, value.fields);
+ const endIndex = serializeInto(buffer, output, false, index, depth + 1, serializeFunctions, true, path);
+ const size = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, index, size);
+ return endIndex;
+}
+function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path == null) {
+ if (object == null) {
+ buffer[0] = 0x05;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ buffer[4] = 0x00;
+ return 5;
+ }
+ if (Array.isArray(object)) {
+ throw new BSONError('serialize does not support an array as the root input');
+ }
+ if (typeof object !== 'object') {
+ throw new BSONError('serialize does not support non-object as the root input');
+ }
+ else if ('_bsontype' in object && typeof object._bsontype === 'string') {
+ throw new BSONError(`BSON types cannot be serialized as a document`);
+ }
+ else if (isDate(object) ||
+ isRegExp(object) ||
+ isUint8Array(object) ||
+ isAnyArrayBuffer(object)) {
+ throw new BSONError(`date, regexp, typedarray, and arraybuffer cannot be BSON documents`);
+ }
+ path = new Set();
+ }
+ path.add(object);
+ let index = startingIndex + 4;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ const key = `${i}`;
+ let value = object[i];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (value === undefined) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else if (object instanceof Map || isMap(object)) {
+ const iterator = object.entries();
+ let done = false;
+ while (!done) {
+ const entry = iterator.next();
+ done = !!entry.done;
+ if (done)
+ continue;
+ const key = entry.value ? entry.value[0] : undefined;
+ let value = entry.value ? entry.value[1] : undefined;
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ if (object != null && typeof object !== 'object') {
+ throw new BSONError('toBSON function did not return an object');
+ }
+ }
+ for (const key of Object.keys(object)) {
+ let value = object[key];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ path.delete(object);
+ buffer[index++] = 0x00;
+ const size = index - startingIndex;
+ startingIndex += NumberUtils.setInt32LE(buffer, startingIndex, size);
+ return index;
+}
+
+function isBSONType(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '_bsontype' in value &&
+ typeof value._bsontype === 'string');
+}
+const keysToCodecs = {
+ $oid: ObjectId,
+ $binary: Binary,
+ $uuid: Binary,
+ $symbol: BSONSymbol,
+ $numberInt: Int32,
+ $numberDecimal: Decimal128,
+ $numberDouble: Double,
+ $numberLong: Long,
+ $minKey: MinKey,
+ $maxKey: MaxKey,
+ $regex: BSONRegExp,
+ $regularExpression: BSONRegExp,
+ $timestamp: Timestamp
+};
+function deserializeValue(value, options = {}) {
+ if (typeof value === 'number') {
+ const in32BitRange = value <= BSON_INT32_MAX && value >= BSON_INT32_MIN;
+ const in64BitRange = value <= BSON_INT64_MAX && value >= BSON_INT64_MIN;
+ if (options.relaxed || options.legacy) {
+ return value;
+ }
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (in32BitRange) {
+ return new Int32(value);
+ }
+ if (in64BitRange) {
+ if (options.useBigInt64) {
+ return BigInt(value);
+ }
+ return Long.fromNumber(value);
+ }
+ }
+ return new Double(value);
+ }
+ if (value == null || typeof value !== 'object')
+ return value;
+ if (value.$undefined)
+ return null;
+ const keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);
+ for (let i = 0; i < keys.length; i++) {
+ const c = keysToCodecs[keys[i]];
+ if (c)
+ return c.fromExtendedJSON(value, options);
+ }
+ if (value.$date != null) {
+ const d = value.$date;
+ const date = new Date();
+ if (options.legacy) {
+ if (typeof d === 'number')
+ date.setTime(d);
+ else if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ else {
+ if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (Long.isLong(d))
+ date.setTime(d.toNumber());
+ else if (typeof d === 'number' && options.relaxed)
+ date.setTime(d);
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ return date;
+ }
+ if (value.$code != null) {
+ const copy = Object.assign({}, value);
+ if (value.$scope) {
+ copy.$scope = deserializeValue(value.$scope);
+ }
+ return Code.fromExtendedJSON(value);
+ }
+ if (isDBRefLike(value) || value.$dbPointer) {
+ const v = value.$ref ? value : value.$dbPointer;
+ if (v instanceof DBRef)
+ return v;
+ const dollarKeys = Object.keys(v).filter(k => k.startsWith('$'));
+ let valid = true;
+ dollarKeys.forEach(k => {
+ if (['$ref', '$id', '$db'].indexOf(k) === -1)
+ valid = false;
+ });
+ if (valid)
+ return DBRef.fromExtendedJSON(v);
+ }
+ return value;
+}
+function serializeArray(array, options) {
+ return array.map((v, index) => {
+ options.seenObjects.push({ propertyName: `index ${index}`, obj: null });
+ try {
+ return serializeValue(v, options);
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ });
+}
+function getISOString(date) {
+ const isoStr = date.toISOString();
+ return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';
+}
+function serializeValue(value, options) {
+ if (value instanceof Map || isMap(value)) {
+ const obj = Object.create(null);
+ for (const [k, v] of value) {
+ if (typeof k !== 'string') {
+ throw new BSONError('Can only serialize maps with string keys');
+ }
+ obj[k] = v;
+ }
+ return serializeValue(obj, options);
+ }
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null) {
+ const index = options.seenObjects.findIndex(entry => entry.obj === value);
+ if (index !== -1) {
+ const props = options.seenObjects.map(entry => entry.propertyName);
+ const leadingPart = props
+ .slice(0, index)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const alreadySeen = props[index];
+ const circularPart = ' -> ' +
+ props
+ .slice(index + 1, props.length - 1)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const current = props[props.length - 1];
+ const leadingSpace = ' '.repeat(leadingPart.length + alreadySeen.length / 2);
+ const dashes = '-'.repeat(circularPart.length + (alreadySeen.length + current.length) / 2 - 1);
+ throw new BSONError('Converting circular structure to EJSON:\n' +
+ ` ${leadingPart}${alreadySeen}${circularPart}${current}\n` +
+ ` ${leadingSpace}\\${dashes}/`);
+ }
+ options.seenObjects[options.seenObjects.length - 1].obj = value;
+ }
+ if (Array.isArray(value))
+ return serializeArray(value, options);
+ if (value === undefined)
+ return options.ignoreUndefined ? undefined : null;
+ if (value instanceof Date || isDate(value)) {
+ const dateNum = value.getTime(), inRange = dateNum > -1 && dateNum < 253402318800000;
+ if (options.legacy) {
+ return options.relaxed && inRange
+ ? { $date: value.getTime() }
+ : { $date: getISOString(value) };
+ }
+ return options.relaxed && inRange
+ ? { $date: getISOString(value) }
+ : { $date: { $numberLong: value.getTime().toString() } };
+ }
+ if (typeof value === 'number' && (!options.relaxed || !isFinite(value))) {
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return { $numberInt: value.toString() };
+ }
+ if (value >= BSON_INT64_MIN && value <= BSON_INT64_MAX) {
+ return { $numberLong: value.toString() };
+ }
+ }
+ return { $numberDouble: Object.is(value, -0) ? '-0.0' : value.toString() };
+ }
+ if (typeof value === 'bigint') {
+ if (!options.relaxed) {
+ return { $numberLong: BigInt.asIntN(64, value).toString() };
+ }
+ return Number(BigInt.asIntN(64, value));
+ }
+ if (value instanceof RegExp || isRegExp(value)) {
+ let flags = value.flags;
+ if (flags === undefined) {
+ const match = value.toString().match(/[gimuy]*$/);
+ if (match) {
+ flags = match[0];
+ }
+ }
+ const rx = new BSONRegExp(value.source, flags);
+ return rx.toExtendedJSON(options);
+ }
+ if (value != null && typeof value === 'object')
+ return serializeDocument(value, options);
+ return value;
+}
+const BSON_TYPE_MAPPINGS = {
+ Binary: (o) => new Binary(o.value(), o.sub_type),
+ Code: (o) => new Code(o.code, o.scope),
+ DBRef: (o) => new DBRef(o.collection || o.namespace, o.oid, o.db, o.fields),
+ Decimal128: (o) => new Decimal128(o.bytes),
+ Double: (o) => new Double(o.value),
+ Int32: (o) => new Int32(o.value),
+ 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_),
+ MaxKey: () => new MaxKey(),
+ MinKey: () => new MinKey(),
+ ObjectId: (o) => new ObjectId(o),
+ BSONRegExp: (o) => new BSONRegExp(o.pattern, o.options),
+ BSONSymbol: (o) => new BSONSymbol(o.value),
+ Timestamp: (o) => Timestamp.fromBits(o.low, o.high)
+};
+function serializeDocument(doc, options) {
+ if (doc == null || typeof doc !== 'object')
+ throw new BSONError('not an object instance');
+ const bsontype = doc._bsontype;
+ if (typeof bsontype === 'undefined') {
+ const _doc = {};
+ for (const name of Object.keys(doc)) {
+ options.seenObjects.push({ propertyName: name, obj: null });
+ try {
+ const value = serializeValue(doc[name], options);
+ if (name === '__proto__') {
+ Object.defineProperty(_doc, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ _doc[name] = value;
+ }
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ }
+ return _doc;
+ }
+ else if (doc != null &&
+ typeof doc === 'object' &&
+ typeof doc._bsontype === 'string' &&
+ doc[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (isBSONType(doc)) {
+ let outDoc = doc;
+ if (typeof outDoc.toExtendedJSON !== 'function') {
+ const mapper = BSON_TYPE_MAPPINGS[doc._bsontype];
+ if (!mapper) {
+ throw new BSONError('Unrecognized or invalid _bsontype: ' + doc._bsontype);
+ }
+ outDoc = mapper(outDoc);
+ }
+ if (bsontype === 'Code' && outDoc.scope) {
+ outDoc = new Code(outDoc.code, serializeValue(outDoc.scope, options));
+ }
+ else if (bsontype === 'DBRef' && outDoc.oid) {
+ outDoc = new DBRef(serializeValue(outDoc.collection, options), serializeValue(outDoc.oid, options), serializeValue(outDoc.db, options), serializeValue(outDoc.fields, options));
+ }
+ return outDoc.toExtendedJSON(options);
+ }
+ else {
+ throw new BSONError('_bsontype must be a string, but was: ' + typeof bsontype);
+ }
+}
+function parse(text, options) {
+ const ejsonOptions = {
+ useBigInt64: options?.useBigInt64 ?? false,
+ relaxed: options?.relaxed ?? true,
+ legacy: options?.legacy ?? false
+ };
+ return JSON.parse(text, (key, value) => {
+ if (key.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Document field names cannot contain null bytes, found: ${JSON.stringify(key)}`);
+ }
+ return deserializeValue(value, ejsonOptions);
+ });
+}
+function stringify(value, replacer, space, options) {
+ if (space != null && typeof space === 'object') {
+ options = space;
+ space = 0;
+ }
+ if (replacer != null && typeof replacer === 'object' && !Array.isArray(replacer)) {
+ options = replacer;
+ replacer = undefined;
+ space = 0;
+ }
+ const serializeOptions = Object.assign({ relaxed: true, legacy: false }, options, {
+ seenObjects: [{ propertyName: '(root)', obj: null }]
+ });
+ const doc = serializeValue(value, serializeOptions);
+ return JSON.stringify(doc, replacer, space);
+}
+function EJSONserialize(value, options) {
+ options = options || {};
+ return JSON.parse(stringify(value, options));
+}
+function EJSONdeserialize(ejson, options) {
+ options = options || {};
+ return parse(JSON.stringify(ejson), options);
+}
+const EJSON = Object.create(null);
+EJSON.parse = parse;
+EJSON.stringify = stringify;
+EJSON.serialize = EJSONserialize;
+EJSON.deserialize = EJSONdeserialize;
+Object.freeze(EJSON);
+
+const BSONElementType = {
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: 255,
+ maxKey: 127
+};
+function getSize(source, offset) {
+ try {
+ return NumberUtils.getNonnegativeInt32LE(source, offset);
+ }
+ catch (cause) {
+ throw new BSONOffsetError('BSON size cannot be negative', offset, { cause });
+ }
+}
+function findNull(bytes, offset) {
+ let nullTerminatorOffset = offset;
+ for (; bytes[nullTerminatorOffset] !== 0x00; nullTerminatorOffset++)
+ ;
+ if (nullTerminatorOffset === bytes.length - 1) {
+ throw new BSONOffsetError('Null terminator not found', offset);
+ }
+ return nullTerminatorOffset;
+}
+function parseToElements(bytes, startOffset = 0) {
+ startOffset ??= 0;
+ if (bytes.length < 5) {
+ throw new BSONOffsetError(`Input must be at least 5 bytes, got ${bytes.length} bytes`, startOffset);
+ }
+ const documentSize = getSize(bytes, startOffset);
+ if (documentSize > bytes.length - startOffset) {
+ throw new BSONOffsetError(`Parsed documentSize (${documentSize} bytes) does not match input length (${bytes.length} bytes)`, startOffset);
+ }
+ if (bytes[startOffset + documentSize - 1] !== 0x00) {
+ throw new BSONOffsetError('BSON documents must end in 0x00', startOffset + documentSize);
+ }
+ const elements = [];
+ let offset = startOffset + 4;
+ while (offset <= documentSize + startOffset) {
+ const type = bytes[offset];
+ offset += 1;
+ if (type === 0) {
+ if (offset - startOffset !== documentSize) {
+ throw new BSONOffsetError(`Invalid 0x00 type byte`, offset);
+ }
+ break;
+ }
+ const nameOffset = offset;
+ const nameLength = findNull(bytes, offset) - nameOffset;
+ offset += nameLength + 1;
+ let length;
+ if (type === BSONElementType.double ||
+ type === BSONElementType.long ||
+ type === BSONElementType.date ||
+ type === BSONElementType.timestamp) {
+ length = 8;
+ }
+ else if (type === BSONElementType.int) {
+ length = 4;
+ }
+ else if (type === BSONElementType.objectId) {
+ length = 12;
+ }
+ else if (type === BSONElementType.decimal) {
+ length = 16;
+ }
+ else if (type === BSONElementType.bool) {
+ length = 1;
+ }
+ else if (type === BSONElementType.null ||
+ type === BSONElementType.undefined ||
+ type === BSONElementType.maxKey ||
+ type === BSONElementType.minKey) {
+ length = 0;
+ }
+ else if (type === BSONElementType.regex) {
+ length = findNull(bytes, findNull(bytes, offset) + 1) + 1 - offset;
+ }
+ else if (type === BSONElementType.object ||
+ type === BSONElementType.array ||
+ type === BSONElementType.javascriptWithScope) {
+ length = getSize(bytes, offset);
+ }
+ else if (type === BSONElementType.string ||
+ type === BSONElementType.binData ||
+ type === BSONElementType.dbPointer ||
+ type === BSONElementType.javascript ||
+ type === BSONElementType.symbol) {
+ length = getSize(bytes, offset) + 4;
+ if (type === BSONElementType.binData) {
+ length += 1;
+ }
+ if (type === BSONElementType.dbPointer) {
+ length += 12;
+ }
+ }
+ else {
+ throw new BSONOffsetError(`Invalid 0x${type.toString(16).padStart(2, '0')} type byte`, offset);
+ }
+ if (length > documentSize) {
+ throw new BSONOffsetError('value reports length larger than document', offset);
+ }
+ elements.push([type, nameOffset, nameLength, offset, length]);
+ offset += length;
+ }
+ return elements;
+}
+
+const onDemand = Object.create(null);
+onDemand.parseToElements = parseToElements;
+onDemand.ByteUtils = ByteUtils;
+onDemand.NumberUtils = NumberUtils;
+Object.freeze(onDemand);
+
+const MAXSIZE = 1024 * 1024 * 17;
+let buffer = ByteUtils.allocate(MAXSIZE);
+function setInternalBufferSize(size) {
+ if (buffer.length < size) {
+ buffer = ByteUtils.allocate(size);
+ }
+}
+function serialize(object, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const minInternalBufferSize = typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE;
+ if (buffer.length < minInternalBufferSize) {
+ buffer = ByteUtils.allocate(minInternalBufferSize);
+ }
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ const finishedBuffer = ByteUtils.allocateUnsafe(serializationIndex);
+ finishedBuffer.set(buffer.subarray(0, serializationIndex), 0);
+ return finishedBuffer;
+}
+function serializeWithBufferAndIndex(object, finalBuffer, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const startIndex = typeof options.index === 'number' ? options.index : 0;
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ finalBuffer.set(buffer.subarray(0, serializationIndex), startIndex);
+ return startIndex + serializationIndex - 1;
+}
+function deserialize(buffer, options = {}) {
+ return internalDeserialize(ByteUtils.toLocalBufferType(buffer), options);
+}
+function calculateObjectSize(object, options = {}) {
+ options = options || {};
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ return internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined);
+}
+function deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {
+ const internalOptions = Object.assign({ allowObjectSmallerThanBufferSize: true, index: 0 }, options);
+ const bufferData = ByteUtils.toLocalBufferType(data);
+ let index = startIndex;
+ for (let i = 0; i < numberOfDocuments; i++) {
+ const size = NumberUtils.getInt32LE(bufferData, index);
+ internalOptions.index = index;
+ documents[docStartIndex + i] = internalDeserialize(bufferData, internalOptions);
+ index = index + size;
+ }
+ return index;
+}
+
+var bson = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ BSONError: BSONError,
+ BSONOffsetError: BSONOffsetError,
+ BSONRegExp: BSONRegExp,
+ BSONRuntimeError: BSONRuntimeError,
+ BSONSymbol: BSONSymbol,
+ BSONType: BSONType,
+ BSONValue: BSONValue,
+ BSONVersionError: BSONVersionError,
+ Binary: Binary,
+ ByteUtils: ByteUtils,
+ Code: Code,
+ DBRef: DBRef,
+ Decimal128: Decimal128,
+ Double: Double,
+ EJSON: EJSON,
+ Int32: Int32,
+ Long: Long,
+ MaxKey: MaxKey,
+ MinKey: MinKey,
+ NumberUtils: NumberUtils,
+ ObjectId: ObjectId,
+ Timestamp: Timestamp,
+ UUID: UUID,
+ bsonType: bsonType,
+ calculateObjectSize: calculateObjectSize,
+ deserialize: deserialize,
+ deserializeStream: deserializeStream,
+ onDemand: onDemand,
+ serialize: serialize,
+ serializeWithBufferAndIndex: serializeWithBufferAndIndex,
+ setInternalBufferSize: setInternalBufferSize
+});
+
+export { bson as BSON, BSONError, BSONOffsetError, BSONRegExp, BSONRuntimeError, BSONSymbol, BSONType, BSONValue, BSONVersionError, Binary, ByteUtils, Code, DBRef, Decimal128, Double, EJSON, Int32, Long, MaxKey, MinKey, NumberUtils, ObjectId, Timestamp, UUID, bsonType, calculateObjectSize, deserialize, deserializeStream, onDemand, serialize, serializeWithBufferAndIndex, setInternalBufferSize };
+//# sourceMappingURL=bson.node.mjs.map
diff --git a/node_modules/bson/lib/bson.node.mjs.map b/node_modules/bson/lib/bson.node.mjs.map
new file mode 100644
index 00000000..dc05f0c9
--- /dev/null
+++ b/node_modules/bson/lib/bson.node.mjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"bson.node.mjs","sources":["../src/parser/utils.ts","../src/constants.ts","../src/error.ts","../src/parse_utf8.ts","../src/utils/latin.ts","../src/utils/node_byte_utils.ts","../src/utils/web_byte_utils.ts","../src/utils/byte_utils.ts","../src/bson_value.ts","../src/utils/number_utils.ts","../src/binary.ts","../src/code.ts","../src/db_ref.ts","../src/utils/string_utils.ts","../src/long.ts","../src/decimal128.ts","../src/double.ts","../src/int_32.ts","../src/max_key.ts","../src/min_key.ts","../src/objectid.ts","../src/parser/calculate_size.ts","../src/regexp.ts","../src/symbol.ts","../src/timestamp.ts","../src/parser/deserializer.ts","../src/parser/serializer.ts","../src/extended_json.ts","../src/parser/on_demand/parse_to_elements.ts","../src/parser/on_demand/index.ts","../src/bson.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["StringUtils.validateStringCharacters","StringUtils.removeLeadingZerosAndExplicitPlus","constants.JS_INT_MIN","constants.JS_INT_MAX","constants.BSON_INT32_MIN","constants.BSON_INT32_MAX","constants.BSON_VERSION_SYMBOL","constants.BSON_MAJOR_VERSION","constants.BSON_DATA_STRING","constants.BSON_DATA_OID","constants.BSON_DATA_INT","constants.BSON_DATA_NUMBER","constants.BSON_DATA_DATE","constants.BSON_DATA_BOOLEAN","constants.BSON_DATA_OBJECT","constants.BSON_DATA_ARRAY","constants.BSON_DATA_UNDEFINED","constants.BSON_DATA_NULL","constants.BSON_DATA_LONG","constants.BSON_DATA_DECIMAL128","constants.BSON_DATA_BINARY","constants.BSON_BINARY_SUBTYPE_UUID_NEW","constants.BSON_DATA_REGEXP","constants.BSON_DATA_SYMBOL","constants.BSON_DATA_TIMESTAMP","constants.BSON_DATA_MIN_KEY","constants.BSON_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lib/bson.rn.cjs
new file mode 100644
index 00000000..b0c1c8da
--- /dev/null
+++ b/node_modules/bson/lib/bson.rn.cjs
@@ -0,0 +1,4755 @@
+'use strict';
+
+const TypedArrayPrototypeGetSymbolToStringTag = (() => {
+ const g = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get;
+ return (value) => g.call(value);
+})();
+function isUint8Array(value) {
+ return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array';
+}
+function isAnyArrayBuffer(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ (value[Symbol.toStringTag] === 'ArrayBuffer' ||
+ value[Symbol.toStringTag] === 'SharedArrayBuffer'));
+}
+function isRegExp(regexp) {
+ return regexp instanceof RegExp || Object.prototype.toString.call(regexp) === '[object RegExp]';
+}
+function isMap(value) {
+ return (typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ value[Symbol.toStringTag] === 'Map');
+}
+function isDate(date) {
+ return date instanceof Date || Object.prototype.toString.call(date) === '[object Date]';
+}
+function defaultInspect(x, _options) {
+ return JSON.stringify(x, (k, v) => {
+ if (typeof v === 'bigint') {
+ return { $numberLong: `${v}` };
+ }
+ else if (isMap(v)) {
+ return Object.fromEntries(v);
+ }
+ return v;
+ });
+}
+function getStylizeFunction(options) {
+ const stylizeExists = options != null &&
+ typeof options === 'object' &&
+ 'stylize' in options &&
+ typeof options.stylize === 'function';
+ if (stylizeExists) {
+ return options.stylize;
+ }
+}
+
+const BSON_MAJOR_VERSION = 7;
+const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version');
+const BSON_INT32_MAX = 0x7fffffff;
+const BSON_INT32_MIN = -0x80000000;
+const BSON_INT64_MAX = Math.pow(2, 63) - 1;
+const BSON_INT64_MIN = -Math.pow(2, 63);
+const JS_INT_MAX = Math.pow(2, 53);
+const JS_INT_MIN = -Math.pow(2, 53);
+const BSON_DATA_NUMBER = 1;
+const BSON_DATA_STRING = 2;
+const BSON_DATA_OBJECT = 3;
+const BSON_DATA_ARRAY = 4;
+const BSON_DATA_BINARY = 5;
+const BSON_DATA_UNDEFINED = 6;
+const BSON_DATA_OID = 7;
+const BSON_DATA_BOOLEAN = 8;
+const BSON_DATA_DATE = 9;
+const BSON_DATA_NULL = 10;
+const BSON_DATA_REGEXP = 11;
+const BSON_DATA_DBPOINTER = 12;
+const BSON_DATA_CODE = 13;
+const BSON_DATA_SYMBOL = 14;
+const BSON_DATA_CODE_W_SCOPE = 15;
+const BSON_DATA_INT = 16;
+const BSON_DATA_TIMESTAMP = 17;
+const BSON_DATA_LONG = 18;
+const BSON_DATA_DECIMAL128 = 19;
+const BSON_DATA_MIN_KEY = 0xff;
+const BSON_DATA_MAX_KEY = 0x7f;
+const BSON_BINARY_SUBTYPE_DEFAULT = 0;
+const BSON_BINARY_SUBTYPE_FUNCTION = 1;
+const BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;
+const BSON_BINARY_SUBTYPE_UUID = 3;
+const BSON_BINARY_SUBTYPE_UUID_NEW = 4;
+const BSON_BINARY_SUBTYPE_MD5 = 5;
+const BSON_BINARY_SUBTYPE_ENCRYPTED = 6;
+const BSON_BINARY_SUBTYPE_COLUMN = 7;
+const BSON_BINARY_SUBTYPE_SENSITIVE = 8;
+const BSON_BINARY_SUBTYPE_USER_DEFINED = 128;
+const BSONType = Object.freeze({
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: -1,
+ maxKey: 127
+});
+
+class BSONError extends Error {
+ get bsonError() {
+ return true;
+ }
+ get name() {
+ return 'BSONError';
+ }
+ constructor(message, options) {
+ super(message, options);
+ }
+ static isBSONError(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ 'bsonError' in value &&
+ value.bsonError === true &&
+ 'name' in value &&
+ 'message' in value &&
+ 'stack' in value);
+ }
+}
+class BSONVersionError extends BSONError {
+ get name() {
+ return 'BSONVersionError';
+ }
+ constructor() {
+ super(`Unsupported BSON version, bson types must be from bson ${BSON_MAJOR_VERSION}.x.x`);
+ }
+}
+class BSONRuntimeError extends BSONError {
+ get name() {
+ return 'BSONRuntimeError';
+ }
+ constructor(message) {
+ super(message);
+ }
+}
+class BSONOffsetError extends BSONError {
+ get name() {
+ return 'BSONOffsetError';
+ }
+ offset;
+ constructor(message, offset, options) {
+ super(`${message}. offset: ${offset}`, options);
+ this.offset = offset;
+ }
+}
+
+let TextDecoderFatal;
+let TextDecoderNonFatal;
+function parseUtf8(buffer, start, end, fatal) {
+ if (fatal) {
+ TextDecoderFatal ??= new TextDecoder('utf8', { fatal: true });
+ try {
+ return TextDecoderFatal.decode(buffer.subarray(start, end));
+ }
+ catch (cause) {
+ throw new BSONError('Invalid UTF-8 string in BSON document', { cause });
+ }
+ }
+ TextDecoderNonFatal ??= new TextDecoder('utf8', { fatal: false });
+ return TextDecoderNonFatal.decode(buffer.subarray(start, end));
+}
+
+function tryReadBasicLatin(uint8array, start, end) {
+ if (uint8array.length === 0) {
+ return '';
+ }
+ const stringByteLength = end - start;
+ if (stringByteLength === 0) {
+ return '';
+ }
+ if (stringByteLength > 20) {
+ return null;
+ }
+ if (stringByteLength === 1 && uint8array[start] < 128) {
+ return String.fromCharCode(uint8array[start]);
+ }
+ if (stringByteLength === 2 && uint8array[start] < 128 && uint8array[start + 1] < 128) {
+ return String.fromCharCode(uint8array[start]) + String.fromCharCode(uint8array[start + 1]);
+ }
+ if (stringByteLength === 3 &&
+ uint8array[start] < 128 &&
+ uint8array[start + 1] < 128 &&
+ uint8array[start + 2] < 128) {
+ return (String.fromCharCode(uint8array[start]) +
+ String.fromCharCode(uint8array[start + 1]) +
+ String.fromCharCode(uint8array[start + 2]));
+ }
+ const latinBytes = [];
+ for (let i = start; i < end; i++) {
+ const byte = uint8array[i];
+ if (byte > 127) {
+ return null;
+ }
+ latinBytes.push(byte);
+ }
+ return String.fromCharCode(...latinBytes);
+}
+function tryWriteBasicLatin(destination, source, offset) {
+ if (source.length === 0)
+ return 0;
+ if (source.length > 25)
+ return null;
+ if (destination.length - offset < source.length)
+ return null;
+ for (let charOffset = 0, destinationOffset = offset; charOffset < source.length; charOffset++, destinationOffset++) {
+ const char = source.charCodeAt(charOffset);
+ if (char > 127)
+ return null;
+ destination[destinationOffset] = char;
+ }
+ return source.length;
+}
+
+function nodejsMathRandomBytes(byteLength) {
+ return nodeJsByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+function nodejsSecureRandomBytes(byteLength) {
+ return crypto.getRandomValues(nodeJsByteUtils.allocate(byteLength));
+}
+const nodejsRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return nodejsSecureRandomBytes;
+ }
+ else {
+ return nodejsMathRandomBytes;
+ }
+})();
+const nodeJsByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialBuffer) {
+ if (Buffer.isBuffer(potentialBuffer)) {
+ return potentialBuffer;
+ }
+ if (ArrayBuffer.isView(potentialBuffer)) {
+ return Buffer.from(potentialBuffer.buffer, potentialBuffer.byteOffset, potentialBuffer.byteLength);
+ }
+ const stringTag = potentialBuffer?.[Symbol.toStringTag] ?? Object.prototype.toString.call(potentialBuffer);
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return Buffer.from(potentialBuffer);
+ }
+ throw new BSONError(`Cannot create Buffer from the passed potentialBuffer.`);
+ },
+ allocate(size) {
+ return Buffer.alloc(size);
+ },
+ allocateUnsafe(size) {
+ return Buffer.allocUnsafe(size);
+ },
+ compare(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).compare(b);
+ },
+ concat(list) {
+ return Buffer.concat(list);
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ return nodeJsByteUtils
+ .toLocalBufferType(source)
+ .copy(target, targetStart ?? 0, sourceStart ?? 0, sourceEnd ?? source.length);
+ },
+ equals(a, b) {
+ return nodeJsByteUtils.toLocalBufferType(a).equals(b);
+ },
+ fromNumberArray(array) {
+ return Buffer.from(array);
+ },
+ fromBase64(base64) {
+ return Buffer.from(base64, 'base64');
+ },
+ fromUTF8(utf8) {
+ return Buffer.from(utf8, 'utf8');
+ },
+ toBase64(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('base64');
+ },
+ fromISO88591(codePoints) {
+ return Buffer.from(codePoints, 'binary');
+ },
+ toISO88591(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('binary');
+ },
+ fromHex(hex) {
+ return Buffer.from(hex, 'hex');
+ },
+ toHex(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('hex');
+ },
+ toUTF8(buffer, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(buffer, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ const string = nodeJsByteUtils.toLocalBufferType(buffer).toString('utf8', start, end);
+ if (fatal) {
+ for (let i = 0; i < string.length; i++) {
+ if (string.charCodeAt(i) === 0xfffd) {
+ parseUtf8(buffer, start, end, true);
+ break;
+ }
+ }
+ }
+ return string;
+ },
+ utf8ByteLength(input) {
+ return Buffer.byteLength(input, 'utf8');
+ },
+ encodeUTF8Into(buffer, source, byteOffset) {
+ const latinBytesWritten = tryWriteBasicLatin(buffer, source, byteOffset);
+ if (latinBytesWritten != null) {
+ return latinBytesWritten;
+ }
+ return nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8');
+ },
+ randomBytes: nodejsRandomBytes,
+ swap32(buffer) {
+ return nodeJsByteUtils.toLocalBufferType(buffer).swap32();
+ }
+};
+
+function isReactNative() {
+ const { navigator } = globalThis;
+ return typeof navigator === 'object' && navigator.product === 'ReactNative';
+}
+function webMathRandomBytes(byteLength) {
+ if (byteLength < 0) {
+ throw new RangeError(`The argument 'byteLength' is invalid. Received ${byteLength}`);
+ }
+ return webByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
+}
+const webRandomBytes = (() => {
+ const { crypto } = globalThis;
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return (byteLength) => {
+ return crypto.getRandomValues(webByteUtils.allocate(byteLength));
+ };
+ }
+ else {
+ if (isReactNative()) {
+ const { console } = globalThis;
+ console?.warn?.('BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.');
+ }
+ return webMathRandomBytes;
+ }
+})();
+const HEX_DIGIT = /(\d|[a-f])/i;
+const webByteUtils = {
+ isUint8Array: isUint8Array,
+ toLocalBufferType(potentialUint8array) {
+ const stringTag = potentialUint8array?.[Symbol.toStringTag] ??
+ Object.prototype.toString.call(potentialUint8array);
+ if (stringTag === 'Uint8Array') {
+ return potentialUint8array;
+ }
+ if (ArrayBuffer.isView(potentialUint8array)) {
+ return new Uint8Array(potentialUint8array.buffer.slice(potentialUint8array.byteOffset, potentialUint8array.byteOffset + potentialUint8array.byteLength));
+ }
+ if (stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]') {
+ return new Uint8Array(potentialUint8array);
+ }
+ throw new BSONError(`Cannot make a Uint8Array from passed potentialBuffer.`);
+ },
+ allocate(size) {
+ if (typeof size !== 'number') {
+ throw new TypeError(`The "size" argument must be of type number. Received ${String(size)}`);
+ }
+ return new Uint8Array(size);
+ },
+ allocateUnsafe(size) {
+ return webByteUtils.allocate(size);
+ },
+ compare(uint8Array, otherUint8Array) {
+ if (uint8Array === otherUint8Array)
+ return 0;
+ const len = Math.min(uint8Array.length, otherUint8Array.length);
+ for (let i = 0; i < len; i++) {
+ if (uint8Array[i] < otherUint8Array[i])
+ return -1;
+ if (uint8Array[i] > otherUint8Array[i])
+ return 1;
+ }
+ if (uint8Array.length < otherUint8Array.length)
+ return -1;
+ if (uint8Array.length > otherUint8Array.length)
+ return 1;
+ return 0;
+ },
+ concat(uint8Arrays) {
+ if (uint8Arrays.length === 0)
+ return webByteUtils.allocate(0);
+ let totalLength = 0;
+ for (const uint8Array of uint8Arrays) {
+ totalLength += uint8Array.length;
+ }
+ const result = webByteUtils.allocate(totalLength);
+ let offset = 0;
+ for (const uint8Array of uint8Arrays) {
+ result.set(uint8Array, offset);
+ offset += uint8Array.length;
+ }
+ return result;
+ },
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
+ if (sourceEnd !== undefined && sourceEnd < 0) {
+ throw new RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${sourceEnd}`);
+ }
+ sourceEnd = sourceEnd ?? source.length;
+ if (sourceStart !== undefined && (sourceStart < 0 || sourceStart > sourceEnd)) {
+ throw new RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${sourceEnd}. Received ${sourceStart}`);
+ }
+ sourceStart = sourceStart ?? 0;
+ if (targetStart !== undefined && targetStart < 0) {
+ throw new RangeError(`The value of "targetStart" is out of range. It must be >= 0. Received ${targetStart}`);
+ }
+ targetStart = targetStart ?? 0;
+ const srcSlice = source.subarray(sourceStart, sourceEnd);
+ const maxLen = Math.min(srcSlice.length, target.length - targetStart);
+ if (maxLen <= 0) {
+ return 0;
+ }
+ target.set(srcSlice.subarray(0, maxLen), targetStart);
+ return maxLen;
+ },
+ equals(uint8Array, otherUint8Array) {
+ if (uint8Array.byteLength !== otherUint8Array.byteLength) {
+ return false;
+ }
+ for (let i = 0; i < uint8Array.byteLength; i++) {
+ if (uint8Array[i] !== otherUint8Array[i]) {
+ return false;
+ }
+ }
+ return true;
+ },
+ fromNumberArray(array) {
+ return Uint8Array.from(array);
+ },
+ fromBase64(base64) {
+ return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
+ },
+ fromUTF8(utf8) {
+ return new TextEncoder().encode(utf8);
+ },
+ toBase64(uint8array) {
+ return btoa(webByteUtils.toISO88591(uint8array));
+ },
+ fromISO88591(codePoints) {
+ return Uint8Array.from(codePoints, c => c.charCodeAt(0) & 0xff);
+ },
+ toISO88591(uint8array) {
+ return Array.from(Uint16Array.from(uint8array), b => String.fromCharCode(b)).join('');
+ },
+ fromHex(hex) {
+ const evenLengthHex = hex.length % 2 === 0 ? hex : hex.slice(0, hex.length - 1);
+ const buffer = [];
+ for (let i = 0; i < evenLengthHex.length; i += 2) {
+ const firstDigit = evenLengthHex[i];
+ const secondDigit = evenLengthHex[i + 1];
+ if (!HEX_DIGIT.test(firstDigit)) {
+ break;
+ }
+ if (!HEX_DIGIT.test(secondDigit)) {
+ break;
+ }
+ const hexDigit = Number.parseInt(`${firstDigit}${secondDigit}`, 16);
+ buffer.push(hexDigit);
+ }
+ return Uint8Array.from(buffer);
+ },
+ toHex(uint8array) {
+ return Array.from(uint8array, byte => byte.toString(16).padStart(2, '0')).join('');
+ },
+ toUTF8(uint8array, start, end, fatal) {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(uint8array, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+ return parseUtf8(uint8array, start, end, fatal);
+ },
+ utf8ByteLength(input) {
+ return new TextEncoder().encode(input).byteLength;
+ },
+ encodeUTF8Into(uint8array, source, byteOffset) {
+ const bytes = new TextEncoder().encode(source);
+ uint8array.set(bytes, byteOffset);
+ return bytes.byteLength;
+ },
+ randomBytes: webRandomBytes,
+ swap32(buffer) {
+ if (buffer.length % 4 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 32-bits');
+ }
+ for (let i = 0; i < buffer.length; i += 4) {
+ const byte0 = buffer[i];
+ const byte1 = buffer[i + 1];
+ const byte2 = buffer[i + 2];
+ const byte3 = buffer[i + 3];
+ buffer[i] = byte3;
+ buffer[i + 1] = byte2;
+ buffer[i + 2] = byte1;
+ buffer[i + 3] = byte0;
+ }
+ return buffer;
+ }
+};
+
+const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true;
+const ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
+
+const bsonType = Symbol.for('@@mdb.bson.type');
+class BSONValue {
+ get [bsonType]() {
+ return this._bsontype;
+ }
+ get [BSON_VERSION_SYMBOL]() {
+ return BSON_MAJOR_VERSION;
+ }
+ [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {
+ return this.inspect(depth, options, inspect);
+ }
+}
+
+const FLOAT = new Float64Array(1);
+const FLOAT_BYTES = new Uint8Array(FLOAT.buffer, 0, 8);
+FLOAT[0] = -1;
+const isBigEndian = FLOAT_BYTES[7] === 0;
+const NumberUtils = {
+ isBigEndian,
+ getNonnegativeInt32LE(source, offset) {
+ if (source[offset + 3] > 127) {
+ throw new RangeError(`Size cannot be negative at offset: ${offset}`);
+ }
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getInt32LE(source, offset) {
+ return (source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24));
+ },
+ getUint32LE(source, offset) {
+ return (source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ },
+ getUint32BE(source, offset) {
+ return (source[offset + 3] +
+ source[offset + 2] * 256 +
+ source[offset + 1] * 65536 +
+ source[offset] * 16777216);
+ },
+ getBigInt64LE(source, offset) {
+ const hi = BigInt(source[offset + 4] +
+ source[offset + 5] * 256 +
+ source[offset + 6] * 65536 +
+ (source[offset + 7] << 24));
+ const lo = BigInt(source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216);
+ return (hi << 32n) + lo;
+ },
+ getFloat64LE: isBigEndian
+ ? (source, offset) => {
+ FLOAT_BYTES[7] = source[offset];
+ FLOAT_BYTES[6] = source[offset + 1];
+ FLOAT_BYTES[5] = source[offset + 2];
+ FLOAT_BYTES[4] = source[offset + 3];
+ FLOAT_BYTES[3] = source[offset + 4];
+ FLOAT_BYTES[2] = source[offset + 5];
+ FLOAT_BYTES[1] = source[offset + 6];
+ FLOAT_BYTES[0] = source[offset + 7];
+ return FLOAT[0];
+ }
+ : (source, offset) => {
+ FLOAT_BYTES[0] = source[offset];
+ FLOAT_BYTES[1] = source[offset + 1];
+ FLOAT_BYTES[2] = source[offset + 2];
+ FLOAT_BYTES[3] = source[offset + 3];
+ FLOAT_BYTES[4] = source[offset + 4];
+ FLOAT_BYTES[5] = source[offset + 5];
+ FLOAT_BYTES[6] = source[offset + 6];
+ FLOAT_BYTES[7] = source[offset + 7];
+ return FLOAT[0];
+ },
+ setInt32BE(destination, offset, value) {
+ destination[offset + 3] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset] = value;
+ return 4;
+ },
+ setInt32LE(destination, offset, value) {
+ destination[offset] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 3] = value;
+ return 4;
+ },
+ setBigInt64LE(destination, offset, value) {
+ const mask32bits = 0xffffffffn;
+ let lo = Number(value & mask32bits);
+ destination[offset] = lo;
+ lo >>= 8;
+ destination[offset + 1] = lo;
+ lo >>= 8;
+ destination[offset + 2] = lo;
+ lo >>= 8;
+ destination[offset + 3] = lo;
+ let hi = Number((value >> 32n) & mask32bits);
+ destination[offset + 4] = hi;
+ hi >>= 8;
+ destination[offset + 5] = hi;
+ hi >>= 8;
+ destination[offset + 6] = hi;
+ hi >>= 8;
+ destination[offset + 7] = hi;
+ return 8;
+ },
+ setFloat64LE: isBigEndian
+ ? (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[7];
+ destination[offset + 1] = FLOAT_BYTES[6];
+ destination[offset + 2] = FLOAT_BYTES[5];
+ destination[offset + 3] = FLOAT_BYTES[4];
+ destination[offset + 4] = FLOAT_BYTES[3];
+ destination[offset + 5] = FLOAT_BYTES[2];
+ destination[offset + 6] = FLOAT_BYTES[1];
+ destination[offset + 7] = FLOAT_BYTES[0];
+ return 8;
+ }
+ : (destination, offset, value) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[0];
+ destination[offset + 1] = FLOAT_BYTES[1];
+ destination[offset + 2] = FLOAT_BYTES[2];
+ destination[offset + 3] = FLOAT_BYTES[3];
+ destination[offset + 4] = FLOAT_BYTES[4];
+ destination[offset + 5] = FLOAT_BYTES[5];
+ destination[offset + 6] = FLOAT_BYTES[6];
+ destination[offset + 7] = FLOAT_BYTES[7];
+ return 8;
+ }
+};
+
+class Binary extends BSONValue {
+ get _bsontype() {
+ return 'Binary';
+ }
+ static BSON_BINARY_SUBTYPE_DEFAULT = 0;
+ static BUFFER_SIZE = 256;
+ static SUBTYPE_DEFAULT = 0;
+ static SUBTYPE_FUNCTION = 1;
+ static SUBTYPE_BYTE_ARRAY = 2;
+ static SUBTYPE_UUID_OLD = 3;
+ static SUBTYPE_UUID = 4;
+ static SUBTYPE_MD5 = 5;
+ static SUBTYPE_ENCRYPTED = 6;
+ static SUBTYPE_COLUMN = 7;
+ static SUBTYPE_SENSITIVE = 8;
+ static SUBTYPE_VECTOR = 9;
+ static SUBTYPE_USER_DEFINED = 128;
+ static VECTOR_TYPE = Object.freeze({
+ Int8: 0x03,
+ Float32: 0x27,
+ PackedBit: 0x10
+ });
+ buffer;
+ sub_type;
+ position;
+ constructor(buffer, subType) {
+ super();
+ if (!(buffer == null) &&
+ typeof buffer === 'string' &&
+ !ArrayBuffer.isView(buffer) &&
+ !isAnyArrayBuffer(buffer) &&
+ !Array.isArray(buffer)) {
+ throw new BSONError('Binary can only be constructed from Uint8Array or number[]');
+ }
+ this.sub_type = subType ?? Binary.BSON_BINARY_SUBTYPE_DEFAULT;
+ if (buffer == null) {
+ this.buffer = ByteUtils.allocate(Binary.BUFFER_SIZE);
+ this.position = 0;
+ }
+ else {
+ this.buffer = Array.isArray(buffer)
+ ? ByteUtils.fromNumberArray(buffer)
+ : ByteUtils.toLocalBufferType(buffer);
+ this.position = this.buffer.byteLength;
+ }
+ }
+ put(byteValue) {
+ if (typeof byteValue === 'string' && byteValue.length !== 1) {
+ throw new BSONError('only accepts single character String');
+ }
+ else if (typeof byteValue !== 'number' && byteValue.length !== 1)
+ throw new BSONError('only accepts single character Uint8Array or Array');
+ let decodedByte;
+ if (typeof byteValue === 'string') {
+ decodedByte = byteValue.charCodeAt(0);
+ }
+ else if (typeof byteValue === 'number') {
+ decodedByte = byteValue;
+ }
+ else {
+ decodedByte = byteValue[0];
+ }
+ if (decodedByte < 0 || decodedByte > 255) {
+ throw new BSONError('only accepts number in a valid unsigned byte range 0-255');
+ }
+ if (this.buffer.byteLength > this.position) {
+ this.buffer[this.position++] = decodedByte;
+ }
+ else {
+ const newSpace = ByteUtils.allocate(Binary.BUFFER_SIZE + this.buffer.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ this.buffer[this.position++] = decodedByte;
+ }
+ }
+ write(sequence, offset) {
+ offset = typeof offset === 'number' ? offset : this.position;
+ if (this.buffer.byteLength < offset + sequence.length) {
+ const newSpace = ByteUtils.allocate(this.buffer.byteLength + sequence.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ }
+ if (ArrayBuffer.isView(sequence)) {
+ this.buffer.set(ByteUtils.toLocalBufferType(sequence), offset);
+ this.position =
+ offset + sequence.byteLength > this.position ? offset + sequence.length : this.position;
+ }
+ else if (typeof sequence === 'string') {
+ throw new BSONError('input cannot be string');
+ }
+ }
+ read(position, length) {
+ length = length && length > 0 ? length : this.position;
+ const end = position + length;
+ return this.buffer.subarray(position, end > this.position ? this.position : end);
+ }
+ value() {
+ return this.buffer.length === this.position
+ ? this.buffer
+ : this.buffer.subarray(0, this.position);
+ }
+ length() {
+ return this.position;
+ }
+ toJSON() {
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.buffer.subarray(0, this.position));
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ if (encoding === 'utf8' || encoding === 'utf-8')
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (this.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(this);
+ }
+ const base64String = ByteUtils.toBase64(this.buffer);
+ const subType = Number(this.sub_type).toString(16);
+ if (options.legacy) {
+ return {
+ $binary: base64String,
+ $type: subType.length === 1 ? '0' + subType : subType
+ };
+ }
+ return {
+ $binary: {
+ base64: base64String,
+ subType: subType.length === 1 ? '0' + subType : subType
+ }
+ };
+ }
+ toUUID() {
+ if (this.sub_type === Binary.SUBTYPE_UUID) {
+ return new UUID(this.buffer.subarray(0, this.position));
+ }
+ throw new BSONError(`Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${Binary.SUBTYPE_UUID}" is currently supported.`);
+ }
+ static createFromHexString(hex, subType) {
+ return new Binary(ByteUtils.fromHex(hex), subType);
+ }
+ static createFromBase64(base64, subType) {
+ return new Binary(ByteUtils.fromBase64(base64), subType);
+ }
+ static fromExtendedJSON(doc, options) {
+ options = options || {};
+ let data;
+ let type;
+ if ('$binary' in doc) {
+ if (options.legacy && typeof doc.$binary === 'string' && '$type' in doc) {
+ type = doc.$type ? parseInt(doc.$type, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary);
+ }
+ else {
+ if (typeof doc.$binary !== 'string') {
+ type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary.base64);
+ }
+ }
+ }
+ else if ('$uuid' in doc) {
+ type = 4;
+ data = UUID.bytesFromString(doc.$uuid);
+ }
+ if (!data) {
+ throw new BSONError(`Unexpected Binary Extended JSON format ${JSON.stringify(doc)}`);
+ }
+ return type === BSON_BINARY_SUBTYPE_UUID_NEW ? new UUID(data) : new Binary(data, type);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const base64 = ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ const base64Arg = inspect(base64, options);
+ const subTypeArg = inspect(this.sub_type, options);
+ return `Binary.createFromBase64(${base64Arg}, ${subTypeArg})`;
+ }
+ toInt8Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Int8) {
+ throw new BSONError('Binary datatype field is not Int8');
+ }
+ validateBinaryVector(this);
+ return new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toFloat32Array() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Float32) {
+ throw new BSONError('Binary datatype field is not Float32');
+ }
+ validateBinaryVector(this);
+ const floatBytes = new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(floatBytes);
+ return new Float32Array(floatBytes.buffer);
+ }
+ toPackedBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ return new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
+ }
+ toBits() {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+ validateBinaryVector(this);
+ const byteCount = this.length() - 2;
+ const bitCount = byteCount * 8 - this.buffer[1];
+ const bits = new Int8Array(bitCount);
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = (bitOffset / 8) | 0;
+ const byte = this.buffer[byteOffset + 2];
+ const shift = 7 - (bitOffset % 8);
+ const bit = (byte >> shift) & 1;
+ bits[bitOffset] = bit;
+ }
+ return bits;
+ }
+ static fromInt8Array(array) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.Int8;
+ buffer[1] = 0;
+ const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ buffer.set(intBytes, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromFloat32Array(array) {
+ const binaryBytes = ByteUtils.allocate(array.byteLength + 2);
+ binaryBytes[0] = Binary.VECTOR_TYPE.Float32;
+ binaryBytes[1] = 0;
+ const floatBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ binaryBytes.set(floatBytes, 2);
+ if (NumberUtils.isBigEndian)
+ ByteUtils.swap32(new Uint8Array(binaryBytes.buffer, 2));
+ const bin = new this(binaryBytes, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromPackedBits(array, padding = 0) {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.PackedBit;
+ buffer[1] = padding;
+ buffer.set(array, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+ static fromBits(bits) {
+ const byteLength = (bits.length + 7) >>> 3;
+ const bytes = new Uint8Array(byteLength + 2);
+ bytes[0] = Binary.VECTOR_TYPE.PackedBit;
+ const remainder = bits.length % 8;
+ bytes[1] = remainder === 0 ? 0 : 8 - remainder;
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = bitOffset >>> 3;
+ const bit = bits[bitOffset];
+ if (bit !== 0 && bit !== 1) {
+ throw new BSONError(`Invalid bit value at ${bitOffset}: must be 0 or 1, found ${bits[bitOffset]}`);
+ }
+ if (bit === 0)
+ continue;
+ const shift = 7 - (bitOffset % 8);
+ bytes[byteOffset + 2] |= bit << shift;
+ }
+ return new this(bytes, Binary.SUBTYPE_VECTOR);
+ }
+}
+function validateBinaryVector(vector) {
+ if (vector.sub_type !== Binary.SUBTYPE_VECTOR)
+ return;
+ const size = vector.position;
+ const datatype = vector.buffer[0];
+ const padding = vector.buffer[1];
+ if ((datatype === Binary.VECTOR_TYPE.Float32 || datatype === Binary.VECTOR_TYPE.Int8) &&
+ padding !== 0) {
+ throw new BSONError('Invalid Vector: padding must be zero for int8 and float32 vectors');
+ }
+ if (datatype === Binary.VECTOR_TYPE.Float32) {
+ if (size !== 0 && size - 2 !== 0 && (size - 2) % 4 !== 0) {
+ throw new BSONError('Invalid Vector: Float32 vector must contain a multiple of 4 bytes');
+ }
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding !== 0 && size === 2) {
+ throw new BSONError('Invalid Vector: padding must be zero for packed bit vectors that are empty');
+ }
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding > 7) {
+ throw new BSONError(`Invalid Vector: padding must be a value between 0 and 7. found: ${padding}`);
+ }
+}
+const UUID_BYTE_LENGTH = 16;
+const UUID_WITHOUT_DASHES = /^[0-9A-F]{32}$/i;
+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;
+class UUID extends Binary {
+ constructor(input) {
+ let bytes;
+ if (input == null) {
+ bytes = UUID.generate();
+ }
+ else if (input instanceof UUID) {
+ bytes = ByteUtils.toLocalBufferType(new Uint8Array(input.buffer));
+ }
+ else if (ArrayBuffer.isView(input) && input.byteLength === UUID_BYTE_LENGTH) {
+ bytes = ByteUtils.toLocalBufferType(input);
+ }
+ else if (typeof input === 'string') {
+ bytes = UUID.bytesFromString(input);
+ }
+ else {
+ 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).');
+ }
+ super(bytes, BSON_BINARY_SUBTYPE_UUID_NEW);
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ }
+ toHexString(includeDashes = true) {
+ if (includeDashes) {
+ return [
+ ByteUtils.toHex(this.buffer.subarray(0, 4)),
+ ByteUtils.toHex(this.buffer.subarray(4, 6)),
+ ByteUtils.toHex(this.buffer.subarray(6, 8)),
+ ByteUtils.toHex(this.buffer.subarray(8, 10)),
+ ByteUtils.toHex(this.buffer.subarray(10, 16))
+ ].join('-');
+ }
+ return ByteUtils.toHex(this.buffer);
+ }
+ toString(encoding) {
+ if (encoding === 'hex')
+ return ByteUtils.toHex(this.id);
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ equals(otherId) {
+ if (!otherId) {
+ return false;
+ }
+ if (otherId instanceof UUID) {
+ return ByteUtils.equals(otherId.id, this.id);
+ }
+ try {
+ return ByteUtils.equals(new UUID(otherId).id, this.id);
+ }
+ catch {
+ return false;
+ }
+ }
+ toBinary() {
+ return new Binary(this.id, Binary.SUBTYPE_UUID);
+ }
+ static generate() {
+ const bytes = ByteUtils.randomBytes(UUID_BYTE_LENGTH);
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
+ return bytes;
+ }
+ static isValid(input) {
+ if (!input) {
+ return false;
+ }
+ if (typeof input === 'string') {
+ return UUID.isValidUUIDString(input);
+ }
+ if (isUint8Array(input)) {
+ return input.byteLength === UUID_BYTE_LENGTH;
+ }
+ return (input._bsontype === 'Binary' &&
+ input.sub_type === this.SUBTYPE_UUID &&
+ input.buffer.byteLength === 16);
+ }
+ static createFromHexString(hexString) {
+ const buffer = UUID.bytesFromString(hexString);
+ return new UUID(buffer);
+ }
+ static createFromBase64(base64) {
+ return new UUID(ByteUtils.fromBase64(base64));
+ }
+ static bytesFromString(representation) {
+ if (!UUID.isValidUUIDString(representation)) {
+ throw new BSONError('UUID string representation must be 32 hex digits or canonical hyphenated representation');
+ }
+ return ByteUtils.fromHex(representation.replace(/-/g, ''));
+ }
+ static isValidUUIDString(representation) {
+ return UUID_WITHOUT_DASHES.test(representation) || UUID_WITH_DASHES.test(representation);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new UUID(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+class Code extends BSONValue {
+ get _bsontype() {
+ return 'Code';
+ }
+ code;
+ scope;
+ constructor(code, scope) {
+ super();
+ this.code = code.toString();
+ this.scope = scope ?? null;
+ }
+ toJSON() {
+ if (this.scope != null) {
+ return { code: this.code, scope: this.scope };
+ }
+ return { code: this.code };
+ }
+ toExtendedJSON() {
+ if (this.scope) {
+ return { $code: this.code, $scope: this.scope };
+ }
+ return { $code: this.code };
+ }
+ static fromExtendedJSON(doc) {
+ return new Code(doc.$code, doc.$scope);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ let parametersString = inspect(this.code, options);
+ const multiLineFn = parametersString.includes('\n');
+ if (this.scope != null) {
+ parametersString += `,${multiLineFn ? '\n' : ' '}${inspect(this.scope, options)}`;
+ }
+ const endingNewline = multiLineFn && this.scope === null;
+ return `new Code(${multiLineFn ? '\n' : ''}${parametersString}${endingNewline ? '\n' : ''})`;
+ }
+}
+
+function isDBRefLike(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '$id' in value &&
+ value.$id != null &&
+ '$ref' in value &&
+ typeof value.$ref === 'string' &&
+ (!('$db' in value) || ('$db' in value && typeof value.$db === 'string')));
+}
+class DBRef extends BSONValue {
+ get _bsontype() {
+ return 'DBRef';
+ }
+ collection;
+ oid;
+ db;
+ fields;
+ constructor(collection, oid, db, fields) {
+ super();
+ const parts = collection.split('.');
+ if (parts.length === 2) {
+ db = parts.shift();
+ collection = parts.shift();
+ }
+ this.collection = collection;
+ this.oid = oid;
+ this.db = db;
+ this.fields = fields || {};
+ }
+ get namespace() {
+ return this.collection;
+ }
+ set namespace(value) {
+ this.collection = value;
+ }
+ toJSON() {
+ const o = Object.assign({
+ $ref: this.collection,
+ $id: this.oid
+ }, this.fields);
+ if (this.db != null)
+ o.$db = this.db;
+ return o;
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ let o = {
+ $ref: this.collection,
+ $id: this.oid
+ };
+ if (options.legacy) {
+ return o;
+ }
+ if (this.db)
+ o.$db = this.db;
+ o = Object.assign(o, this.fields);
+ return o;
+ }
+ static fromExtendedJSON(doc) {
+ const copy = Object.assign({}, doc);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(doc.$ref, doc.$id, doc.$db, copy);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const args = [
+ inspect(this.namespace, options),
+ inspect(this.oid, options),
+ ...(this.db ? [inspect(this.db, options)] : []),
+ ...(Object.keys(this.fields).length > 0 ? [inspect(this.fields, options)] : [])
+ ];
+ args[1] = inspect === defaultInspect ? `new ObjectId(${args[1]})` : args[1];
+ return `new DBRef(${args.join(', ')})`;
+ }
+}
+
+function removeLeadingZerosAndExplicitPlus(str) {
+ if (str === '') {
+ return str;
+ }
+ let startIndex = 0;
+ const isNegative = str[startIndex] === '-';
+ const isExplicitlyPositive = str[startIndex] === '+';
+ if (isExplicitlyPositive || isNegative) {
+ startIndex += 1;
+ }
+ let foundInsignificantZero = false;
+ for (; startIndex < str.length && str[startIndex] === '0'; ++startIndex) {
+ foundInsignificantZero = true;
+ }
+ if (!foundInsignificantZero) {
+ return isExplicitlyPositive ? str.slice(1) : str;
+ }
+ return `${isNegative ? '-' : ''}${str.length === startIndex ? '0' : str.slice(startIndex)}`;
+}
+function validateStringCharacters(str, radix) {
+ radix = radix ?? 10;
+ const validCharacters = '0123456789abcdefghijklmnopqrstuvwxyz'.slice(0, radix);
+ const regex = new RegExp(`[^-+${validCharacters}]`, 'i');
+ return regex.test(str) ? false : str;
+}
+
+let wasm = undefined;
+try {
+ 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;
+}
+catch {
+}
+const TWO_PWR_16_DBL = 1 << 16;
+const TWO_PWR_24_DBL = 1 << 24;
+const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+const TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+const TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+const INT_CACHE = {};
+const UINT_CACHE = {};
+const MAX_INT64_STRING_LENGTH = 20;
+const DECIMAL_REG_EX = /^(\+?0|(\+|-)?[1-9][0-9]*)$/;
+class Long extends BSONValue {
+ get _bsontype() {
+ return 'Long';
+ }
+ get __isLong__() {
+ return true;
+ }
+ high;
+ low;
+ unsigned;
+ constructor(lowOrValue = 0, highOrUnsigned, unsigned) {
+ super();
+ const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
+ const high = typeof highOrUnsigned === 'number' ? highOrUnsigned : 0;
+ const res = typeof lowOrValue === 'string'
+ ? Long.fromString(lowOrValue, unsignedBool)
+ : typeof lowOrValue === 'bigint'
+ ? Long.fromBigInt(lowOrValue, unsignedBool)
+ : { low: lowOrValue | 0, high: high | 0, unsigned: unsignedBool };
+ this.low = res.low;
+ this.high = res.high;
+ this.unsigned = res.unsigned;
+ }
+ static TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
+ static MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true);
+ static ZERO = Long.fromInt(0);
+ static UZERO = Long.fromInt(0, true);
+ static ONE = Long.fromInt(1);
+ static UONE = Long.fromInt(1, true);
+ static NEG_ONE = Long.fromInt(-1);
+ static MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
+ static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false);
+ static fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+ }
+ static fromInt(value, unsigned) {
+ let obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if ((cache = 0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, (value | 0) < 0 ? -1 : 0, true);
+ if (cache)
+ UINT_CACHE[value] = obj;
+ return obj;
+ }
+ else {
+ value |= 0;
+ if ((cache = -128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj)
+ return cachedObj;
+ }
+ obj = Long.fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache)
+ INT_CACHE[value] = obj;
+ return obj;
+ }
+ }
+ static fromNumber(value, unsigned) {
+ if (isNaN(value))
+ return unsigned ? Long.UZERO : Long.ZERO;
+ if (unsigned) {
+ if (value < 0)
+ return Long.UZERO;
+ if (value >= TWO_PWR_64_DBL)
+ return Long.MAX_UNSIGNED_VALUE;
+ }
+ else {
+ if (value <= -TWO_PWR_63_DBL)
+ return Long.MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL)
+ return Long.MAX_VALUE;
+ }
+ if (value < 0)
+ return Long.fromNumber(-value, unsigned).neg();
+ return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
+ }
+ static fromBigInt(value, unsigned) {
+ const FROM_BIGINT_BIT_MASK = 0xffffffffn;
+ const FROM_BIGINT_BIT_SHIFT = 32n;
+ return new Long(Number(value & FROM_BIGINT_BIT_MASK), Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK), unsigned);
+ }
+ static _fromString(str, unsigned, radix) {
+ if (str.length === 0)
+ throw new BSONError('empty string');
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ let p;
+ if ((p = str.indexOf('-')) > 0)
+ throw new BSONError('interior hyphen');
+ else if (p === 0) {
+ return Long._fromString(str.substring(1), unsigned, radix).neg();
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 8));
+ let result = Long.ZERO;
+ for (let i = 0; i < str.length; i += 8) {
+ const size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ const power = Long.fromNumber(Math.pow(radix, size));
+ result = result.mul(power).add(Long.fromNumber(value));
+ }
+ else {
+ result = result.mul(radixToPower);
+ result = result.add(Long.fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+ }
+ static fromStringStrict(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str.trim() !== str) {
+ throw new BSONError(`Input: '${str}' contains leading and/or trailing whitespace`);
+ }
+ if (!validateStringCharacters(str, radix)) {
+ throw new BSONError(`Input: '${str}' contains invalid characters for radix: ${radix}`);
+ }
+ const cleanedStr = removeLeadingZerosAndExplicitPlus(str);
+ const result = Long._fromString(cleanedStr, unsigned, radix);
+ if (result.toString(radix).toLowerCase() !== cleanedStr.toLowerCase()) {
+ throw new BSONError(`Input: ${str} is not representable as ${result.unsigned ? 'an unsigned' : 'a signed'} 64-bit Long ${radix != null ? `with radix: ${radix}` : ''}`);
+ }
+ return result;
+ }
+ static fromString(str, unsignedOrRadix, radix) {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ }
+ else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str === 'NaN' && radix < 24) {
+ return Long.ZERO;
+ }
+ else if ((str === 'Infinity' || str === '+Infinity' || str === '-Infinity') && radix < 35) {
+ return Long.ZERO;
+ }
+ return Long._fromString(str, unsigned, radix);
+ }
+ static fromBytes(bytes, unsigned, le) {
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
+ }
+ static fromBytesLE(bytes, unsigned) {
+ 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);
+ }
+ static fromBytesBE(bytes, unsigned) {
+ 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);
+ }
+ static isLong(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '__isLong__' in value &&
+ value.__isLong__ === true);
+ }
+ static fromValue(val, unsigned) {
+ if (typeof val === 'number')
+ return Long.fromNumber(val, unsigned);
+ if (typeof val === 'string')
+ return Long.fromString(val, unsigned);
+ return Long.fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
+ }
+ add(addend) {
+ if (!Long.isLong(addend))
+ addend = Long.fromValue(addend);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = addend.high >>> 16;
+ const b32 = addend.high & 0xffff;
+ const b16 = addend.low >>> 16;
+ const b00 = addend.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 + b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ and(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+ }
+ compare(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.eq(other))
+ return 0;
+ const thisNeg = this.isNegative(), otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg)
+ return -1;
+ if (!thisNeg && otherNeg)
+ return 1;
+ if (!this.unsigned)
+ return this.sub(other).isNegative() ? -1 : 1;
+ return other.high >>> 0 > this.high >>> 0 ||
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
+ ? -1
+ : 1;
+ }
+ comp(other) {
+ return this.compare(other);
+ }
+ divide(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (divisor.isZero())
+ throw new BSONError('division by zero');
+ if (wasm) {
+ if (!this.unsigned &&
+ this.high === -0x80000000 &&
+ divisor.low === -1 &&
+ divisor.high === -1) {
+ return this;
+ }
+ const low = (this.unsigned ? wasm.div_u : wasm.div_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (this.isZero())
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ let approx, rem, res;
+ if (!this.unsigned) {
+ if (this.eq(Long.MIN_VALUE)) {
+ if (divisor.eq(Long.ONE) || divisor.eq(Long.NEG_ONE))
+ return Long.MIN_VALUE;
+ else if (divisor.eq(Long.MIN_VALUE))
+ return Long.ONE;
+ else {
+ const halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(Long.ZERO)) {
+ return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
+ }
+ else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ }
+ else if (divisor.eq(Long.MIN_VALUE))
+ return this.unsigned ? Long.UZERO : Long.ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative())
+ return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ }
+ else if (divisor.isNegative())
+ return this.div(divisor.neg()).neg();
+ res = Long.ZERO;
+ }
+ else {
+ if (!divisor.unsigned)
+ divisor = divisor.toUnsigned();
+ if (divisor.gt(this))
+ return Long.UZERO;
+ if (divisor.gt(this.shru(1)))
+ return Long.UONE;
+ res = Long.UZERO;
+ }
+ rem = this;
+ while (rem.gte(divisor)) {
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+ const log2 = Math.ceil(Math.log(approx) / Math.LN2);
+ const delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);
+ let approxRes = Long.fromNumber(approx);
+ let approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = Long.fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+ if (approxRes.isZero())
+ approxRes = Long.ONE;
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+ }
+ div(divisor) {
+ return this.divide(divisor);
+ }
+ equals(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
+ return false;
+ return this.high === other.high && this.low === other.low;
+ }
+ eq(other) {
+ return this.equals(other);
+ }
+ getHighBits() {
+ return this.high;
+ }
+ getHighBitsUnsigned() {
+ return this.high >>> 0;
+ }
+ getLowBits() {
+ return this.low;
+ }
+ getLowBitsUnsigned() {
+ return this.low >>> 0;
+ }
+ getNumBitsAbs() {
+ if (this.isNegative()) {
+ return this.eq(Long.MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ }
+ const val = this.high !== 0 ? this.high : this.low;
+ let bit;
+ for (bit = 31; bit > 0; bit--)
+ if ((val & (1 << bit)) !== 0)
+ break;
+ return this.high !== 0 ? bit + 33 : bit + 1;
+ }
+ greaterThan(other) {
+ return this.comp(other) > 0;
+ }
+ gt(other) {
+ return this.greaterThan(other);
+ }
+ greaterThanOrEqual(other) {
+ return this.comp(other) >= 0;
+ }
+ gte(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ ge(other) {
+ return this.greaterThanOrEqual(other);
+ }
+ isEven() {
+ return (this.low & 1) === 0;
+ }
+ isNegative() {
+ return !this.unsigned && this.high < 0;
+ }
+ isOdd() {
+ return (this.low & 1) === 1;
+ }
+ isPositive() {
+ return this.unsigned || this.high >= 0;
+ }
+ isZero() {
+ return this.high === 0 && this.low === 0;
+ }
+ lessThan(other) {
+ return this.comp(other) < 0;
+ }
+ lt(other) {
+ return this.lessThan(other);
+ }
+ lessThanOrEqual(other) {
+ return this.comp(other) <= 0;
+ }
+ lte(other) {
+ return this.lessThanOrEqual(other);
+ }
+ modulo(divisor) {
+ if (!Long.isLong(divisor))
+ divisor = Long.fromValue(divisor);
+ if (wasm) {
+ const low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(this.low, this.high, divisor.low, divisor.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ return this.sub(this.div(divisor).mul(divisor));
+ }
+ mod(divisor) {
+ return this.modulo(divisor);
+ }
+ rem(divisor) {
+ return this.modulo(divisor);
+ }
+ multiply(multiplier) {
+ if (this.isZero())
+ return Long.ZERO;
+ if (!Long.isLong(multiplier))
+ multiplier = Long.fromValue(multiplier);
+ if (wasm) {
+ const low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+ if (multiplier.isZero())
+ return Long.ZERO;
+ if (this.eq(Long.MIN_VALUE))
+ return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (multiplier.eq(Long.MIN_VALUE))
+ return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (this.isNegative()) {
+ if (multiplier.isNegative())
+ return this.neg().mul(multiplier.neg());
+ else
+ return this.neg().mul(multiplier).neg();
+ }
+ else if (multiplier.isNegative())
+ return this.mul(multiplier.neg()).neg();
+ if (this.lt(Long.TWO_PWR_24) && multiplier.lt(Long.TWO_PWR_24))
+ return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+ const b48 = multiplier.high >>> 16;
+ const b32 = multiplier.high & 0xffff;
+ const b16 = multiplier.low >>> 16;
+ const b00 = multiplier.low & 0xffff;
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+ mul(multiplier) {
+ return this.multiply(multiplier);
+ }
+ negate() {
+ if (!this.unsigned && this.eq(Long.MIN_VALUE))
+ return Long.MIN_VALUE;
+ return this.not().add(Long.ONE);
+ }
+ neg() {
+ return this.negate();
+ }
+ not() {
+ return Long.fromBits(~this.low, ~this.high, this.unsigned);
+ }
+ notEquals(other) {
+ return !this.equals(other);
+ }
+ neq(other) {
+ return this.notEquals(other);
+ }
+ ne(other) {
+ return this.notEquals(other);
+ }
+ or(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+ }
+ shiftLeft(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
+ else
+ return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
+ }
+ shl(numBits) {
+ return this.shiftLeft(numBits);
+ }
+ shiftRight(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ if ((numBits &= 63) === 0)
+ return this;
+ else if (numBits < 32)
+ return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
+ else
+ return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
+ }
+ shr(numBits) {
+ return this.shiftRight(numBits);
+ }
+ shiftRightUnsigned(numBits) {
+ if (Long.isLong(numBits))
+ numBits = numBits.toInt();
+ numBits &= 63;
+ if (numBits === 0)
+ return this;
+ else {
+ const high = this.high;
+ if (numBits < 32) {
+ const low = this.low;
+ return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
+ }
+ else if (numBits === 32)
+ return Long.fromBits(high, 0, this.unsigned);
+ else
+ return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
+ }
+ }
+ shr_u(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ shru(numBits) {
+ return this.shiftRightUnsigned(numBits);
+ }
+ subtract(subtrahend) {
+ if (!Long.isLong(subtrahend))
+ subtrahend = Long.fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+ }
+ sub(subtrahend) {
+ return this.subtract(subtrahend);
+ }
+ toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+ }
+ toNumber() {
+ if (this.unsigned)
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+ }
+ toBigInt() {
+ return BigInt(this.toString());
+ }
+ toBytes(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+ }
+ toBytesLE() {
+ const hi = this.high, lo = this.low;
+ return [
+ lo & 0xff,
+ (lo >>> 8) & 0xff,
+ (lo >>> 16) & 0xff,
+ lo >>> 24,
+ hi & 0xff,
+ (hi >>> 8) & 0xff,
+ (hi >>> 16) & 0xff,
+ hi >>> 24
+ ];
+ }
+ toBytesBE() {
+ const hi = this.high, lo = this.low;
+ return [
+ hi >>> 24,
+ (hi >>> 16) & 0xff,
+ (hi >>> 8) & 0xff,
+ hi & 0xff,
+ lo >>> 24,
+ (lo >>> 16) & 0xff,
+ (lo >>> 8) & 0xff,
+ lo & 0xff
+ ];
+ }
+ toSigned() {
+ if (!this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, false);
+ }
+ toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix)
+ throw new BSONError('radix');
+ if (this.isZero())
+ return '0';
+ if (this.isNegative()) {
+ if (this.eq(Long.MIN_VALUE)) {
+ const radixLong = Long.fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ }
+ else
+ return '-' + this.neg().toString(radix);
+ }
+ const radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
+ let rem = this;
+ let result = '';
+ while (true) {
+ const remDiv = rem.div(radixToPower);
+ const intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0;
+ let digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero()) {
+ return digits + result;
+ }
+ else {
+ while (digits.length < 6)
+ digits = '0' + digits;
+ result = '' + digits + result;
+ }
+ }
+ }
+ toUnsigned() {
+ if (this.unsigned)
+ return this;
+ return Long.fromBits(this.low, this.high, true);
+ }
+ xor(other) {
+ if (!Long.isLong(other))
+ other = Long.fromValue(other);
+ return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+ }
+ eqz() {
+ return this.isZero();
+ }
+ le(other) {
+ return this.lessThanOrEqual(other);
+ }
+ toExtendedJSON(options) {
+ if (options && options.relaxed)
+ return this.toNumber();
+ return { $numberLong: this.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ const { useBigInt64 = false, relaxed = true } = { ...options };
+ if (doc.$numberLong.length > MAX_INT64_STRING_LENGTH) {
+ throw new BSONError('$numberLong string is too long');
+ }
+ if (!DECIMAL_REG_EX.test(doc.$numberLong)) {
+ throw new BSONError(`$numberLong string "${doc.$numberLong}" is in an invalid format`);
+ }
+ if (useBigInt64) {
+ const bigIntResult = BigInt(doc.$numberLong);
+ return BigInt.asIntN(64, bigIntResult);
+ }
+ const longResult = Long.fromString(doc.$numberLong);
+ if (relaxed) {
+ return longResult.toNumber();
+ }
+ return longResult;
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const longVal = inspect(this.toString(), options);
+ const unsignedVal = this.unsigned ? `, ${inspect(this.unsigned, options)}` : '';
+ return `new Long(${longVal}${unsignedVal})`;
+ }
+}
+
+const PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/;
+const PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i;
+const PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i;
+const EXPONENT_MAX = 6111;
+const EXPONENT_MIN = -6176;
+const EXPONENT_BIAS = 6176;
+const MAX_DIGITS = 34;
+const NAN_BUFFER = ByteUtils.fromNumberArray([
+ 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_NEGATIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const INF_POSITIVE_BUFFER = ByteUtils.fromNumberArray([
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+].reverse());
+const EXPONENT_REGEX = /^([-+])?(\d+)?$/;
+const COMBINATION_MASK = 0x1f;
+const EXPONENT_MASK = 0x3fff;
+const COMBINATION_INFINITY = 30;
+const COMBINATION_NAN = 31;
+function isDigit(value) {
+ return !isNaN(parseInt(value, 10));
+}
+function divideu128(value) {
+ const DIVISOR = Long.fromNumber(1000 * 1000 * 1000);
+ let _rem = Long.fromNumber(0);
+ if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) {
+ return { quotient: value, rem: _rem };
+ }
+ for (let i = 0; i <= 3; i++) {
+ _rem = _rem.shiftLeft(32);
+ _rem = _rem.add(new Long(value.parts[i], 0));
+ value.parts[i] = _rem.div(DIVISOR).low;
+ _rem = _rem.modulo(DIVISOR);
+ }
+ return { quotient: value, rem: _rem };
+}
+function multiply64x2(left, right) {
+ if (!left && !right) {
+ return { high: Long.fromNumber(0), low: Long.fromNumber(0) };
+ }
+ const leftHigh = left.shiftRightUnsigned(32);
+ const leftLow = new Long(left.getLowBits(), 0);
+ const rightHigh = right.shiftRightUnsigned(32);
+ const rightLow = new Long(right.getLowBits(), 0);
+ let productHigh = leftHigh.multiply(rightHigh);
+ let productMid = leftHigh.multiply(rightLow);
+ const productMid2 = leftLow.multiply(rightHigh);
+ let productLow = leftLow.multiply(rightLow);
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productMid = new Long(productMid.getLowBits(), 0)
+ .add(productMid2)
+ .add(productLow.shiftRightUnsigned(32));
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));
+ return { high: productHigh, low: productLow };
+}
+function lessThan(left, right) {
+ const uhleft = left.high >>> 0;
+ const uhright = right.high >>> 0;
+ if (uhleft < uhright) {
+ return true;
+ }
+ else if (uhleft === uhright) {
+ const ulleft = left.low >>> 0;
+ const ulright = right.low >>> 0;
+ if (ulleft < ulright)
+ return true;
+ }
+ return false;
+}
+function invalidErr(string, message) {
+ throw new BSONError(`"${string}" is not a valid Decimal128 string - ${message}`);
+}
+class Decimal128 extends BSONValue {
+ get _bsontype() {
+ return 'Decimal128';
+ }
+ bytes;
+ constructor(bytes) {
+ super();
+ if (typeof bytes === 'string') {
+ this.bytes = Decimal128.fromString(bytes).bytes;
+ }
+ else if (bytes instanceof Uint8Array || isUint8Array(bytes)) {
+ if (bytes.byteLength !== 16) {
+ throw new BSONError('Decimal128 must take a Buffer of 16 bytes');
+ }
+ this.bytes = bytes;
+ }
+ else {
+ throw new BSONError('Decimal128 must take a Buffer or string');
+ }
+ }
+ static fromString(representation) {
+ return Decimal128._fromString(representation, { allowRounding: false });
+ }
+ static fromStringWithRounding(representation) {
+ return Decimal128._fromString(representation, { allowRounding: true });
+ }
+ static _fromString(representation, options) {
+ let isNegative = false;
+ let sawSign = false;
+ let sawRadix = false;
+ let foundNonZero = false;
+ let significantDigits = 0;
+ let nDigitsRead = 0;
+ let nDigits = 0;
+ let radixPosition = 0;
+ let firstNonZero = 0;
+ const digits = [0];
+ let nDigitsStored = 0;
+ let digitsInsert = 0;
+ let lastDigit = 0;
+ let exponent = 0;
+ let significandHigh = new Long(0, 0);
+ let significandLow = new Long(0, 0);
+ let biasedExponent = 0;
+ let index = 0;
+ if (representation.length >= 7000) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ const stringMatch = representation.match(PARSE_STRING_REGEXP);
+ const infMatch = representation.match(PARSE_INF_REGEXP);
+ const nanMatch = representation.match(PARSE_NAN_REGEXP);
+ if ((!stringMatch && !infMatch && !nanMatch) || representation.length === 0) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+ if (stringMatch) {
+ const unsignedNumber = stringMatch[2];
+ const e = stringMatch[4];
+ const expSign = stringMatch[5];
+ const expNumber = stringMatch[6];
+ if (e && expNumber === undefined)
+ invalidErr(representation, 'missing exponent power');
+ if (e && unsignedNumber === undefined)
+ invalidErr(representation, 'missing exponent base');
+ if (e === undefined && (expSign || expNumber)) {
+ invalidErr(representation, 'missing e before exponent');
+ }
+ }
+ if (representation[index] === '+' || representation[index] === '-') {
+ sawSign = true;
+ isNegative = representation[index++] === '-';
+ }
+ if (!isDigit(representation[index]) && representation[index] !== '.') {
+ if (representation[index] === 'i' || representation[index] === 'I') {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ else if (representation[index] === 'N') {
+ return new Decimal128(NAN_BUFFER);
+ }
+ }
+ while (isDigit(representation[index]) || representation[index] === '.') {
+ if (representation[index] === '.') {
+ if (sawRadix)
+ invalidErr(representation, 'contains multiple periods');
+ sawRadix = true;
+ index = index + 1;
+ continue;
+ }
+ if (nDigitsStored < MAX_DIGITS) {
+ if (representation[index] !== '0' || foundNonZero) {
+ if (!foundNonZero) {
+ firstNonZero = nDigitsRead;
+ }
+ foundNonZero = true;
+ digits[digitsInsert++] = parseInt(representation[index], 10);
+ nDigitsStored = nDigitsStored + 1;
+ }
+ }
+ if (foundNonZero)
+ nDigits = nDigits + 1;
+ if (sawRadix)
+ radixPosition = radixPosition + 1;
+ nDigitsRead = nDigitsRead + 1;
+ index = index + 1;
+ }
+ if (sawRadix && !nDigitsRead)
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ if (representation[index] === 'e' || representation[index] === 'E') {
+ const match = representation.substr(++index).match(EXPONENT_REGEX);
+ if (!match || !match[2])
+ return new Decimal128(NAN_BUFFER);
+ exponent = parseInt(match[0], 10);
+ index = index + match[0].length;
+ }
+ if (representation[index])
+ return new Decimal128(NAN_BUFFER);
+ if (!nDigitsStored) {
+ digits[0] = 0;
+ nDigits = 1;
+ nDigitsStored = 1;
+ significantDigits = 0;
+ }
+ else {
+ lastDigit = nDigitsStored - 1;
+ significantDigits = nDigits;
+ if (significantDigits !== 1) {
+ while (representation[firstNonZero + significantDigits - 1 + Number(sawSign) + Number(sawRadix)] === '0') {
+ significantDigits = significantDigits - 1;
+ }
+ }
+ }
+ if (exponent <= radixPosition && radixPosition > exponent + (1 << 14)) {
+ exponent = EXPONENT_MIN;
+ }
+ else {
+ exponent = exponent - radixPosition;
+ }
+ while (exponent > EXPONENT_MAX) {
+ lastDigit = lastDigit + 1;
+ if (lastDigit >= MAX_DIGITS) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ exponent = exponent - 1;
+ }
+ if (options.allowRounding) {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0 && significantDigits < nDigitsStored) {
+ exponent = EXPONENT_MIN;
+ significantDigits = 0;
+ break;
+ }
+ if (nDigitsStored < nDigits) {
+ nDigits = nDigits - 1;
+ }
+ else {
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ const digitsString = digits.join('');
+ if (digitsString.match(/^0+$/)) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ let endOfString = nDigitsRead;
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ let roundBit = 0;
+ if (roundDigit >= 5) {
+ roundBit = 1;
+ if (roundDigit === 5) {
+ roundBit = digits[lastDigit] % 2 === 1 ? 1 : 0;
+ for (let i = firstNonZero + lastDigit + 2; i < endOfString; i++) {
+ if (parseInt(representation[i], 10)) {
+ roundBit = 1;
+ break;
+ }
+ }
+ }
+ }
+ if (roundBit) {
+ let dIdx = lastDigit;
+ for (; dIdx >= 0; dIdx--) {
+ if (++digits[dIdx] > 9) {
+ digits[dIdx] = 0;
+ if (dIdx === 0) {
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ digits[dIdx] = 1;
+ }
+ else {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ }
+ }
+ else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ else {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ if (lastDigit === 0) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MIN;
+ break;
+ }
+ invalidErr(representation, 'exponent underflow');
+ }
+ if (nDigitsStored < nDigits) {
+ if (representation[nDigits - 1 + Number(sawSign) + Number(sawRadix)] !== '0' &&
+ significantDigits !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ nDigits = nDigits - 1;
+ }
+ else {
+ if (digits[lastDigit] !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ lastDigit = lastDigit - 1;
+ }
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ }
+ else {
+ invalidErr(representation, 'overflow');
+ }
+ }
+ if (lastDigit + 1 < significantDigits) {
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ }
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ }
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ if (roundDigit !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ }
+ }
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ if (significantDigits === 0) {
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ }
+ else if (lastDigit < 17) {
+ let dIdx = 0;
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ significandHigh = new Long(0, 0);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ else {
+ let dIdx = 0;
+ significandHigh = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit - 17; dIdx++) {
+ significandHigh = significandHigh.multiply(Long.fromNumber(10));
+ significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));
+ }
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+ const significand = multiply64x2(significandHigh, Long.fromString('100000000000000000'));
+ significand.low = significand.low.add(significandLow);
+ if (lessThan(significand.low, significandLow)) {
+ significand.high = significand.high.add(Long.fromNumber(1));
+ }
+ biasedExponent = exponent + EXPONENT_BIAS;
+ const dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };
+ if (significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1))) {
+ dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));
+ }
+ else {
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));
+ }
+ dec.low = significand.low;
+ if (isNegative) {
+ dec.high = dec.high.or(Long.fromString('9223372036854775808'));
+ }
+ const buffer = ByteUtils.allocateUnsafe(16);
+ index = 0;
+ buffer[index++] = dec.low.low & 0xff;
+ buffer[index++] = (dec.low.low >> 8) & 0xff;
+ buffer[index++] = (dec.low.low >> 16) & 0xff;
+ buffer[index++] = (dec.low.low >> 24) & 0xff;
+ buffer[index++] = dec.low.high & 0xff;
+ buffer[index++] = (dec.low.high >> 8) & 0xff;
+ buffer[index++] = (dec.low.high >> 16) & 0xff;
+ buffer[index++] = (dec.low.high >> 24) & 0xff;
+ buffer[index++] = dec.high.low & 0xff;
+ buffer[index++] = (dec.high.low >> 8) & 0xff;
+ buffer[index++] = (dec.high.low >> 16) & 0xff;
+ buffer[index++] = (dec.high.low >> 24) & 0xff;
+ buffer[index++] = dec.high.high & 0xff;
+ buffer[index++] = (dec.high.high >> 8) & 0xff;
+ buffer[index++] = (dec.high.high >> 16) & 0xff;
+ buffer[index++] = (dec.high.high >> 24) & 0xff;
+ return new Decimal128(buffer);
+ }
+ toString() {
+ let biased_exponent;
+ let significand_digits = 0;
+ const significand = new Array(36);
+ for (let i = 0; i < significand.length; i++)
+ significand[i] = 0;
+ let index = 0;
+ let is_zero = false;
+ let significand_msb;
+ let significand128 = { parts: [0, 0, 0, 0] };
+ let j, k;
+ const string = [];
+ index = 0;
+ const buffer = this.bytes;
+ const low = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midl = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const midh = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ const high = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ index = 0;
+ const dec = {
+ low: new Long(low, midl),
+ high: new Long(midh, high)
+ };
+ if (dec.high.lessThan(Long.ZERO)) {
+ string.push('-');
+ }
+ const combination = (high >> 26) & COMBINATION_MASK;
+ if (combination >> 3 === 3) {
+ if (combination === COMBINATION_INFINITY) {
+ return string.join('') + 'Infinity';
+ }
+ else if (combination === COMBINATION_NAN) {
+ return 'NaN';
+ }
+ else {
+ biased_exponent = (high >> 15) & EXPONENT_MASK;
+ significand_msb = 0x08 + ((high >> 14) & 0x01);
+ }
+ }
+ else {
+ significand_msb = (high >> 14) & 0x07;
+ biased_exponent = (high >> 17) & EXPONENT_MASK;
+ }
+ const exponent = biased_exponent - EXPONENT_BIAS;
+ significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);
+ significand128.parts[1] = midh;
+ significand128.parts[2] = midl;
+ significand128.parts[3] = low;
+ if (significand128.parts[0] === 0 &&
+ significand128.parts[1] === 0 &&
+ significand128.parts[2] === 0 &&
+ significand128.parts[3] === 0) {
+ is_zero = true;
+ }
+ else {
+ for (k = 3; k >= 0; k--) {
+ let least_digits = 0;
+ const result = divideu128(significand128);
+ significand128 = result.quotient;
+ least_digits = result.rem.low;
+ if (!least_digits)
+ continue;
+ for (j = 8; j >= 0; j--) {
+ significand[k * 9 + j] = least_digits % 10;
+ least_digits = Math.floor(least_digits / 10);
+ }
+ }
+ }
+ if (is_zero) {
+ significand_digits = 1;
+ significand[index] = 0;
+ }
+ else {
+ significand_digits = 36;
+ while (!significand[index]) {
+ significand_digits = significand_digits - 1;
+ index = index + 1;
+ }
+ }
+ const scientific_exponent = significand_digits - 1 + exponent;
+ if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) {
+ if (significand_digits > 34) {
+ string.push(`${0}`);
+ if (exponent > 0)
+ string.push(`E+${exponent}`);
+ else if (exponent < 0)
+ string.push(`E${exponent}`);
+ return string.join('');
+ }
+ string.push(`${significand[index++]}`);
+ significand_digits = significand_digits - 1;
+ if (significand_digits) {
+ string.push('.');
+ }
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ string.push('E');
+ if (scientific_exponent > 0) {
+ string.push(`+${scientific_exponent}`);
+ }
+ else {
+ string.push(`${scientific_exponent}`);
+ }
+ }
+ else {
+ if (exponent >= 0) {
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ let radix_position = significand_digits + exponent;
+ if (radix_position > 0) {
+ for (let i = 0; i < radix_position; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ else {
+ string.push('0');
+ }
+ string.push('.');
+ while (radix_position++ < 0) {
+ string.push('0');
+ }
+ for (let i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ }
+ return string.join('');
+ }
+ toJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ toExtendedJSON() {
+ return { $numberDecimal: this.toString() };
+ }
+ static fromExtendedJSON(doc) {
+ return Decimal128.fromString(doc.$numberDecimal);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const d128string = inspect(this.toString(), options);
+ return `new Decimal128(${d128string})`;
+ }
+}
+
+class Double extends BSONValue {
+ get _bsontype() {
+ return 'Double';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value;
+ }
+ static fromString(value) {
+ const coercedValue = Number(value);
+ if (value === 'NaN')
+ return new Double(NaN);
+ if (value === 'Infinity')
+ return new Double(Infinity);
+ if (value === '-Infinity')
+ return new Double(-Infinity);
+ if (!Number.isFinite(coercedValue)) {
+ throw new BSONError(`Input: ${value} is not representable as a Double`);
+ }
+ if (value.trim() !== value) {
+ throw new BSONError(`Input: '${value}' contains whitespace`);
+ }
+ if (value === '') {
+ throw new BSONError(`Input is an empty string`);
+ }
+ if (/[^-0-9.+eE]/.test(value)) {
+ throw new BSONError(`Input: '${value}' is not in decimal or exponential notation`);
+ }
+ return new Double(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toExtendedJSON(options) {
+ if (options && (options.legacy || (options.relaxed && isFinite(this.value)))) {
+ return this.value;
+ }
+ if (Object.is(Math.sign(this.value), -0)) {
+ return { $numberDouble: '-0.0' };
+ }
+ return {
+ $numberDouble: Number.isInteger(this.value) ? this.value.toFixed(1) : this.value.toString()
+ };
+ }
+ static fromExtendedJSON(doc, options) {
+ const doubleValue = parseFloat(doc.$numberDouble);
+ return options && options.relaxed ? doubleValue : new Double(doubleValue);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Double(${inspect(this.value, options)})`;
+ }
+}
+
+class Int32 extends BSONValue {
+ get _bsontype() {
+ return 'Int32';
+ }
+ value;
+ constructor(value) {
+ super();
+ if (value instanceof Number) {
+ value = value.valueOf();
+ }
+ this.value = +value | 0;
+ }
+ static fromString(value) {
+ const cleanedValue = removeLeadingZerosAndExplicitPlus(value);
+ const coercedValue = Number(value);
+ if (BSON_INT32_MAX < coercedValue) {
+ throw new BSONError(`Input: '${value}' is larger than the maximum value for Int32`);
+ }
+ else if (BSON_INT32_MIN > coercedValue) {
+ throw new BSONError(`Input: '${value}' is smaller than the minimum value for Int32`);
+ }
+ else if (!Number.isSafeInteger(coercedValue)) {
+ throw new BSONError(`Input: '${value}' is not a safe integer`);
+ }
+ else if (coercedValue.toString() !== cleanedValue) {
+ throw new BSONError(`Input: '${value}' is not a valid Int32 string`);
+ }
+ return new Int32(coercedValue);
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString(radix) {
+ return this.value.toString(radix);
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON(options) {
+ if (options && (options.relaxed || options.legacy))
+ return this.value;
+ return { $numberInt: this.value.toString() };
+ }
+ static fromExtendedJSON(doc, options) {
+ return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new Int32(doc.$numberInt);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new Int32(${inspect(this.value, options)})`;
+ }
+}
+
+class MaxKey extends BSONValue {
+ get _bsontype() {
+ return 'MaxKey';
+ }
+ toExtendedJSON() {
+ return { $maxKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MaxKey();
+ }
+ inspect() {
+ return 'new MaxKey()';
+ }
+}
+
+class MinKey extends BSONValue {
+ get _bsontype() {
+ return 'MinKey';
+ }
+ toExtendedJSON() {
+ return { $minKey: 1 };
+ }
+ static fromExtendedJSON() {
+ return new MinKey();
+ }
+ inspect() {
+ return 'new MinKey()';
+ }
+}
+
+let PROCESS_UNIQUE = null;
+const __idCache = new WeakMap();
+class ObjectId extends BSONValue {
+ get _bsontype() {
+ return 'ObjectId';
+ }
+ static index = Math.floor(Math.random() * 0xffffff);
+ static cacheHexString;
+ buffer;
+ constructor(inputId) {
+ super();
+ let workingId;
+ if (typeof inputId === 'object' && inputId && 'id' in inputId) {
+ if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
+ throw new BSONError('Argument passed in must have an id that is of type string or Buffer');
+ }
+ if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
+ workingId = ByteUtils.fromHex(inputId.toHexString());
+ }
+ else {
+ workingId = inputId.id;
+ }
+ }
+ else {
+ workingId = inputId;
+ }
+ if (workingId == null) {
+ this.buffer = ObjectId.generate();
+ }
+ else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
+ this.buffer = ByteUtils.toLocalBufferType(workingId);
+ }
+ else if (typeof workingId === 'string') {
+ if (ObjectId.validateHexString(workingId)) {
+ this.buffer = ByteUtils.fromHex(workingId);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, workingId);
+ }
+ }
+ else {
+ throw new BSONError('input must be a 24 character hex string, 12 byte Uint8Array, or an integer');
+ }
+ }
+ else {
+ throw new BSONError('Argument passed in does not match the accepted types');
+ }
+ }
+ get id() {
+ return this.buffer;
+ }
+ set id(value) {
+ this.buffer = value;
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, ByteUtils.toHex(value));
+ }
+ }
+ static validateHexString(string) {
+ if (string?.length !== 24)
+ return false;
+ for (let i = 0; i < 24; i++) {
+ const char = string.charCodeAt(i);
+ if ((char >= 48 && char <= 57) ||
+ (char >= 97 && char <= 102) ||
+ (char >= 65 && char <= 70)) {
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+ toHexString() {
+ if (ObjectId.cacheHexString) {
+ const __id = __idCache.get(this);
+ if (__id)
+ return __id;
+ }
+ const hexString = ByteUtils.toHex(this.id);
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, hexString);
+ }
+ return hexString;
+ }
+ static getInc() {
+ return (ObjectId.index = (ObjectId.index + 1) % 0xffffff);
+ }
+ static generate(time) {
+ if ('number' !== typeof time) {
+ time = Math.floor(Date.now() / 1000);
+ }
+ const inc = ObjectId.getInc();
+ const buffer = ByteUtils.allocateUnsafe(12);
+ NumberUtils.setInt32BE(buffer, 0, time);
+ if (PROCESS_UNIQUE === null) {
+ PROCESS_UNIQUE = ByteUtils.randomBytes(5);
+ }
+ buffer[4] = PROCESS_UNIQUE[0];
+ buffer[5] = PROCESS_UNIQUE[1];
+ buffer[6] = PROCESS_UNIQUE[2];
+ buffer[7] = PROCESS_UNIQUE[3];
+ buffer[8] = PROCESS_UNIQUE[4];
+ buffer[11] = inc & 0xff;
+ buffer[10] = (inc >> 8) & 0xff;
+ buffer[9] = (inc >> 16) & 0xff;
+ return buffer;
+ }
+ toString(encoding) {
+ if (encoding === 'base64')
+ return ByteUtils.toBase64(this.id);
+ if (encoding === 'hex')
+ return this.toHexString();
+ return this.toHexString();
+ }
+ toJSON() {
+ return this.toHexString();
+ }
+ static is(variable) {
+ return (variable != null &&
+ typeof variable === 'object' &&
+ '_bsontype' in variable &&
+ variable._bsontype === 'ObjectId');
+ }
+ equals(otherId) {
+ if (otherId === undefined || otherId === null) {
+ return false;
+ }
+ if (ObjectId.is(otherId)) {
+ return (this.buffer[11] === otherId.buffer[11] && ByteUtils.equals(this.buffer, otherId.buffer));
+ }
+ if (typeof otherId === 'string') {
+ return otherId.toLowerCase() === this.toHexString();
+ }
+ if (typeof otherId === 'object' && typeof otherId.toHexString === 'function') {
+ const otherIdString = otherId.toHexString();
+ const thisIdString = this.toHexString();
+ return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
+ }
+ return false;
+ }
+ getTimestamp() {
+ const timestamp = new Date();
+ const time = NumberUtils.getUint32BE(this.buffer, 0);
+ timestamp.setTime(Math.floor(time) * 1000);
+ return timestamp;
+ }
+ static createPk() {
+ return new ObjectId();
+ }
+ serializeInto(uint8array, index) {
+ uint8array[index] = this.buffer[0];
+ uint8array[index + 1] = this.buffer[1];
+ uint8array[index + 2] = this.buffer[2];
+ uint8array[index + 3] = this.buffer[3];
+ uint8array[index + 4] = this.buffer[4];
+ uint8array[index + 5] = this.buffer[5];
+ uint8array[index + 6] = this.buffer[6];
+ uint8array[index + 7] = this.buffer[7];
+ uint8array[index + 8] = this.buffer[8];
+ uint8array[index + 9] = this.buffer[9];
+ uint8array[index + 10] = this.buffer[10];
+ uint8array[index + 11] = this.buffer[11];
+ return 12;
+ }
+ static createFromTime(time) {
+ const buffer = ByteUtils.allocate(12);
+ for (let i = 11; i >= 4; i--)
+ buffer[i] = 0;
+ NumberUtils.setInt32BE(buffer, 0, time);
+ return new ObjectId(buffer);
+ }
+ static createFromHexString(hexString) {
+ if (hexString?.length !== 24) {
+ throw new BSONError('hex string must be 24 characters');
+ }
+ return new ObjectId(ByteUtils.fromHex(hexString));
+ }
+ static createFromBase64(base64) {
+ if (base64?.length !== 16) {
+ throw new BSONError('base64 string must be 16 characters');
+ }
+ return new ObjectId(ByteUtils.fromBase64(base64));
+ }
+ static isValid(id) {
+ if (id == null)
+ return false;
+ if (typeof id === 'string')
+ return ObjectId.validateHexString(id);
+ try {
+ new ObjectId(id);
+ return true;
+ }
+ catch {
+ return false;
+ }
+ }
+ toExtendedJSON() {
+ if (this.toHexString)
+ return { $oid: this.toHexString() };
+ return { $oid: this.toString('hex') };
+ }
+ static fromExtendedJSON(doc) {
+ return new ObjectId(doc.$oid);
+ }
+ isCached() {
+ return ObjectId.cacheHexString && __idCache.has(this);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new ObjectId(${inspect(this.toHexString(), options)})`;
+ }
+}
+
+function internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined) {
+ let totalLength = 4 + 1;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined);
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ }
+ for (const key of Object.keys(object)) {
+ totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined);
+ }
+ }
+ return totalLength;
+}
+function calculateElement(name, value, serializeFunctions = false, isArray = false, ignoreUndefined = false) {
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ switch (typeof value) {
+ case 'string':
+ return 1 + ByteUtils.utf8ByteLength(name) + 1 + 4 + ByteUtils.utf8ByteLength(value) + 1;
+ case 'number':
+ if (Math.floor(value) === value &&
+ value >= JS_INT_MIN &&
+ value <= JS_INT_MAX) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (4 + 1);
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ }
+ else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ case 'undefined':
+ if (isArray || !ignoreUndefined)
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ return 0;
+ case 'boolean':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 1);
+ case 'object':
+ if (value != null &&
+ typeof value._bsontype === 'string' &&
+ value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value == null || value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ }
+ else if (value._bsontype === 'ObjectId') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (12 + 1);
+ }
+ else if (value instanceof Date || isDate(value)) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (ArrayBuffer.isView(value) ||
+ value instanceof ArrayBuffer ||
+ isAnyArrayBuffer(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 4 + 1) + value.byteLength);
+ }
+ else if (value._bsontype === 'Long' ||
+ value._bsontype === 'Double' ||
+ value._bsontype === 'Timestamp') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (16 + 1);
+ }
+ else if (value._bsontype === 'Code') {
+ if (value.scope != null && Object.keys(value.scope).length > 0) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1 +
+ internalCalculateObjectSize(value.scope, serializeFunctions, ignoreUndefined));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1);
+ }
+ }
+ else if (value._bsontype === 'Binary') {
+ const binary = value;
+ if (binary.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ (binary.position + 1 + 4 + 1 + 4));
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (binary.position + 1 + 4 + 1));
+ }
+ }
+ else if (value._bsontype === 'Symbol') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ ByteUtils.utf8ByteLength(value.value) +
+ 4 +
+ 1 +
+ 1);
+ }
+ else if (value._bsontype === 'DBRef') {
+ const ordered_values = Object.assign({
+ $ref: value.collection,
+ $id: value.oid
+ }, value.fields);
+ if (value.db != null) {
+ ordered_values['$db'] = value.db;
+ }
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ internalCalculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined));
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.source) +
+ 1 +
+ (value.global ? 1 : 0) +
+ (value.ignoreCase ? 1 : 0) +
+ (value.multiline ? 1 : 0) +
+ 1);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.pattern) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.options) +
+ 1);
+ }
+ else {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ internalCalculateObjectSize(value, serializeFunctions, ignoreUndefined) +
+ 1);
+ }
+ case 'function':
+ if (serializeFunctions) {
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.toString()) +
+ 1);
+ }
+ return 0;
+ case 'bigint':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ case 'symbol':
+ return 0;
+ default:
+ throw new BSONError(`Unrecognized JS type: ${typeof value}`);
+ }
+ return 0;
+}
+
+function alphabetize(str) {
+ return str.split('').sort().join('');
+}
+class BSONRegExp extends BSONValue {
+ get _bsontype() {
+ return 'BSONRegExp';
+ }
+ pattern;
+ options;
+ constructor(pattern, options) {
+ super();
+ this.pattern = pattern;
+ this.options = alphabetize(options ?? '');
+ if (this.pattern.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}`);
+ }
+ if (this.options.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Regex options cannot contain null bytes, found: ${JSON.stringify(this.options)}`);
+ }
+ for (let i = 0; i < this.options.length; i++) {
+ if (!(this.options[i] === 'i' ||
+ this.options[i] === 'm' ||
+ this.options[i] === 'x' ||
+ this.options[i] === 'l' ||
+ this.options[i] === 's' ||
+ this.options[i] === 'u')) {
+ throw new BSONError(`The regular expression option [${this.options[i]}] is not supported`);
+ }
+ }
+ }
+ static parseOptions(options) {
+ return options ? options.split('').sort().join('') : '';
+ }
+ toExtendedJSON(options) {
+ options = options || {};
+ if (options.legacy) {
+ return { $regex: this.pattern, $options: this.options };
+ }
+ return { $regularExpression: { pattern: this.pattern, options: this.options } };
+ }
+ static fromExtendedJSON(doc) {
+ if ('$regex' in doc) {
+ if (typeof doc.$regex !== 'string') {
+ if (doc.$regex._bsontype === 'BSONRegExp') {
+ return doc;
+ }
+ }
+ else {
+ return new BSONRegExp(doc.$regex, BSONRegExp.parseOptions(doc.$options));
+ }
+ }
+ if ('$regularExpression' in doc) {
+ return new BSONRegExp(doc.$regularExpression.pattern, BSONRegExp.parseOptions(doc.$regularExpression.options));
+ }
+ throw new BSONError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(doc)}`);
+ }
+ inspect(depth, options, inspect) {
+ const stylize = getStylizeFunction(options) ?? (v => v);
+ inspect ??= defaultInspect;
+ const pattern = stylize(inspect(this.pattern), 'regexp');
+ const flags = stylize(inspect(this.options), 'regexp');
+ return `new BSONRegExp(${pattern}, ${flags})`;
+ }
+}
+
+class BSONSymbol extends BSONValue {
+ get _bsontype() {
+ return 'BSONSymbol';
+ }
+ value;
+ constructor(value) {
+ super();
+ this.value = value;
+ }
+ valueOf() {
+ return this.value;
+ }
+ toString() {
+ return this.value;
+ }
+ toJSON() {
+ return this.value;
+ }
+ toExtendedJSON() {
+ return { $symbol: this.value };
+ }
+ static fromExtendedJSON(doc) {
+ return new BSONSymbol(doc.$symbol);
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ return `new BSONSymbol(${inspect(this.value, options)})`;
+ }
+}
+
+const LongWithoutOverridesClass = Long;
+class Timestamp extends LongWithoutOverridesClass {
+ get _bsontype() {
+ return 'Timestamp';
+ }
+ get [bsonType]() {
+ return 'Timestamp';
+ }
+ static MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
+ get i() {
+ return this.low >>> 0;
+ }
+ get t() {
+ return this.high >>> 0;
+ }
+ constructor(low) {
+ if (low == null) {
+ super(0, 0, true);
+ }
+ else if (typeof low === 'bigint') {
+ super(low, true);
+ }
+ else if (Long.isLong(low)) {
+ super(low.low, low.high, true);
+ }
+ else if (typeof low === 'object' && 't' in low && 'i' in low) {
+ if (typeof low.t !== 'number' && (typeof low.t !== 'object' || low.t._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t as a number');
+ }
+ if (typeof low.i !== 'number' && (typeof low.i !== 'object' || low.i._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i as a number');
+ }
+ const t = Number(low.t);
+ const i = Number(low.i);
+ if (t < 0 || Number.isNaN(t)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive t');
+ }
+ if (i < 0 || Number.isNaN(i)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive i');
+ }
+ if (t > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t equal or less than uint32 max');
+ }
+ if (i > 0xffff_ffff) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i equal or less than uint32 max');
+ }
+ super(i, t, true);
+ }
+ else {
+ throw new BSONError('A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }');
+ }
+ }
+ toJSON() {
+ return {
+ $timestamp: this.toString()
+ };
+ }
+ static fromInt(value) {
+ return new Timestamp(Long.fromInt(value, true));
+ }
+ static fromNumber(value) {
+ return new Timestamp(Long.fromNumber(value, true));
+ }
+ static fromBits(lowBits, highBits) {
+ return new Timestamp({ i: lowBits, t: highBits });
+ }
+ static fromString(str, optRadix) {
+ return new Timestamp(Long.fromString(str, true, optRadix));
+ }
+ toExtendedJSON() {
+ return { $timestamp: { t: this.t, i: this.i } };
+ }
+ static fromExtendedJSON(doc) {
+ const i = Long.isLong(doc.$timestamp.i)
+ ? doc.$timestamp.i.getLowBitsUnsigned()
+ : doc.$timestamp.i;
+ const t = Long.isLong(doc.$timestamp.t)
+ ? doc.$timestamp.t.getLowBitsUnsigned()
+ : doc.$timestamp.t;
+ return new Timestamp({ t, i });
+ }
+ inspect(depth, options, inspect) {
+ inspect ??= defaultInspect;
+ const t = inspect(this.t, options);
+ const i = inspect(this.i, options);
+ return `new Timestamp({ t: ${t}, i: ${i} })`;
+ }
+}
+
+const JS_INT_MAX_LONG = Long.fromNumber(JS_INT_MAX);
+const JS_INT_MIN_LONG = Long.fromNumber(JS_INT_MIN);
+function internalDeserialize(buffer, options, isArray) {
+ options = options == null ? {} : options;
+ const index = options && options.index ? options.index : 0;
+ const size = NumberUtils.getInt32LE(buffer, index);
+ if (size < 5) {
+ throw new BSONError(`bson size must be >= 5, is ${size}`);
+ }
+ if (options.allowObjectSmallerThanBufferSize && buffer.length < size) {
+ throw new BSONError(`buffer length ${buffer.length} must be >= bson size ${size}`);
+ }
+ if (!options.allowObjectSmallerThanBufferSize && buffer.length !== size) {
+ throw new BSONError(`buffer length ${buffer.length} must === bson size ${size}`);
+ }
+ if (size + index > buffer.byteLength) {
+ throw new BSONError(`(bson size ${size} + options.index ${index} must be <= buffer length ${buffer.byteLength})`);
+ }
+ if (buffer[index + size - 1] !== 0) {
+ throw new BSONError("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");
+ }
+ return deserializeObject(buffer, index, options, isArray);
+}
+const allowedDBRefKeys = /^\$ref$|^\$id$|^\$db$/;
+function deserializeObject(buffer, index, options, isArray = false) {
+ const fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];
+ const raw = options['raw'] == null ? false : options['raw'];
+ const bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false;
+ const promoteBuffers = options.promoteBuffers ?? false;
+ const promoteLongs = options.promoteLongs ?? true;
+ const promoteValues = options.promoteValues ?? true;
+ const useBigInt64 = options.useBigInt64 ?? false;
+ if (useBigInt64 && !promoteValues) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ if (useBigInt64 && !promoteLongs) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+ const validation = options.validation == null ? { utf8: true } : options.validation;
+ let globalUTFValidation = true;
+ let validationSetting;
+ let utf8KeysSet;
+ const utf8ValidatedKeys = validation.utf8;
+ if (typeof utf8ValidatedKeys === 'boolean') {
+ validationSetting = utf8ValidatedKeys;
+ }
+ else {
+ globalUTFValidation = false;
+ const utf8ValidationValues = Object.keys(utf8ValidatedKeys).map(function (key) {
+ return utf8ValidatedKeys[key];
+ });
+ if (utf8ValidationValues.length === 0) {
+ throw new BSONError('UTF-8 validation setting cannot be empty');
+ }
+ if (typeof utf8ValidationValues[0] !== 'boolean') {
+ throw new BSONError('Invalid UTF-8 validation option, must specify boolean values');
+ }
+ validationSetting = utf8ValidationValues[0];
+ if (!utf8ValidationValues.every(item => item === validationSetting)) {
+ throw new BSONError('Invalid UTF-8 validation option - keys must be all true or all false');
+ }
+ }
+ if (!globalUTFValidation) {
+ utf8KeysSet = new Set();
+ for (const key of Object.keys(utf8ValidatedKeys)) {
+ utf8KeysSet.add(key);
+ }
+ }
+ const startIndex = index;
+ if (buffer.length < 5)
+ throw new BSONError('corrupt bson message < 5 bytes long');
+ const size = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (size < 5 || size > buffer.length)
+ throw new BSONError('corrupt bson message');
+ const object = isArray ? [] : {};
+ let arrayIndex = 0;
+ const done = false;
+ let isPossibleDBRef = isArray ? false : null;
+ while (!done) {
+ const elementType = buffer[index++];
+ if (elementType === 0)
+ break;
+ let i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.byteLength)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const name = isArray ? arrayIndex++ : ByteUtils.toUTF8(buffer, index, i, false);
+ let shouldValidateKey = true;
+ if (globalUTFValidation || utf8KeysSet?.has(name)) {
+ shouldValidateKey = validationSetting;
+ }
+ else {
+ shouldValidateKey = !validationSetting;
+ }
+ if (isPossibleDBRef !== false && name[0] === '$') {
+ isPossibleDBRef = allowedDBRefKeys.test(name);
+ }
+ let value;
+ index = i + 1;
+ if (elementType === BSON_DATA_STRING) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ value = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_OID) {
+ const oid = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oid[i] = buffer[index + i];
+ value = new ObjectId(oid);
+ index = index + 12;
+ }
+ else if (elementType === BSON_DATA_INT && promoteValues === false) {
+ value = new Int32(NumberUtils.getInt32LE(buffer, index));
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_INT) {
+ value = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ }
+ else if (elementType === BSON_DATA_NUMBER) {
+ value = NumberUtils.getFloat64LE(buffer, index);
+ index += 8;
+ if (promoteValues === false)
+ value = new Double(value);
+ }
+ else if (elementType === BSON_DATA_DATE) {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ value = new Date(new Long(lowBits, highBits).toNumber());
+ }
+ else if (elementType === BSON_DATA_BOOLEAN) {
+ if (buffer[index] !== 0 && buffer[index] !== 1)
+ throw new BSONError('illegal boolean type value');
+ value = buffer[index++] === 1;
+ }
+ else if (elementType === BSON_DATA_OBJECT) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ if (objectSize <= 0 || objectSize > buffer.length - index)
+ throw new BSONError('bad embedded document length in bson');
+ if (raw) {
+ value = buffer.subarray(index, index + objectSize);
+ }
+ else {
+ let objectOptions = options;
+ if (!globalUTFValidation) {
+ objectOptions = { ...options, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, objectOptions, false);
+ }
+ index = index + objectSize;
+ }
+ else if (elementType === BSON_DATA_ARRAY) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ let arrayOptions = options;
+ const stopIndex = index + objectSize;
+ if (fieldsAsRaw && fieldsAsRaw[name]) {
+ arrayOptions = { ...options, raw: true };
+ }
+ if (!globalUTFValidation) {
+ arrayOptions = { ...arrayOptions, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, arrayOptions, true);
+ index = index + objectSize;
+ if (buffer[index - 1] !== 0)
+ throw new BSONError('invalid array terminator byte');
+ if (index !== stopIndex)
+ throw new BSONError('corrupted array bson');
+ }
+ else if (elementType === BSON_DATA_UNDEFINED) {
+ value = undefined;
+ }
+ else if (elementType === BSON_DATA_NULL) {
+ value = null;
+ }
+ else if (elementType === BSON_DATA_LONG) {
+ if (useBigInt64) {
+ value = NumberUtils.getBigInt64LE(buffer, index);
+ index += 8;
+ }
+ else {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+ const long = new Long(lowBits, highBits);
+ if (promoteLongs && promoteValues === true) {
+ value =
+ long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG)
+ ? long.toNumber()
+ : long;
+ }
+ else {
+ value = long;
+ }
+ }
+ }
+ else if (elementType === BSON_DATA_DECIMAL128) {
+ const bytes = ByteUtils.allocateUnsafe(16);
+ for (let i = 0; i < 16; i++)
+ bytes[i] = buffer[index + i];
+ index = index + 16;
+ value = new Decimal128(bytes);
+ }
+ else if (elementType === BSON_DATA_BINARY) {
+ let binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ const totalBinarySize = binarySize;
+ const subType = buffer[index++];
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found');
+ if (binarySize > buffer.byteLength)
+ throw new BSONError('Binary type size larger than document size');
+ if (subType === Binary.SUBTYPE_BYTE_ARRAY) {
+ binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found for subtype 0x02');
+ if (binarySize > totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too long binary size');
+ if (binarySize < totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too short binary size');
+ }
+ if (promoteBuffers && promoteValues) {
+ value = ByteUtils.toLocalBufferType(buffer.subarray(index, index + binarySize));
+ }
+ else {
+ value = new Binary(buffer.subarray(index, index + binarySize), subType);
+ if (subType === BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
+ value = value.toUUID();
+ }
+ }
+ index = index + binarySize;
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === false) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ const optionsArray = new Array(regExpOptions.length);
+ for (i = 0; i < regExpOptions.length; i++) {
+ switch (regExpOptions[i]) {
+ case 'm':
+ optionsArray[i] = 'm';
+ break;
+ case 's':
+ optionsArray[i] = 'g';
+ break;
+ case 'i':
+ optionsArray[i] = 'i';
+ break;
+ }
+ }
+ value = new RegExp(source, optionsArray.join(''));
+ }
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === true) {
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ i = index;
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ if (i >= buffer.length)
+ throw new BSONError('Bad BSON Document: illegal CString');
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+ value = new BSONRegExp(source, regExpOptions);
+ }
+ else if (elementType === BSON_DATA_SYMBOL) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const symbol = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = promoteValues ? symbol : new BSONSymbol(symbol);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_TIMESTAMP) {
+ value = new Timestamp({
+ i: NumberUtils.getUint32LE(buffer, index),
+ t: NumberUtils.getUint32LE(buffer, index + 4)
+ });
+ index += 8;
+ }
+ else if (elementType === BSON_DATA_MIN_KEY) {
+ value = new MinKey();
+ }
+ else if (elementType === BSON_DATA_MAX_KEY) {
+ value = new MaxKey();
+ }
+ else if (elementType === BSON_DATA_CODE) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = new Code(functionString);
+ index = index + stringSize;
+ }
+ else if (elementType === BSON_DATA_CODE_W_SCOPE) {
+ const totalSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (totalSize < 4 + 4 + 4 + 1) {
+ throw new BSONError('code_w_scope total size shorter minimum expected length');
+ }
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ const scopeObject = deserializeObject(buffer, _index, options, false);
+ index = index + objectSize;
+ if (totalSize < 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too short, truncating scope');
+ }
+ if (totalSize > 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too long, clips outer document');
+ }
+ value = new Code(functionString, scopeObject);
+ }
+ else if (elementType === BSON_DATA_DBPOINTER) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0)
+ throw new BSONError('bad string length in bson');
+ const namespace = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ const oidBuffer = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++)
+ oidBuffer[i] = buffer[index + i];
+ const oid = new ObjectId(oidBuffer);
+ index = index + 12;
+ value = new DBRef(namespace, oid);
+ }
+ else {
+ throw new BSONError(`Detected unknown BSON type ${elementType.toString(16)} for fieldname "${name}"`);
+ }
+ if (name === '__proto__') {
+ Object.defineProperty(object, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ object[name] = value;
+ }
+ }
+ if (size !== index - startIndex) {
+ if (isArray)
+ throw new BSONError('corrupt array bson');
+ throw new BSONError('corrupt object bson');
+ }
+ if (!isPossibleDBRef)
+ return object;
+ if (isDBRefLike(object)) {
+ const copy = Object.assign({}, object);
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(object.$ref, object.$id, object.$db, copy);
+ }
+ return object;
+}
+
+const regexp = /\x00/;
+const ignoreKeys = new Set(['$db', '$ref', '$id', '$clusterTime']);
+function serializeString(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_STRING;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes + 1;
+ buffer[index - 1] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value, index + 4);
+ NumberUtils.setInt32LE(buffer, index, size + 1);
+ index = index + 4 + size;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeNumber(buffer, key, value, index) {
+ const isNegativeZero = Object.is(value, -0);
+ const type = !isNegativeZero &&
+ Number.isSafeInteger(value) &&
+ value <= BSON_INT32_MAX &&
+ value >= BSON_INT32_MIN
+ ? BSON_DATA_INT
+ : BSON_DATA_NUMBER;
+ buffer[index++] = type;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0x00;
+ if (type === BSON_DATA_INT) {
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ }
+ else {
+ index += NumberUtils.setFloat64LE(buffer, index, value);
+ }
+ return index;
+}
+function serializeBigInt(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_LONG;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index += numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setBigInt64LE(buffer, index, value);
+ return index;
+}
+function serializeNull(buffer, key, _, index) {
+ buffer[index++] = BSON_DATA_NULL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeBoolean(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BOOLEAN;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ buffer[index++] = value ? 1 : 0;
+ return index;
+}
+function serializeDate(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DATE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const dateInMilis = Long.fromNumber(value.getTime());
+ const lowBits = dateInMilis.getLowBits();
+ const highBits = dateInMilis.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.source && value.source.match(regexp) != null) {
+ throw new BSONError('value ' + value.source + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.source, index);
+ buffer[index++] = 0x00;
+ if (value.ignoreCase)
+ buffer[index++] = 0x69;
+ if (value.global)
+ buffer[index++] = 0x73;
+ if (value.multiline)
+ buffer[index++] = 0x6d;
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeBSONRegExp(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_REGEXP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.pattern.match(regexp) != null) {
+ throw new BSONError('pattern ' + value.pattern + ' must not contain null bytes');
+ }
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.pattern, index);
+ buffer[index++] = 0x00;
+ const sortedOptions = value.options.split('').sort().join('');
+ index = index + ByteUtils.encodeUTF8Into(buffer, sortedOptions, index);
+ buffer[index++] = 0x00;
+ return index;
+}
+function serializeMinMax(buffer, key, value, index) {
+ if (value === null) {
+ buffer[index++] = BSON_DATA_NULL;
+ }
+ else if (value._bsontype === 'MinKey') {
+ buffer[index++] = BSON_DATA_MIN_KEY;
+ }
+ else {
+ buffer[index++] = BSON_DATA_MAX_KEY;
+ }
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeObjectId(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_OID;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += value.serializeInto(buffer, index);
+ return index;
+}
+function serializeBuffer(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = value.length;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = BSON_BINARY_SUBTYPE_DEFAULT;
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = value[i];
+ }
+ else {
+ buffer.set(value, index);
+ }
+ index = index + size;
+ return index;
+}
+function serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path.has(value)) {
+ throw new BSONError('Cannot convert circular structure to BSON');
+ }
+ path.add(value);
+ buffer[index++] = Array.isArray(value) ? BSON_DATA_ARRAY : BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ path.delete(value);
+ return endIndex;
+}
+function serializeDecimal128(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_DECIMAL128;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ for (let i = 0; i < 16; i++)
+ buffer[index + i] = value.bytes[i];
+ return index + 16;
+}
+function serializeLong(buffer, key, value, index) {
+ buffer[index++] =
+ value._bsontype === 'Long' ? BSON_DATA_LONG : BSON_DATA_TIMESTAMP;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const lowBits = value.getLowBits();
+ const highBits = value.getHighBits();
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+function serializeInt32(buffer, key, value, index) {
+ value = value.valueOf();
+ buffer[index++] = BSON_DATA_INT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ return index;
+}
+function serializeDouble(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_NUMBER;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ index += NumberUtils.setFloat64LE(buffer, index, value.value);
+ return index;
+}
+function serializeFunction(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeCode(buffer, key, value, index, checkKeys = false, depth = 0, serializeFunctions = false, ignoreUndefined = true, path) {
+ if (value.scope && typeof value.scope === 'object') {
+ buffer[index++] = BSON_DATA_CODE_W_SCOPE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ const functionString = value.code;
+ index = index + 4;
+ const codeSize = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, codeSize);
+ buffer[index + 4 + codeSize - 1] = 0;
+ index = index + codeSize + 4;
+ const endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
+ index = endIndex - 1;
+ const totalSize = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, startIndex, totalSize);
+ buffer[index++] = 0;
+ }
+ else {
+ buffer[index++] = BSON_DATA_CODE;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const functionString = value.code.toString();
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ }
+ return index;
+}
+function serializeBinary(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_BINARY;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const data = value.buffer;
+ let size = value.position;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY)
+ size = size + 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ buffer[index++] = value.sub_type;
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ size = size - 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ }
+ if (value.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(value);
+ }
+ if (size <= 16) {
+ for (let i = 0; i < size; i++)
+ buffer[index + i] = data[i];
+ }
+ else {
+ buffer.set(data, index);
+ }
+ index = index + value.position;
+ return index;
+}
+function serializeSymbol(buffer, key, value, index) {
+ buffer[index++] = BSON_DATA_SYMBOL;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const size = ByteUtils.encodeUTF8Into(buffer, value.value, index + 4) + 1;
+ NumberUtils.setInt32LE(buffer, index, size);
+ index = index + 4 + size - 1;
+ buffer[index++] = 0;
+ return index;
+}
+function serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path) {
+ buffer[index++] = BSON_DATA_OBJECT;
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ let startIndex = index;
+ let output = {
+ $ref: value.collection || value.namespace,
+ $id: value.oid
+ };
+ if (value.db != null) {
+ output.$db = value.db;
+ }
+ output = Object.assign(output, value.fields);
+ const endIndex = serializeInto(buffer, output, false, index, depth + 1, serializeFunctions, true, path);
+ const size = endIndex - startIndex;
+ startIndex += NumberUtils.setInt32LE(buffer, index, size);
+ return endIndex;
+}
+function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {
+ if (path == null) {
+ if (object == null) {
+ buffer[0] = 0x05;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ buffer[4] = 0x00;
+ return 5;
+ }
+ if (Array.isArray(object)) {
+ throw new BSONError('serialize does not support an array as the root input');
+ }
+ if (typeof object !== 'object') {
+ throw new BSONError('serialize does not support non-object as the root input');
+ }
+ else if ('_bsontype' in object && typeof object._bsontype === 'string') {
+ throw new BSONError(`BSON types cannot be serialized as a document`);
+ }
+ else if (isDate(object) ||
+ isRegExp(object) ||
+ isUint8Array(object) ||
+ isAnyArrayBuffer(object)) {
+ throw new BSONError(`date, regexp, typedarray, and arraybuffer cannot be BSON documents`);
+ }
+ path = new Set();
+ }
+ path.add(object);
+ let index = startingIndex + 4;
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ const key = `${i}`;
+ let value = object[i];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (value === undefined) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else if (object instanceof Map || isMap(object)) {
+ const iterator = object.entries();
+ let done = false;
+ while (!done) {
+ const entry = iterator.next();
+ done = !!entry.done;
+ if (done)
+ continue;
+ const key = entry.value ? entry.value[0] : undefined;
+ let value = entry.value ? entry.value[1] : undefined;
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ else {
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ if (object != null && typeof object !== 'object') {
+ throw new BSONError('toBSON function did not return an object');
+ }
+ }
+ for (const key of Object.keys(object)) {
+ let value = object[key];
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+ const type = typeof value;
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ }
+ else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+ if (value === undefined) {
+ if (ignoreUndefined === false)
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ }
+ else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ }
+ else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ }
+ else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ }
+ else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ }
+ else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ }
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ }
+ else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ }
+ else {
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ }
+ else if (type === 'object') {
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Code') {
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
+ }
+ else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ }
+ else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ }
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ }
+ else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ }
+ else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+ path.delete(object);
+ buffer[index++] = 0x00;
+ const size = index - startingIndex;
+ startingIndex += NumberUtils.setInt32LE(buffer, startingIndex, size);
+ return index;
+}
+
+function isBSONType(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ '_bsontype' in value &&
+ typeof value._bsontype === 'string');
+}
+const keysToCodecs = {
+ $oid: ObjectId,
+ $binary: Binary,
+ $uuid: Binary,
+ $symbol: BSONSymbol,
+ $numberInt: Int32,
+ $numberDecimal: Decimal128,
+ $numberDouble: Double,
+ $numberLong: Long,
+ $minKey: MinKey,
+ $maxKey: MaxKey,
+ $regex: BSONRegExp,
+ $regularExpression: BSONRegExp,
+ $timestamp: Timestamp
+};
+function deserializeValue(value, options = {}) {
+ if (typeof value === 'number') {
+ const in32BitRange = value <= BSON_INT32_MAX && value >= BSON_INT32_MIN;
+ const in64BitRange = value <= BSON_INT64_MAX && value >= BSON_INT64_MIN;
+ if (options.relaxed || options.legacy) {
+ return value;
+ }
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (in32BitRange) {
+ return new Int32(value);
+ }
+ if (in64BitRange) {
+ if (options.useBigInt64) {
+ return BigInt(value);
+ }
+ return Long.fromNumber(value);
+ }
+ }
+ return new Double(value);
+ }
+ if (value == null || typeof value !== 'object')
+ return value;
+ if (value.$undefined)
+ return null;
+ const keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);
+ for (let i = 0; i < keys.length; i++) {
+ const c = keysToCodecs[keys[i]];
+ if (c)
+ return c.fromExtendedJSON(value, options);
+ }
+ if (value.$date != null) {
+ const d = value.$date;
+ const date = new Date();
+ if (options.legacy) {
+ if (typeof d === 'number')
+ date.setTime(d);
+ else if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ else {
+ if (typeof d === 'string')
+ date.setTime(Date.parse(d));
+ else if (Long.isLong(d))
+ date.setTime(d.toNumber());
+ else if (typeof d === 'number' && options.relaxed)
+ date.setTime(d);
+ else if (typeof d === 'bigint')
+ date.setTime(Number(d));
+ else
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ return date;
+ }
+ if (value.$code != null) {
+ const copy = Object.assign({}, value);
+ if (value.$scope) {
+ copy.$scope = deserializeValue(value.$scope);
+ }
+ return Code.fromExtendedJSON(value);
+ }
+ if (isDBRefLike(value) || value.$dbPointer) {
+ const v = value.$ref ? value : value.$dbPointer;
+ if (v instanceof DBRef)
+ return v;
+ const dollarKeys = Object.keys(v).filter(k => k.startsWith('$'));
+ let valid = true;
+ dollarKeys.forEach(k => {
+ if (['$ref', '$id', '$db'].indexOf(k) === -1)
+ valid = false;
+ });
+ if (valid)
+ return DBRef.fromExtendedJSON(v);
+ }
+ return value;
+}
+function serializeArray(array, options) {
+ return array.map((v, index) => {
+ options.seenObjects.push({ propertyName: `index ${index}`, obj: null });
+ try {
+ return serializeValue(v, options);
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ });
+}
+function getISOString(date) {
+ const isoStr = date.toISOString();
+ return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';
+}
+function serializeValue(value, options) {
+ if (value instanceof Map || isMap(value)) {
+ const obj = Object.create(null);
+ for (const [k, v] of value) {
+ if (typeof k !== 'string') {
+ throw new BSONError('Can only serialize maps with string keys');
+ }
+ obj[k] = v;
+ }
+ return serializeValue(obj, options);
+ }
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null) {
+ const index = options.seenObjects.findIndex(entry => entry.obj === value);
+ if (index !== -1) {
+ const props = options.seenObjects.map(entry => entry.propertyName);
+ const leadingPart = props
+ .slice(0, index)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const alreadySeen = props[index];
+ const circularPart = ' -> ' +
+ props
+ .slice(index + 1, props.length - 1)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const current = props[props.length - 1];
+ const leadingSpace = ' '.repeat(leadingPart.length + alreadySeen.length / 2);
+ const dashes = '-'.repeat(circularPart.length + (alreadySeen.length + current.length) / 2 - 1);
+ throw new BSONError('Converting circular structure to EJSON:\n' +
+ ` ${leadingPart}${alreadySeen}${circularPart}${current}\n` +
+ ` ${leadingSpace}\\${dashes}/`);
+ }
+ options.seenObjects[options.seenObjects.length - 1].obj = value;
+ }
+ if (Array.isArray(value))
+ return serializeArray(value, options);
+ if (value === undefined)
+ return options.ignoreUndefined ? undefined : null;
+ if (value instanceof Date || isDate(value)) {
+ const dateNum = value.getTime(), inRange = dateNum > -1 && dateNum < 253402318800000;
+ if (options.legacy) {
+ return options.relaxed && inRange
+ ? { $date: value.getTime() }
+ : { $date: getISOString(value) };
+ }
+ return options.relaxed && inRange
+ ? { $date: getISOString(value) }
+ : { $date: { $numberLong: value.getTime().toString() } };
+ }
+ if (typeof value === 'number' && (!options.relaxed || !isFinite(value))) {
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return { $numberInt: value.toString() };
+ }
+ if (value >= BSON_INT64_MIN && value <= BSON_INT64_MAX) {
+ return { $numberLong: value.toString() };
+ }
+ }
+ return { $numberDouble: Object.is(value, -0) ? '-0.0' : value.toString() };
+ }
+ if (typeof value === 'bigint') {
+ if (!options.relaxed) {
+ return { $numberLong: BigInt.asIntN(64, value).toString() };
+ }
+ return Number(BigInt.asIntN(64, value));
+ }
+ if (value instanceof RegExp || isRegExp(value)) {
+ let flags = value.flags;
+ if (flags === undefined) {
+ const match = value.toString().match(/[gimuy]*$/);
+ if (match) {
+ flags = match[0];
+ }
+ }
+ const rx = new BSONRegExp(value.source, flags);
+ return rx.toExtendedJSON(options);
+ }
+ if (value != null && typeof value === 'object')
+ return serializeDocument(value, options);
+ return value;
+}
+const BSON_TYPE_MAPPINGS = {
+ Binary: (o) => new Binary(o.value(), o.sub_type),
+ Code: (o) => new Code(o.code, o.scope),
+ DBRef: (o) => new DBRef(o.collection || o.namespace, o.oid, o.db, o.fields),
+ Decimal128: (o) => new Decimal128(o.bytes),
+ Double: (o) => new Double(o.value),
+ Int32: (o) => new Int32(o.value),
+ 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_),
+ MaxKey: () => new MaxKey(),
+ MinKey: () => new MinKey(),
+ ObjectId: (o) => new ObjectId(o),
+ BSONRegExp: (o) => new BSONRegExp(o.pattern, o.options),
+ BSONSymbol: (o) => new BSONSymbol(o.value),
+ Timestamp: (o) => Timestamp.fromBits(o.low, o.high)
+};
+function serializeDocument(doc, options) {
+ if (doc == null || typeof doc !== 'object')
+ throw new BSONError('not an object instance');
+ const bsontype = doc._bsontype;
+ if (typeof bsontype === 'undefined') {
+ const _doc = {};
+ for (const name of Object.keys(doc)) {
+ options.seenObjects.push({ propertyName: name, obj: null });
+ try {
+ const value = serializeValue(doc[name], options);
+ if (name === '__proto__') {
+ Object.defineProperty(_doc, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ else {
+ _doc[name] = value;
+ }
+ }
+ finally {
+ options.seenObjects.pop();
+ }
+ }
+ return _doc;
+ }
+ else if (doc != null &&
+ typeof doc === 'object' &&
+ typeof doc._bsontype === 'string' &&
+ doc[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ }
+ else if (isBSONType(doc)) {
+ let outDoc = doc;
+ if (typeof outDoc.toExtendedJSON !== 'function') {
+ const mapper = BSON_TYPE_MAPPINGS[doc._bsontype];
+ if (!mapper) {
+ throw new BSONError('Unrecognized or invalid _bsontype: ' + doc._bsontype);
+ }
+ outDoc = mapper(outDoc);
+ }
+ if (bsontype === 'Code' && outDoc.scope) {
+ outDoc = new Code(outDoc.code, serializeValue(outDoc.scope, options));
+ }
+ else if (bsontype === 'DBRef' && outDoc.oid) {
+ outDoc = new DBRef(serializeValue(outDoc.collection, options), serializeValue(outDoc.oid, options), serializeValue(outDoc.db, options), serializeValue(outDoc.fields, options));
+ }
+ return outDoc.toExtendedJSON(options);
+ }
+ else {
+ throw new BSONError('_bsontype must be a string, but was: ' + typeof bsontype);
+ }
+}
+function parse(text, options) {
+ const ejsonOptions = {
+ useBigInt64: options?.useBigInt64 ?? false,
+ relaxed: options?.relaxed ?? true,
+ legacy: options?.legacy ?? false
+ };
+ return JSON.parse(text, (key, value) => {
+ if (key.indexOf('\x00') !== -1) {
+ throw new BSONError(`BSON Document field names cannot contain null bytes, found: ${JSON.stringify(key)}`);
+ }
+ return deserializeValue(value, ejsonOptions);
+ });
+}
+function stringify(value, replacer, space, options) {
+ if (space != null && typeof space === 'object') {
+ options = space;
+ space = 0;
+ }
+ if (replacer != null && typeof replacer === 'object' && !Array.isArray(replacer)) {
+ options = replacer;
+ replacer = undefined;
+ space = 0;
+ }
+ const serializeOptions = Object.assign({ relaxed: true, legacy: false }, options, {
+ seenObjects: [{ propertyName: '(root)', obj: null }]
+ });
+ const doc = serializeValue(value, serializeOptions);
+ return JSON.stringify(doc, replacer, space);
+}
+function EJSONserialize(value, options) {
+ options = options || {};
+ return JSON.parse(stringify(value, options));
+}
+function EJSONdeserialize(ejson, options) {
+ options = options || {};
+ return parse(JSON.stringify(ejson), options);
+}
+const EJSON = Object.create(null);
+EJSON.parse = parse;
+EJSON.stringify = stringify;
+EJSON.serialize = EJSONserialize;
+EJSON.deserialize = EJSONdeserialize;
+Object.freeze(EJSON);
+
+const BSONElementType = {
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: 255,
+ maxKey: 127
+};
+function getSize(source, offset) {
+ try {
+ return NumberUtils.getNonnegativeInt32LE(source, offset);
+ }
+ catch (cause) {
+ throw new BSONOffsetError('BSON size cannot be negative', offset, { cause });
+ }
+}
+function findNull(bytes, offset) {
+ let nullTerminatorOffset = offset;
+ for (; bytes[nullTerminatorOffset] !== 0x00; nullTerminatorOffset++)
+ ;
+ if (nullTerminatorOffset === bytes.length - 1) {
+ throw new BSONOffsetError('Null terminator not found', offset);
+ }
+ return nullTerminatorOffset;
+}
+function parseToElements(bytes, startOffset = 0) {
+ startOffset ??= 0;
+ if (bytes.length < 5) {
+ throw new BSONOffsetError(`Input must be at least 5 bytes, got ${bytes.length} bytes`, startOffset);
+ }
+ const documentSize = getSize(bytes, startOffset);
+ if (documentSize > bytes.length - startOffset) {
+ throw new BSONOffsetError(`Parsed documentSize (${documentSize} bytes) does not match input length (${bytes.length} bytes)`, startOffset);
+ }
+ if (bytes[startOffset + documentSize - 1] !== 0x00) {
+ throw new BSONOffsetError('BSON documents must end in 0x00', startOffset + documentSize);
+ }
+ const elements = [];
+ let offset = startOffset + 4;
+ while (offset <= documentSize + startOffset) {
+ const type = bytes[offset];
+ offset += 1;
+ if (type === 0) {
+ if (offset - startOffset !== documentSize) {
+ throw new BSONOffsetError(`Invalid 0x00 type byte`, offset);
+ }
+ break;
+ }
+ const nameOffset = offset;
+ const nameLength = findNull(bytes, offset) - nameOffset;
+ offset += nameLength + 1;
+ let length;
+ if (type === BSONElementType.double ||
+ type === BSONElementType.long ||
+ type === BSONElementType.date ||
+ type === BSONElementType.timestamp) {
+ length = 8;
+ }
+ else if (type === BSONElementType.int) {
+ length = 4;
+ }
+ else if (type === BSONElementType.objectId) {
+ length = 12;
+ }
+ else if (type === BSONElementType.decimal) {
+ length = 16;
+ }
+ else if (type === BSONElementType.bool) {
+ length = 1;
+ }
+ else if (type === BSONElementType.null ||
+ type === BSONElementType.undefined ||
+ type === BSONElementType.maxKey ||
+ type === BSONElementType.minKey) {
+ length = 0;
+ }
+ else if (type === BSONElementType.regex) {
+ length = findNull(bytes, findNull(bytes, offset) + 1) + 1 - offset;
+ }
+ else if (type === BSONElementType.object ||
+ type === BSONElementType.array ||
+ type === BSONElementType.javascriptWithScope) {
+ length = getSize(bytes, offset);
+ }
+ else if (type === BSONElementType.string ||
+ type === BSONElementType.binData ||
+ type === BSONElementType.dbPointer ||
+ type === BSONElementType.javascript ||
+ type === BSONElementType.symbol) {
+ length = getSize(bytes, offset) + 4;
+ if (type === BSONElementType.binData) {
+ length += 1;
+ }
+ if (type === BSONElementType.dbPointer) {
+ length += 12;
+ }
+ }
+ else {
+ throw new BSONOffsetError(`Invalid 0x${type.toString(16).padStart(2, '0')} type byte`, offset);
+ }
+ if (length > documentSize) {
+ throw new BSONOffsetError('value reports length larger than document', offset);
+ }
+ elements.push([type, nameOffset, nameLength, offset, length]);
+ offset += length;
+ }
+ return elements;
+}
+
+const onDemand = Object.create(null);
+onDemand.parseToElements = parseToElements;
+onDemand.ByteUtils = ByteUtils;
+onDemand.NumberUtils = NumberUtils;
+Object.freeze(onDemand);
+
+const MAXSIZE = 1024 * 1024 * 17;
+let buffer = ByteUtils.allocate(MAXSIZE);
+function setInternalBufferSize(size) {
+ if (buffer.length < size) {
+ buffer = ByteUtils.allocate(size);
+ }
+}
+function serialize(object, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const minInternalBufferSize = typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE;
+ if (buffer.length < minInternalBufferSize) {
+ buffer = ByteUtils.allocate(minInternalBufferSize);
+ }
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ const finishedBuffer = ByteUtils.allocateUnsafe(serializationIndex);
+ finishedBuffer.set(buffer.subarray(0, serializationIndex), 0);
+ return finishedBuffer;
+}
+function serializeWithBufferAndIndex(object, finalBuffer, options = {}) {
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const startIndex = typeof options.index === 'number' ? options.index : 0;
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
+ finalBuffer.set(buffer.subarray(0, serializationIndex), startIndex);
+ return startIndex + serializationIndex - 1;
+}
+function deserialize(buffer, options = {}) {
+ return internalDeserialize(ByteUtils.toLocalBufferType(buffer), options);
+}
+function calculateObjectSize(object, options = {}) {
+ options = options || {};
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ return internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined);
+}
+function deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {
+ const internalOptions = Object.assign({ allowObjectSmallerThanBufferSize: true, index: 0 }, options);
+ const bufferData = ByteUtils.toLocalBufferType(data);
+ let index = startIndex;
+ for (let i = 0; i < numberOfDocuments; i++) {
+ const size = NumberUtils.getInt32LE(bufferData, index);
+ internalOptions.index = index;
+ documents[docStartIndex + i] = internalDeserialize(bufferData, internalOptions);
+ index = index + size;
+ }
+ return index;
+}
+
+var bson = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ BSONError: BSONError,
+ BSONOffsetError: BSONOffsetError,
+ BSONRegExp: BSONRegExp,
+ BSONRuntimeError: BSONRuntimeError,
+ BSONSymbol: BSONSymbol,
+ BSONType: BSONType,
+ BSONValue: BSONValue,
+ BSONVersionError: BSONVersionError,
+ Binary: Binary,
+ ByteUtils: ByteUtils,
+ Code: Code,
+ DBRef: DBRef,
+ Decimal128: Decimal128,
+ Double: Double,
+ EJSON: EJSON,
+ Int32: Int32,
+ Long: Long,
+ MaxKey: MaxKey,
+ MinKey: MinKey,
+ NumberUtils: NumberUtils,
+ ObjectId: ObjectId,
+ Timestamp: Timestamp,
+ UUID: UUID,
+ bsonType: bsonType,
+ calculateObjectSize: calculateObjectSize,
+ deserialize: deserialize,
+ deserializeStream: deserializeStream,
+ onDemand: onDemand,
+ serialize: serialize,
+ serializeWithBufferAndIndex: serializeWithBufferAndIndex,
+ setInternalBufferSize: setInternalBufferSize
+});
+
+exports.BSON = bson;
+exports.BSONError = BSONError;
+exports.BSONOffsetError = BSONOffsetError;
+exports.BSONRegExp = BSONRegExp;
+exports.BSONRuntimeError = BSONRuntimeError;
+exports.BSONSymbol = BSONSymbol;
+exports.BSONType = BSONType;
+exports.BSONValue = BSONValue;
+exports.BSONVersionError = BSONVersionError;
+exports.Binary = Binary;
+exports.ByteUtils = ByteUtils;
+exports.Code = Code;
+exports.DBRef = DBRef;
+exports.Decimal128 = Decimal128;
+exports.Double = Double;
+exports.EJSON = EJSON;
+exports.Int32 = Int32;
+exports.Long = Long;
+exports.MaxKey = MaxKey;
+exports.MinKey = MinKey;
+exports.NumberUtils = NumberUtils;
+exports.ObjectId = ObjectId;
+exports.Timestamp = Timestamp;
+exports.UUID = UUID;
+exports.bsonType = bsonType;
+exports.calculateObjectSize = calculateObjectSize;
+exports.deserialize = deserialize;
+exports.deserializeStream = deserializeStream;
+exports.onDemand = onDemand;
+exports.serialize = serialize;
+exports.serializeWithBufferAndIndex = serializeWithBufferAndIndex;
+exports.setInternalBufferSize = setInternalBufferSize;
+//# sourceMappingURL=bson.rn.cjs.map
diff --git a/node_modules/bson/lib/bson.rn.cjs.map b/node_modules/bson/lib/bson.rn.cjs.map
new file mode 100644
index 00000000..2044ea55
--- /dev/null
+++ b/node_modules/bson/lib/bson.rn.cjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"bson.rn.cjs","sources":["../src/parser/utils.ts","../src/constants.ts","../src/error.ts","../src/parse_utf8.ts","../src/utils/latin.ts","../src/utils/node_byte_utils.ts","../src/utils/web_byte_utils.ts","../src/utils/byte_utils.ts","../src/bson_value.ts","../src/utils/number_utils.ts","../src/binary.ts","../src/code.ts","../src/db_ref.ts","../src/utils/string_utils.ts","../src/long.ts","../src/decimal128.ts","../src/double.ts","../src/int_32.ts","../src/max_key.ts","../src/min_key.ts","../src/objectid.ts","../src/parser/calculate_size.ts","../src/regexp.ts","../src/symbol.ts","../src/timestamp.ts","../src/parser/deserializer.ts","../src/parser/serializer.ts","../src/extended_json.ts","../src/parser/on_demand/parse_to_elements.ts","../src/parser/on_demand/index.ts","../src/bson.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["StringUtils.validateStringCharacters","StringUtils.removeLeadingZerosAndExplicitPlus","constants.JS_INT_MIN","constants.JS_INT_MAX","constants.BSON_INT32_MIN","constants.BSON_INT32_MAX","constants.BSON_VERSION_SYMBOL","constants.BSON_MAJOR_VERSION","constants.BSON_DATA_STRING","constants.BSON_DATA_OID","constants.BSON_DATA_INT","constants.BSON_DATA_NUMBER","constants.BSON_DATA_DATE","constants.BSON_DATA_BOOLEAN","constants.BSON_DATA_OBJECT","constants.BSON_DATA_ARRAY","constants.BSON_DATA_UNDEFINED","constants.BSON_DATA_NULL","constants.BSON_DATA_LONG","constants.BSON_DATA_DECIMAL128","constants.BSON_DATA_BINARY","constants.BSON_BINARY_SUBTYPE_UUID_NEW","constants.BSON_DATA_REGEXP","constants.BSON_DATA_SYMBOL","constants.BSON_DATA_TIMESTAMP","constants.BSON_DATA_MIN_KEY","constants.BSON_DATA_MAX_KEY","constants.BSON_DATA_CODE","constants.BSON_DATA_CODE_W_SCOPE","constants.BSON_DATA_DBPOINTER","constants.BSON_BINARY_SUBTYPE_DEFAULT"],"mappings":";;AAAA,MAAM,uCAAuC,GAAG,CAAC,MAAK;IAIpD,MAAM,CAAC,GAAG,MAAM,CAAC,wBAAwB,CACvC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAC3C,MAAM,CAAC,WAAW,CAClB,CAAC,GAAI;IAEP,OAAO,CAAC,KAAc,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1C,CAAC,GAAG;AAEE,SAAU,YAAY,CAAC,KAAc,EAAA;AACzC,IAAA,OAAO,uCAAuC,CAAC,KAAK,CAAC,KAAK,YAAY;AACxE;AAEM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,QACE,OAAO,KAAK,KAAK,QAAQ;AACzB,QAAA,KAAK,IAAI,IAAI;QACb,MAAM,CAAC,WAAW,IAAI,KAAK;AAC3B,SAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,aAAa;YAC1C,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,mBAAmB,CAAC;AAExD;AAEM,SAAU,QAAQ,CAAC,MAAe,EAAA;AACtC,IAAA,OAAO,MAAM,YAAY,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,iBAAiB;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cM,SAAU,iBAAiB,CAC/B,IAA8B,EAC9B,UAAkB,EAClB,iBAAyB,EACzB,SAAqB,EACrB,aAAqB,EACrB,OAA2B,EAAA;AAE3B,IAAA,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,EAAE,gCAAgC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,EACpD,OAAO,CACR;IACD,MAAM,UAAU,GAAG,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC;IAEpD,IAAI,KAAK,GAAG,UAAU;AAEtB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,EAAE,CAAC,EAAE,EAAE;QAE1C,MAAM,IAAI,GAAG,WAAW,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC;AAEtD,QAAA,eAAe,CAAC,KAAK,GAAG,KAAK;AAE7B,QAAA,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC,GAAG,mBAAmB,CAAC,UAAU,EAAE,eAAe,CAAC;AAE/E,QAAA,KAAK,GAAG,KAAK,GAAG,IAAI;IACtB;AAGA,IAAA,OAAO,KAAK;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/node_modules/bson/package.json b/node_modules/bson/package.json
new file mode 100644
index 00000000..6b3a39a6
--- /dev/null
+++ b/node_modules/bson/package.json
@@ -0,0 +1,118 @@
+{
+ "name": "bson",
+ "description": "A bson parser for node.js and the browser",
+ "keywords": [
+ "mongodb",
+ "bson",
+ "parser"
+ ],
+ "files": [
+ "lib",
+ "src",
+ "bson.d.ts",
+ "etc/prepare.js",
+ "vendor"
+ ],
+ "types": "bson.d.ts",
+ "version": "7.2.0",
+ "author": {
+ "name": "The MongoDB NodeJS Team",
+ "email": "dbx-node@mongodb.com"
+ },
+ "license": "Apache-2.0",
+ "contributors": [],
+ "repository": "mongodb/js-bson",
+ "bugs": {
+ "url": "https://jira.mongodb.org/projects/NODE/issues/"
+ },
+ "devDependencies": {
+ "@istanbuljs/nyc-config-typescript": "^1.0.2",
+ "@microsoft/api-extractor": "^7.52.5",
+ "@rollup/plugin-node-resolve": "^16.0.1",
+ "@rollup/plugin-typescript": "^12.1.2",
+ "@types/chai": "^4.3.17",
+ "@types/mocha": "^10.0.7",
+ "@types/node": "^24.2.1",
+ "@types/sinon": "^17.0.4",
+ "@types/sinon-chai": "^3.2.12",
+ "@typescript-eslint/eslint-plugin": "^8.31.1",
+ "@typescript-eslint/parser": "^8.31.1",
+ "benchmark": "^2.1.4",
+ "chai": "^4.4.1",
+ "chalk": "^5.3.0",
+ "dbx-js-tools": "github:mongodb-js/dbx-js-tools#main",
+ "eslint": "^9.33.0",
+ "eslint-config-prettier": "^10.1.2",
+ "eslint-plugin-prettier": "^5.2.6",
+ "eslint-plugin-tsdoc": "^0.4.0",
+ "magic-string": "^0.30.11",
+ "mocha": "^11.7.1",
+ "node-fetch": "^3.3.2",
+ "nyc": "^17.1.0",
+ "prettier": "^3.5.3",
+ "rollup": "^4.40.1",
+ "sinon": "^21.0.0",
+ "sinon-chai": "^3.7.0",
+ "source-map-support": "^0.5.21",
+ "tar": "^7.4.3",
+ "ts-node": "^10.9.2",
+ "tsd": "^0.33.0",
+ "typescript": "^5.8.3",
+ "typescript-cached-transpile": "0.0.6",
+ "uuid": "^11.1.0"
+ },
+ "tsd": {
+ "directory": "test/types",
+ "compilerOptions": {
+ "strict": true,
+ "target": "esnext",
+ "module": "commonjs",
+ "moduleResolution": "node"
+ }
+ },
+ "config": {
+ "native": false
+ },
+ "main": "./lib/bson.cjs",
+ "module": "./lib/bson.node.mjs",
+ "exports": {
+ "browser": {
+ "types": "./bson.d.ts",
+ "default": "./lib/bson.mjs"
+ },
+ "react-native": "./lib/bson.rn.cjs",
+ "default": {
+ "types": "./bson.d.ts",
+ "import": "./lib/bson.node.mjs",
+ "require": "./lib/bson.cjs"
+ }
+ },
+ "compass:exports": {
+ "import": "./lib/bson.cjs",
+ "require": "./lib/bson.cjs"
+ },
+ "engines": {
+ "node": ">=20.19.0"
+ },
+ "scripts": {
+ "pretest": "npm run build",
+ "test": "npm run check:node && npm run check:web",
+ "check:node": "WEB=false mocha test/node",
+ "check:tsd": "npm run build:dts && tsd",
+ "check:web": "WEB=true mocha test/node",
+ "check:granular-bench": "npm run build:bench && npm run check:baseline-bench && node ./test/bench/etc/run_granular_benchmarks.js",
+ "check:spec-bench": "npm run build:bench && npm run check:baseline-bench && node ./test/bench/lib/spec/bsonBench.js",
+ "check:custom-bench": "npm run build && npm run check:baseline-bench && node ./test/bench/custom/main.mjs",
+ "check:baseline-bench": "node ./test/bench/etc/cpuBaseline.js",
+ "build:bench": "cd test/bench && npx tsc",
+ "build:ts": "node ./node_modules/typescript/bin/tsc",
+ "build:dts": "npm run build:ts && api-extractor run --typescript-compiler-folder node_modules/typescript --local && node etc/clean_definition_files.cjs",
+ "build:bundle": "rollup -c rollup.config.mjs",
+ "build": "npm run build:dts && npm run build:bundle",
+ "check:lint": "ESLINT_USE_FLAT_CONFIG=false eslint -v && ESLINT_USE_FLAT_CONFIG=false eslint --ext '.js,.ts' --max-warnings=0 src test && npm run build:dts && npm run check:tsd",
+ "format": "ESLINT_USE_FLAT_CONFIG=false eslint --ext '.js,.ts' src test --fix",
+ "check:coverage": "nyc --check-coverage npm run check:node",
+ "prepare": "node etc/prepare.js",
+ "release": "standard-version -i HISTORY.md"
+ }
+}
diff --git a/node_modules/bson/src/binary.ts b/node_modules/bson/src/binary.ts
new file mode 100644
index 00000000..a90d6a72
--- /dev/null
+++ b/node_modules/bson/src/binary.ts
@@ -0,0 +1,751 @@
+import { type InspectFn, defaultInspect, isAnyArrayBuffer, isUint8Array } from './parser/utils';
+import type { EJSONOptions } from './extended_json';
+import { BSONError } from './error';
+import { BSON_BINARY_SUBTYPE_UUID_NEW } from './constants';
+import { ByteUtils } from './utils/byte_utils';
+import { BSONValue } from './bson_value';
+import { NumberUtils } from './utils/number_utils';
+
+/** @public */
+export type BinarySequence = Uint8Array | number[];
+
+/** @public */
+export interface BinaryExtendedLegacy {
+ $type: string;
+ $binary: string;
+}
+
+/** @public */
+export interface BinaryExtended {
+ $binary: {
+ subType: string;
+ base64: string;
+ };
+}
+
+/**
+ * A class representation of the BSON Binary type.
+ * @public
+ * @category BSONType
+ */
+export class Binary extends BSONValue {
+ get _bsontype(): 'Binary' {
+ return 'Binary';
+ }
+
+ /**
+ * Binary default subtype
+ * @internal
+ */
+ private static readonly BSON_BINARY_SUBTYPE_DEFAULT = 0;
+
+ /** Initial buffer default size */
+ static readonly BUFFER_SIZE = 256;
+ /** Default BSON type */
+ static readonly SUBTYPE_DEFAULT = 0;
+ /** Function BSON type */
+ static readonly SUBTYPE_FUNCTION = 1;
+ /**
+ * Legacy default BSON Binary type
+ * @deprecated BSON Binary subtype 2 is deprecated in the BSON specification
+ */
+ static readonly SUBTYPE_BYTE_ARRAY = 2;
+ /** Deprecated UUID BSON type @deprecated Please use SUBTYPE_UUID */
+ static readonly SUBTYPE_UUID_OLD = 3;
+ /** UUID BSON type */
+ static readonly SUBTYPE_UUID = 4;
+ /** MD5 BSON type */
+ static readonly SUBTYPE_MD5 = 5;
+ /** Encrypted BSON type */
+ static readonly SUBTYPE_ENCRYPTED = 6;
+ /** Column BSON type */
+ static readonly SUBTYPE_COLUMN = 7;
+ /** Sensitive BSON type */
+ static readonly SUBTYPE_SENSITIVE = 8;
+ /** Vector BSON type */
+ static readonly SUBTYPE_VECTOR = 9;
+ /** User BSON type */
+ static readonly SUBTYPE_USER_DEFINED = 128;
+
+ /** datatype of a Binary Vector (subtype: 9) */
+ static readonly VECTOR_TYPE = Object.freeze({
+ Int8: 0x03,
+ Float32: 0x27,
+ PackedBit: 0x10
+ } as const);
+
+ /**
+ * The bytes of the Binary value.
+ *
+ * The format of a Binary value in BSON is defined as:
+ * ```txt
+ * binary ::= int32 subtype (byte*)
+ * ```
+ *
+ * This `buffer` is the "(byte*)" segment.
+ *
+ * Unless the value is subtype 2, then deserialize will read the first 4 bytes as an int32 and set this to the remaining bytes.
+ *
+ * ```txt
+ * binary ::= int32 unsigned_byte(2) int32 (byte*)
+ * ```
+ *
+ * @see https://bsonspec.org/spec.html
+ */
+ public buffer: Uint8Array;
+ /**
+ * The binary subtype.
+ *
+ * Current defined values are:
+ *
+ * - `unsigned_byte(0)` Generic binary subtype
+ * - `unsigned_byte(1)` Function
+ * - `unsigned_byte(2)` Binary (Deprecated)
+ * - `unsigned_byte(3)` UUID (Deprecated)
+ * - `unsigned_byte(4)` UUID
+ * - `unsigned_byte(5)` MD5
+ * - `unsigned_byte(6)` Encrypted BSON value
+ * - `unsigned_byte(7)` Compressed BSON column
+ * - `unsigned_byte(8)` Sensitive
+ * - `unsigned_byte(9)` Vector
+ * - `unsigned_byte(128)` - `unsigned_byte(255)` User defined
+ */
+ public sub_type: number;
+ /**
+ * The Binary's `buffer` can be larger than the Binary's content.
+ * This property is used to determine where the content ends in the buffer.
+ */
+ public position: number;
+
+ /**
+ * Create a new Binary instance.
+ * @param buffer - a buffer object containing the binary data.
+ * @param subType - the option binary type.
+ */
+ constructor(buffer?: BinarySequence, subType?: number) {
+ super();
+ if (
+ !(buffer == null) &&
+ typeof buffer === 'string' &&
+ !ArrayBuffer.isView(buffer) &&
+ !isAnyArrayBuffer(buffer) &&
+ !Array.isArray(buffer)
+ ) {
+ throw new BSONError('Binary can only be constructed from Uint8Array or number[]');
+ }
+
+ this.sub_type = subType ?? Binary.BSON_BINARY_SUBTYPE_DEFAULT;
+
+ if (buffer == null) {
+ // create an empty binary buffer
+ this.buffer = ByteUtils.allocate(Binary.BUFFER_SIZE);
+ this.position = 0;
+ } else {
+ this.buffer = Array.isArray(buffer)
+ ? ByteUtils.fromNumberArray(buffer)
+ : ByteUtils.toLocalBufferType(buffer);
+ this.position = this.buffer.byteLength;
+ }
+ }
+
+ /**
+ * Updates this binary with byte_value.
+ *
+ * @param byteValue - a single byte we wish to write.
+ */
+ put(byteValue: string | number | Uint8Array | number[]): void {
+ // If it's a string and a has more than one character throw an error
+ if (typeof byteValue === 'string' && byteValue.length !== 1) {
+ throw new BSONError('only accepts single character String');
+ } else if (typeof byteValue !== 'number' && byteValue.length !== 1)
+ throw new BSONError('only accepts single character Uint8Array or Array');
+
+ // Decode the byte value once
+ let decodedByte: number;
+ if (typeof byteValue === 'string') {
+ decodedByte = byteValue.charCodeAt(0);
+ } else if (typeof byteValue === 'number') {
+ decodedByte = byteValue;
+ } else {
+ decodedByte = byteValue[0];
+ }
+
+ if (decodedByte < 0 || decodedByte > 255) {
+ throw new BSONError('only accepts number in a valid unsigned byte range 0-255');
+ }
+
+ if (this.buffer.byteLength > this.position) {
+ this.buffer[this.position++] = decodedByte;
+ } else {
+ const newSpace = ByteUtils.allocate(Binary.BUFFER_SIZE + this.buffer.length);
+ newSpace.set(this.buffer, 0);
+ this.buffer = newSpace;
+ this.buffer[this.position++] = decodedByte;
+ }
+ }
+
+ /**
+ * Writes a buffer to the binary.
+ *
+ * @param sequence - a string or buffer to be written to the Binary BSON object.
+ * @param offset - specify the binary of where to write the content.
+ */
+ write(sequence: BinarySequence, offset: number): void {
+ offset = typeof offset === 'number' ? offset : this.position;
+
+ // If the buffer is to small let's extend the buffer
+ if (this.buffer.byteLength < offset + sequence.length) {
+ const newSpace = ByteUtils.allocate(this.buffer.byteLength + sequence.length);
+ newSpace.set(this.buffer, 0);
+
+ // Assign the new buffer
+ this.buffer = newSpace;
+ }
+
+ if (ArrayBuffer.isView(sequence)) {
+ this.buffer.set(ByteUtils.toLocalBufferType(sequence), offset);
+ this.position =
+ offset + sequence.byteLength > this.position ? offset + sequence.length : this.position;
+ } else if (typeof sequence === 'string') {
+ throw new BSONError('input cannot be string');
+ }
+ }
+
+ /**
+ * Returns a view of **length** bytes starting at **position**.
+ *
+ * @param position - read from the given position in the Binary.
+ * @param length - the number of bytes to read.
+ */
+ read(position: number, length: number): Uint8Array {
+ length = length && length > 0 ? length : this.position;
+ const end = position + length;
+ return this.buffer.subarray(position, end > this.position ? this.position : end);
+ }
+
+ /** returns a view of the binary value as a Uint8Array */
+ value(): Uint8Array {
+ // Optimize to serialize for the situation where the data == size of buffer
+ return this.buffer.length === this.position
+ ? this.buffer
+ : this.buffer.subarray(0, this.position);
+ }
+
+ /** the length of the binary sequence */
+ length(): number {
+ return this.position;
+ }
+
+ toJSON(): string {
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ }
+
+ toString(encoding?: 'hex' | 'base64' | 'utf8' | 'utf-8'): string {
+ if (encoding === 'hex') return ByteUtils.toHex(this.buffer.subarray(0, this.position));
+ if (encoding === 'base64') return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ if (encoding === 'utf8' || encoding === 'utf-8')
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
+ }
+
+ /** @internal */
+ toExtendedJSON(options?: EJSONOptions): BinaryExtendedLegacy | BinaryExtended {
+ options = options || {};
+
+ if (this.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(this);
+ }
+
+ const base64String = ByteUtils.toBase64(this.buffer);
+
+ const subType = Number(this.sub_type).toString(16);
+ if (options.legacy) {
+ return {
+ $binary: base64String,
+ $type: subType.length === 1 ? '0' + subType : subType
+ };
+ }
+ return {
+ $binary: {
+ base64: base64String,
+ subType: subType.length === 1 ? '0' + subType : subType
+ }
+ };
+ }
+
+ toUUID(): UUID {
+ if (this.sub_type === Binary.SUBTYPE_UUID) {
+ return new UUID(this.buffer.subarray(0, this.position));
+ }
+
+ throw new BSONError(
+ `Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${Binary.SUBTYPE_UUID}" is currently supported.`
+ );
+ }
+
+ /** Creates an Binary instance from a hex digit string */
+ static createFromHexString(hex: string, subType?: number): Binary {
+ return new Binary(ByteUtils.fromHex(hex), subType);
+ }
+
+ /** Creates an Binary instance from a base64 string */
+ static createFromBase64(base64: string, subType?: number): Binary {
+ return new Binary(ByteUtils.fromBase64(base64), subType);
+ }
+
+ /** @internal */
+ static fromExtendedJSON(
+ doc: BinaryExtendedLegacy | BinaryExtended | UUIDExtended,
+ options?: EJSONOptions
+ ): Binary {
+ options = options || {};
+ let data: Uint8Array | undefined;
+ let type;
+ if ('$binary' in doc) {
+ if (options.legacy && typeof doc.$binary === 'string' && '$type' in doc) {
+ type = doc.$type ? parseInt(doc.$type, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary);
+ } else {
+ if (typeof doc.$binary !== 'string') {
+ type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;
+ data = ByteUtils.fromBase64(doc.$binary.base64);
+ }
+ }
+ } else if ('$uuid' in doc) {
+ type = 4;
+ data = UUID.bytesFromString(doc.$uuid);
+ }
+ if (!data) {
+ throw new BSONError(`Unexpected Binary Extended JSON format ${JSON.stringify(doc)}`);
+ }
+ return type === BSON_BINARY_SUBTYPE_UUID_NEW ? new UUID(data) : new Binary(data, type);
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ const base64 = ByteUtils.toBase64(this.buffer.subarray(0, this.position));
+ const base64Arg = inspect(base64, options);
+ const subTypeArg = inspect(this.sub_type, options);
+ return `Binary.createFromBase64(${base64Arg}, ${subTypeArg})`;
+ }
+
+ /**
+ * If this Binary represents a Int8 Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.Int8`),
+ * returns a copy of the bytes in a new Int8Array.
+ *
+ * If the Binary is not a Vector, or the datatype is not Int8, an error is thrown.
+ */
+ public toInt8Array(): Int8Array {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Int8) {
+ throw new BSONError('Binary datatype field is not Int8');
+ }
+
+ validateBinaryVector(this);
+
+ return new Int8Array(
+ this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position)
+ );
+ }
+
+ /**
+ * If this Binary represents a Float32 Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.Float32`),
+ * returns a copy of the bytes in a new Float32Array.
+ *
+ * If the Binary is not a Vector, or the datatype is not Float32, an error is thrown.
+ */
+ public toFloat32Array(): Float32Array {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Float32) {
+ throw new BSONError('Binary datatype field is not Float32');
+ }
+
+ validateBinaryVector(this);
+
+ const floatBytes = new Uint8Array(
+ this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position)
+ );
+
+ if (NumberUtils.isBigEndian) ByteUtils.swap32(floatBytes);
+
+ return new Float32Array(floatBytes.buffer);
+ }
+
+ /**
+ * If this Binary represents packed bit Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit`),
+ * returns a copy of the bytes that are packed bits.
+ *
+ * Use `toBits` to get the unpacked bits.
+ *
+ * If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown.
+ */
+ public toPackedBits(): Uint8Array {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+
+ validateBinaryVector(this);
+
+ return new Uint8Array(
+ this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position)
+ );
+ }
+
+ /**
+ * If this Binary represents a Packed bit Vector (`binary.buffer[0] === Binary.VECTOR_TYPE.PackedBit`),
+ * returns a copy of the bit unpacked into a new Int8Array.
+ *
+ * Use `toPackedBits` to get the bits still in packed form.
+ *
+ * If the Binary is not a Vector, or the datatype is not PackedBit, an error is thrown.
+ */
+ public toBits(): Int8Array {
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
+ throw new BSONError('Binary sub_type is not Vector');
+ }
+
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
+ throw new BSONError('Binary datatype field is not packed bit');
+ }
+
+ validateBinaryVector(this);
+
+ const byteCount = this.length() - 2;
+ const bitCount = byteCount * 8 - this.buffer[1];
+ const bits = new Int8Array(bitCount);
+
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = (bitOffset / 8) | 0;
+ const byte = this.buffer[byteOffset + 2];
+ const shift = 7 - (bitOffset % 8);
+ const bit = (byte >> shift) & 1;
+ bits[bitOffset] = bit;
+ }
+
+ return bits;
+ }
+
+ /**
+ * Constructs a Binary representing an Int8 Vector.
+ * @param array - The array to store as a view on the Binary class
+ */
+ public static fromInt8Array(array: Int8Array): Binary {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.Int8;
+ buffer[1] = 0;
+ const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ buffer.set(intBytes, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+
+ /** Constructs a Binary representing an Float32 Vector. */
+ public static fromFloat32Array(array: Float32Array): Binary {
+ const binaryBytes = ByteUtils.allocate(array.byteLength + 2);
+ binaryBytes[0] = Binary.VECTOR_TYPE.Float32;
+ binaryBytes[1] = 0;
+
+ const floatBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
+ binaryBytes.set(floatBytes, 2);
+
+ if (NumberUtils.isBigEndian) ByteUtils.swap32(new Uint8Array(binaryBytes.buffer, 2));
+
+ const bin = new this(binaryBytes, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+
+ /**
+ * Constructs a Binary representing a packed bit Vector.
+ *
+ * Use `fromBits` to pack an array of 1s and 0s.
+ */
+ public static fromPackedBits(array: Uint8Array, padding = 0): Binary {
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
+ buffer[0] = Binary.VECTOR_TYPE.PackedBit;
+ buffer[1] = padding;
+ buffer.set(array, 2);
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
+ validateBinaryVector(bin);
+ return bin;
+ }
+
+ /**
+ * Constructs a Binary representing an Packed Bit Vector.
+ * @param array - The array of 1s and 0s to pack into the Binary instance
+ */
+ public static fromBits(bits: ArrayLike): Binary {
+ const byteLength = (bits.length + 7) >>> 3; // ceil(bits.length / 8)
+ const bytes = new Uint8Array(byteLength + 2);
+ bytes[0] = Binary.VECTOR_TYPE.PackedBit;
+
+ const remainder = bits.length % 8;
+ bytes[1] = remainder === 0 ? 0 : 8 - remainder;
+
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
+ const byteOffset = bitOffset >>> 3; // floor(bitOffset / 8)
+ const bit = bits[bitOffset];
+
+ if (bit !== 0 && bit !== 1) {
+ throw new BSONError(
+ `Invalid bit value at ${bitOffset}: must be 0 or 1, found ${bits[bitOffset]}`
+ );
+ }
+
+ if (bit === 0) continue;
+
+ const shift = 7 - (bitOffset % 8);
+ bytes[byteOffset + 2] |= bit << shift;
+ }
+
+ return new this(bytes, Binary.SUBTYPE_VECTOR);
+ }
+}
+
+export function validateBinaryVector(vector: Binary): void {
+ if (vector.sub_type !== Binary.SUBTYPE_VECTOR) return;
+
+ const size = vector.position;
+
+ // NOTE: Validation is only applied to **KNOWN** vector types
+ // If a new datatype is introduced, a future version of the library will need to add validation
+ const datatype = vector.buffer[0];
+
+ // NOTE: We do not enable noUncheckedIndexedAccess so TS believes this is always number
+ // a Binary vector may be empty, in which case the padding is undefined
+ // this possible value is tolerable for our validation checks
+ const padding: number | undefined = vector.buffer[1];
+
+ if (
+ (datatype === Binary.VECTOR_TYPE.Float32 || datatype === Binary.VECTOR_TYPE.Int8) &&
+ padding !== 0
+ ) {
+ throw new BSONError('Invalid Vector: padding must be zero for int8 and float32 vectors');
+ }
+
+ if (datatype === Binary.VECTOR_TYPE.Float32) {
+ if (size !== 0 && size - 2 !== 0 && (size - 2) % 4 !== 0) {
+ throw new BSONError('Invalid Vector: Float32 vector must contain a multiple of 4 bytes');
+ }
+ }
+
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding !== 0 && size === 2) {
+ throw new BSONError(
+ 'Invalid Vector: padding must be zero for packed bit vectors that are empty'
+ );
+ }
+
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding > 7) {
+ throw new BSONError(
+ `Invalid Vector: padding must be a value between 0 and 7. found: ${padding}`
+ );
+ }
+}
+
+/** @public */
+export type UUIDExtended = {
+ $uuid: string;
+};
+
+const UUID_BYTE_LENGTH = 16;
+const UUID_WITHOUT_DASHES = /^[0-9A-F]{32}$/i;
+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;
+
+/**
+ * A class representation of the BSON UUID type.
+ * @public
+ */
+export class UUID extends Binary {
+ /**
+ * Create a UUID type
+ *
+ * When the argument to the constructor is omitted a random v4 UUID will be generated.
+ *
+ * @param input - Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer.
+ */
+ constructor(input?: string | Uint8Array | UUID) {
+ let bytes: Uint8Array;
+ if (input == null) {
+ bytes = UUID.generate();
+ } else if (input instanceof UUID) {
+ bytes = ByteUtils.toLocalBufferType(new Uint8Array(input.buffer));
+ } else if (ArrayBuffer.isView(input) && input.byteLength === UUID_BYTE_LENGTH) {
+ bytes = ByteUtils.toLocalBufferType(input);
+ } else if (typeof input === 'string') {
+ bytes = UUID.bytesFromString(input);
+ } else {
+ 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).'
+ );
+ }
+ super(bytes, BSON_BINARY_SUBTYPE_UUID_NEW);
+ }
+
+ /**
+ * The UUID bytes
+ * @readonly
+ */
+ get id(): Uint8Array {
+ return this.buffer;
+ }
+
+ set id(value: Uint8Array) {
+ this.buffer = value;
+ }
+
+ /**
+ * Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)
+ * @param includeDashes - should the string exclude dash-separators.
+ */
+ toHexString(includeDashes = true): string {
+ if (includeDashes) {
+ return [
+ ByteUtils.toHex(this.buffer.subarray(0, 4)),
+ ByteUtils.toHex(this.buffer.subarray(4, 6)),
+ ByteUtils.toHex(this.buffer.subarray(6, 8)),
+ ByteUtils.toHex(this.buffer.subarray(8, 10)),
+ ByteUtils.toHex(this.buffer.subarray(10, 16))
+ ].join('-');
+ }
+ return ByteUtils.toHex(this.buffer);
+ }
+
+ /**
+ * Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified.
+ */
+ toString(encoding?: 'hex' | 'base64'): string {
+ if (encoding === 'hex') return ByteUtils.toHex(this.id);
+ if (encoding === 'base64') return ByteUtils.toBase64(this.id);
+ return this.toHexString();
+ }
+
+ /**
+ * Converts the id into its JSON string representation.
+ * A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ */
+ toJSON(): string {
+ return this.toHexString();
+ }
+
+ /**
+ * Compares the equality of this UUID with `otherID`.
+ *
+ * @param otherId - UUID instance to compare against.
+ */
+ equals(otherId: string | Uint8Array | UUID): boolean {
+ if (!otherId) {
+ return false;
+ }
+
+ if (otherId instanceof UUID) {
+ return ByteUtils.equals(otherId.id, this.id);
+ }
+
+ try {
+ return ByteUtils.equals(new UUID(otherId).id, this.id);
+ } catch {
+ return false;
+ }
+ }
+
+ /**
+ * Creates a Binary instance from the current UUID.
+ */
+ toBinary(): Binary {
+ return new Binary(this.id, Binary.SUBTYPE_UUID);
+ }
+
+ /**
+ * Generates a populated buffer containing a v4 uuid
+ */
+ static generate(): Uint8Array {
+ const bytes = ByteUtils.randomBytes(UUID_BYTE_LENGTH);
+
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
+ // Kindly borrowed from https://github.com/uuidjs/uuid/blob/master/src/v4.js
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
+
+ return bytes;
+ }
+
+ /**
+ * Checks if a value is a valid bson UUID
+ * @param input - UUID, string or Buffer to validate.
+ */
+ static isValid(input: string | Uint8Array | UUID | Binary): boolean {
+ if (!input) {
+ return false;
+ }
+
+ if (typeof input === 'string') {
+ return UUID.isValidUUIDString(input);
+ }
+
+ if (isUint8Array(input)) {
+ return input.byteLength === UUID_BYTE_LENGTH;
+ }
+
+ return (
+ input._bsontype === 'Binary' &&
+ input.sub_type === this.SUBTYPE_UUID &&
+ input.buffer.byteLength === 16
+ );
+ }
+
+ /**
+ * Creates an UUID from a hex string representation of an UUID.
+ * @param hexString - 32 or 36 character hex string (dashes excluded/included).
+ */
+ static override createFromHexString(hexString: string): UUID {
+ const buffer = UUID.bytesFromString(hexString);
+ return new UUID(buffer);
+ }
+
+ /** Creates an UUID from a base64 string representation of an UUID. */
+ static override createFromBase64(base64: string): UUID {
+ return new UUID(ByteUtils.fromBase64(base64));
+ }
+
+ /** @internal */
+ static bytesFromString(representation: string) {
+ if (!UUID.isValidUUIDString(representation)) {
+ throw new BSONError(
+ 'UUID string representation must be 32 hex digits or canonical hyphenated representation'
+ );
+ }
+ return ByteUtils.fromHex(representation.replace(/-/g, ''));
+ }
+
+ /**
+ * @internal
+ *
+ * Validates a string to be a hex digit sequence with or without dashes.
+ * The canonical hyphenated representation of a uuid is hex in 8-4-4-4-12 groups.
+ */
+ static isValidUUIDString(representation: string) {
+ return UUID_WITHOUT_DASHES.test(representation) || UUID_WITH_DASHES.test(representation);
+ }
+
+ /**
+ * Converts to a string representation of this Id.
+ *
+ * @returns return the 36 character hex string representation.
+ *
+ */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ return `new UUID(${inspect(this.toHexString(), options)})`;
+ }
+}
diff --git a/node_modules/bson/src/bson.ts b/node_modules/bson/src/bson.ts
new file mode 100644
index 00000000..3f8562aa
--- /dev/null
+++ b/node_modules/bson/src/bson.ts
@@ -0,0 +1,255 @@
+import { Binary, UUID } from './binary';
+import { Code } from './code';
+import { DBRef } from './db_ref';
+import { Decimal128 } from './decimal128';
+import { Double } from './double';
+import { Int32 } from './int_32';
+import { Long } from './long';
+import { MaxKey } from './max_key';
+import { MinKey } from './min_key';
+import { ObjectId } from './objectid';
+import { internalCalculateObjectSize } from './parser/calculate_size';
+// Parts of the parser
+import { internalDeserialize, type DeserializeOptions } from './parser/deserializer';
+import { serializeInto, type SerializeOptions } from './parser/serializer';
+import { BSONRegExp } from './regexp';
+import { BSONSymbol } from './symbol';
+import { Timestamp } from './timestamp';
+import { ByteUtils } from './utils/byte_utils';
+import { NumberUtils } from './utils/number_utils';
+export type { UUIDExtended, BinaryExtended, BinaryExtendedLegacy, BinarySequence } from './binary';
+export type { CodeExtended } from './code';
+export type { DBRefLike } from './db_ref';
+export type { Decimal128Extended } from './decimal128';
+export type { DoubleExtended } from './double';
+export type {
+ EJSONOptions,
+ EJSONOptionsBase,
+ EJSONSerializeOptions,
+ EJSONParseOptions
+} from './extended_json';
+export type { Int32Extended } from './int_32';
+export type { LongExtended } from './long';
+export type { MaxKeyExtended } from './max_key';
+export type { MinKeyExtended } from './min_key';
+export type { ObjectIdExtended, ObjectIdLike } from './objectid';
+export type { BSONRegExpExtended, BSONRegExpExtendedLegacy } from './regexp';
+export type { BSONSymbolExtended } from './symbol';
+export type { LongWithoutOverrides, TimestampExtended, TimestampOverrides } from './timestamp';
+export type { LongWithoutOverridesClass } from './timestamp';
+export type { SerializeOptions, DeserializeOptions };
+
+export {
+ Code,
+ BSONSymbol,
+ DBRef,
+ Binary,
+ ObjectId,
+ UUID,
+ Long,
+ Timestamp,
+ Double,
+ Int32,
+ MinKey,
+ MaxKey,
+ BSONRegExp,
+ Decimal128,
+ NumberUtils,
+ ByteUtils
+};
+export { BSONValue, bsonType, type BSONTypeTag } from './bson_value';
+export { BSONError, BSONVersionError, BSONRuntimeError, BSONOffsetError } from './error';
+export { BSONType } from './constants';
+export { EJSON } from './extended_json';
+export { onDemand, type OnDemand } from './parser/on_demand/index';
+
+/** @public */
+export interface Document {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ [key: string]: any;
+}
+
+/** @internal */
+// Default Max Size
+const MAXSIZE = 1024 * 1024 * 17;
+
+// Current Internal Temporary Serialization Buffer
+let buffer = ByteUtils.allocate(MAXSIZE);
+
+/**
+ * Sets the size of the internal serialization buffer.
+ *
+ * @param size - The desired size for the internal serialization buffer in bytes
+ * @public
+ */
+export function setInternalBufferSize(size: number): void {
+ // Resize the internal serialization buffer if needed
+ if (buffer.length < size) {
+ buffer = ByteUtils.allocate(size);
+ }
+}
+
+/**
+ * Serialize a Javascript object.
+ *
+ * @param object - the Javascript object to serialize.
+ * @returns Buffer object containing the serialized object.
+ * @public
+ */
+export function serialize(object: Document, options: SerializeOptions = {}): Uint8Array {
+ // Unpack the options
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions =
+ typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined =
+ typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const minInternalBufferSize =
+ typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE;
+
+ // Resize the internal serialization buffer if needed
+ if (buffer.length < minInternalBufferSize) {
+ buffer = ByteUtils.allocate(minInternalBufferSize);
+ }
+
+ // Attempt to serialize
+ const serializationIndex = serializeInto(
+ buffer,
+ object,
+ checkKeys,
+ 0,
+ 0,
+ serializeFunctions,
+ ignoreUndefined,
+ null
+ );
+
+ // Create the final buffer
+ const finishedBuffer = ByteUtils.allocateUnsafe(serializationIndex);
+
+ // Copy into the finished buffer
+ finishedBuffer.set(buffer.subarray(0, serializationIndex), 0);
+
+ // Return the buffer
+ return finishedBuffer;
+}
+
+/**
+ * Serialize a Javascript object using a predefined Buffer and index into the buffer,
+ * useful when pre-allocating the space for serialization.
+ *
+ * @param object - the Javascript object to serialize.
+ * @param finalBuffer - the Buffer you pre-allocated to store the serialized BSON object.
+ * @returns the index pointing to the last written byte in the buffer.
+ * @public
+ */
+export function serializeWithBufferAndIndex(
+ object: Document,
+ finalBuffer: Uint8Array,
+ options: SerializeOptions = {}
+): number {
+ // Unpack the options
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ const serializeFunctions =
+ typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined =
+ typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+ const startIndex = typeof options.index === 'number' ? options.index : 0;
+
+ // Attempt to serialize
+ const serializationIndex = serializeInto(
+ buffer,
+ object,
+ checkKeys,
+ 0,
+ 0,
+ serializeFunctions,
+ ignoreUndefined,
+ null
+ );
+
+ finalBuffer.set(buffer.subarray(0, serializationIndex), startIndex);
+
+ // Return the index
+ return startIndex + serializationIndex - 1;
+}
+
+/**
+ * Deserialize data as BSON.
+ *
+ * @param buffer - the buffer containing the serialized set of BSON documents.
+ * @returns returns the deserialized Javascript Object.
+ * @public
+ */
+export function deserialize(buffer: Uint8Array, options: DeserializeOptions = {}): Document {
+ return internalDeserialize(ByteUtils.toLocalBufferType(buffer), options);
+}
+
+/** @public */
+export type CalculateObjectSizeOptions = Pick<
+ SerializeOptions,
+ 'serializeFunctions' | 'ignoreUndefined'
+>;
+
+/**
+ * Calculate the bson size for a passed in Javascript object.
+ *
+ * @param object - the Javascript object to calculate the BSON byte size for
+ * @returns size of BSON object in bytes
+ * @public
+ */
+export function calculateObjectSize(
+ object: Document,
+ options: CalculateObjectSizeOptions = {}
+): number {
+ options = options || {};
+
+ const serializeFunctions =
+ typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ const ignoreUndefined =
+ typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
+
+ return internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined);
+}
+
+/**
+ * Deserialize stream data as BSON documents.
+ *
+ * @param data - the buffer containing the serialized set of BSON documents.
+ * @param startIndex - the start index in the data Buffer where the deserialization is to start.
+ * @param numberOfDocuments - number of documents to deserialize.
+ * @param documents - an array where to store the deserialized documents.
+ * @param docStartIndex - the index in the documents array from where to start inserting documents.
+ * @param options - additional options used for the deserialization.
+ * @returns next index in the buffer after deserialization **x** numbers of documents.
+ * @public
+ */
+export function deserializeStream(
+ data: Uint8Array | ArrayBuffer,
+ startIndex: number,
+ numberOfDocuments: number,
+ documents: Document[],
+ docStartIndex: number,
+ options: DeserializeOptions
+): number {
+ const internalOptions = Object.assign(
+ { allowObjectSmallerThanBufferSize: true, index: 0 },
+ options
+ );
+ const bufferData = ByteUtils.toLocalBufferType(data);
+
+ let index = startIndex;
+ // Loop over all documents
+ for (let i = 0; i < numberOfDocuments; i++) {
+ // Find size of the document
+ const size = NumberUtils.getInt32LE(bufferData, index);
+ // Update options with index
+ internalOptions.index = index;
+ // Parse the document at this point
+ documents[docStartIndex + i] = internalDeserialize(bufferData, internalOptions);
+ // Adjust index by the document size
+ index = index + size;
+ }
+
+ // Return object containing end index of parsing and list of documents
+ return index;
+}
diff --git a/node_modules/bson/src/bson_value.ts b/node_modules/bson/src/bson_value.ts
new file mode 100644
index 00000000..40432fca
--- /dev/null
+++ b/node_modules/bson/src/bson_value.ts
@@ -0,0 +1,55 @@
+import { BSON_MAJOR_VERSION } from './constants';
+import { type InspectFn } from './parser/utils';
+import { BSON_VERSION_SYMBOL } from './constants';
+
+/** @public */
+export type BSONTypeTag =
+ | 'BSONRegExp'
+ | 'BSONSymbol'
+ | 'ObjectId'
+ | 'Binary'
+ | 'Decimal128'
+ | 'Double'
+ | 'Int32'
+ | 'Long'
+ | 'MaxKey'
+ | 'MinKey'
+ | 'Timestamp'
+ | 'Code'
+ | 'DBRef';
+
+/** @public */
+export const bsonType = Symbol.for('@@mdb.bson.type');
+
+/** @public */
+export abstract class BSONValue {
+ /** @public */
+ public abstract get _bsontype(): BSONTypeTag;
+
+ public get [bsonType](): this['_bsontype'] {
+ return this._bsontype;
+ }
+
+ /** @internal */
+ get [BSON_VERSION_SYMBOL](): typeof BSON_MAJOR_VERSION {
+ return BSON_MAJOR_VERSION;
+ }
+
+ [Symbol.for('nodejs.util.inspect.custom')](
+ depth?: number,
+ options?: unknown,
+ inspect?: InspectFn
+ ): string {
+ return this.inspect(depth, options, inspect);
+ }
+
+ /**
+ * @public
+ * Prints a human-readable string of BSON value information
+ * If invoked manually without node.js.inspect function, this will default to a modified JSON.stringify
+ */
+ public abstract inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
+
+ /** @internal */
+ abstract toExtendedJSON(): unknown;
+}
diff --git a/node_modules/bson/src/code.ts b/node_modules/bson/src/code.ts
new file mode 100644
index 00000000..98b1ede9
--- /dev/null
+++ b/node_modules/bson/src/code.ts
@@ -0,0 +1,69 @@
+import type { Document } from './bson';
+import { BSONValue } from './bson_value';
+import { type InspectFn, defaultInspect } from './parser/utils';
+
+/** @public */
+export interface CodeExtended {
+ $code: string;
+ $scope?: Document;
+}
+
+/**
+ * A class representation of the BSON Code type.
+ * @public
+ * @category BSONType
+ */
+export class Code extends BSONValue {
+ get _bsontype(): 'Code' {
+ return 'Code';
+ }
+
+ code: string;
+
+ // a code instance having a null scope is what determines whether
+ // it is BSONType 0x0D (just code) / 0x0F (code with scope)
+ scope: Document | null;
+
+ /**
+ * @param code - a string or function.
+ * @param scope - an optional scope for the function.
+ */
+ constructor(code: string | Function, scope?: Document | null) {
+ super();
+ this.code = code.toString();
+ this.scope = scope ?? null;
+ }
+
+ toJSON(): { code: string; scope?: Document } {
+ if (this.scope != null) {
+ return { code: this.code, scope: this.scope };
+ }
+
+ return { code: this.code };
+ }
+
+ /** @internal */
+ toExtendedJSON(): CodeExtended {
+ if (this.scope) {
+ return { $code: this.code, $scope: this.scope };
+ }
+
+ return { $code: this.code };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(doc: CodeExtended): Code {
+ return new Code(doc.$code, doc.$scope);
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ let parametersString = inspect(this.code, options);
+ const multiLineFn = parametersString.includes('\n');
+ if (this.scope != null) {
+ parametersString += `,${multiLineFn ? '\n' : ' '}${inspect(this.scope, options)}`;
+ }
+ const endingNewline = multiLineFn && this.scope === null;
+ return `new Code(${multiLineFn ? '\n' : ''}${parametersString}${endingNewline ? '\n' : ''})`;
+ }
+}
diff --git a/node_modules/bson/src/constants.ts b/node_modules/bson/src/constants.ts
new file mode 100644
index 00000000..5751c0ef
--- /dev/null
+++ b/node_modules/bson/src/constants.ts
@@ -0,0 +1,147 @@
+/** @internal */
+export const BSON_MAJOR_VERSION = 7;
+
+/** @internal */
+export const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version');
+
+/** @internal */
+export const BSON_INT32_MAX = 0x7fffffff;
+/** @internal */
+export const BSON_INT32_MIN = -0x80000000;
+/** @internal */
+export const BSON_INT64_MAX = Math.pow(2, 63) - 1;
+/** @internal */
+export const BSON_INT64_MIN = -Math.pow(2, 63);
+
+/**
+ * Any integer up to 2^53 can be precisely represented by a double.
+ * @internal
+ */
+export const JS_INT_MAX = Math.pow(2, 53);
+
+/**
+ * Any integer down to -2^53 can be precisely represented by a double.
+ * @internal
+ */
+export const JS_INT_MIN = -Math.pow(2, 53);
+
+/** Number BSON Type @internal */
+export const BSON_DATA_NUMBER = 1;
+
+/** String BSON Type @internal */
+export const BSON_DATA_STRING = 2;
+
+/** Object BSON Type @internal */
+export const BSON_DATA_OBJECT = 3;
+
+/** Array BSON Type @internal */
+export const BSON_DATA_ARRAY = 4;
+
+/** Binary BSON Type @internal */
+export const BSON_DATA_BINARY = 5;
+
+/** Binary BSON Type @internal */
+export const BSON_DATA_UNDEFINED = 6;
+
+/** ObjectId BSON Type @internal */
+export const BSON_DATA_OID = 7;
+
+/** Boolean BSON Type @internal */
+export const BSON_DATA_BOOLEAN = 8;
+
+/** Date BSON Type @internal */
+export const BSON_DATA_DATE = 9;
+
+/** null BSON Type @internal */
+export const BSON_DATA_NULL = 10;
+
+/** RegExp BSON Type @internal */
+export const BSON_DATA_REGEXP = 11;
+
+/** Code BSON Type @internal */
+export const BSON_DATA_DBPOINTER = 12;
+
+/** Code BSON Type @internal */
+export const BSON_DATA_CODE = 13;
+
+/** Symbol BSON Type @internal */
+export const BSON_DATA_SYMBOL = 14;
+
+/** Code with Scope BSON Type @internal */
+export const BSON_DATA_CODE_W_SCOPE = 15;
+
+/** 32 bit Integer BSON Type @internal */
+export const BSON_DATA_INT = 16;
+
+/** Timestamp BSON Type @internal */
+export const BSON_DATA_TIMESTAMP = 17;
+
+/** Long BSON Type @internal */
+export const BSON_DATA_LONG = 18;
+
+/** Decimal128 BSON Type @internal */
+export const BSON_DATA_DECIMAL128 = 19;
+
+/** MinKey BSON Type @internal */
+export const BSON_DATA_MIN_KEY = 0xff;
+
+/** MaxKey BSON Type @internal */
+export const BSON_DATA_MAX_KEY = 0x7f;
+
+/** Binary Default Type @internal */
+export const BSON_BINARY_SUBTYPE_DEFAULT = 0;
+
+/** Binary Function Type @internal */
+export const BSON_BINARY_SUBTYPE_FUNCTION = 1;
+
+/** Binary Byte Array Type @internal */
+export const BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;
+
+/** Binary Deprecated UUID Type @deprecated Please use BSON_BINARY_SUBTYPE_UUID_NEW @internal */
+export const BSON_BINARY_SUBTYPE_UUID = 3;
+
+/** Binary UUID Type @internal */
+export const BSON_BINARY_SUBTYPE_UUID_NEW = 4;
+
+/** Binary MD5 Type @internal */
+export const BSON_BINARY_SUBTYPE_MD5 = 5;
+
+/** Encrypted BSON type @internal */
+export const BSON_BINARY_SUBTYPE_ENCRYPTED = 6;
+
+/** Column BSON type @internal */
+export const BSON_BINARY_SUBTYPE_COLUMN = 7;
+
+/** Sensitive BSON type @internal */
+export const BSON_BINARY_SUBTYPE_SENSITIVE = 8;
+
+/** Binary User Defined Type @internal */
+export const BSON_BINARY_SUBTYPE_USER_DEFINED = 128;
+
+/** @public */
+export const BSONType = Object.freeze({
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: -1,
+ maxKey: 127
+} as const);
+
+/** @public */
+export type BSONType = (typeof BSONType)[keyof typeof BSONType];
diff --git a/node_modules/bson/src/db_ref.ts b/node_modules/bson/src/db_ref.ts
new file mode 100644
index 00000000..fbb751f8
--- /dev/null
+++ b/node_modules/bson/src/db_ref.ts
@@ -0,0 +1,128 @@
+import type { Document } from './bson';
+import { BSONValue } from './bson_value';
+import type { EJSONOptions } from './extended_json';
+import type { ObjectId } from './objectid';
+import { type InspectFn, defaultInspect } from './parser/utils';
+
+/** @public */
+export interface DBRefLike {
+ $ref: string;
+ $id: ObjectId;
+ $db?: string;
+}
+
+/** @internal */
+export function isDBRefLike(value: unknown): value is DBRefLike {
+ return (
+ value != null &&
+ typeof value === 'object' &&
+ '$id' in value &&
+ value.$id != null &&
+ '$ref' in value &&
+ typeof value.$ref === 'string' &&
+ // If '$db' is defined it MUST be a string, otherwise it should be absent
+ (!('$db' in value) || ('$db' in value && typeof value.$db === 'string'))
+ );
+}
+
+/**
+ * A class representation of the BSON DBRef type.
+ * @public
+ * @category BSONType
+ */
+export class DBRef extends BSONValue {
+ get _bsontype(): 'DBRef' {
+ return 'DBRef';
+ }
+
+ collection!: string;
+ oid!: ObjectId;
+ db?: string;
+ fields!: Document;
+
+ /**
+ * @param collection - the collection name.
+ * @param oid - the reference ObjectId.
+ * @param db - optional db name, if omitted the reference is local to the current db.
+ */
+ constructor(collection: string, oid: ObjectId, db?: string, fields?: Document) {
+ super();
+ // check if namespace has been provided
+ const parts = collection.split('.');
+ if (parts.length === 2) {
+ db = parts.shift();
+ collection = parts.shift()!;
+ }
+
+ this.collection = collection;
+ this.oid = oid;
+ this.db = db;
+ this.fields = fields || {};
+ }
+
+ // Property provided for compatibility with the 1.x parser
+ // the 1.x parser used a "namespace" property, while 4.x uses "collection"
+
+ /** @internal */
+ get namespace(): string {
+ return this.collection;
+ }
+
+ set namespace(value: string) {
+ this.collection = value;
+ }
+
+ toJSON(): DBRefLike & Document {
+ const o = Object.assign(
+ {
+ $ref: this.collection,
+ $id: this.oid
+ },
+ this.fields
+ );
+
+ if (this.db != null) o.$db = this.db;
+ return o;
+ }
+
+ /** @internal */
+ toExtendedJSON(options?: EJSONOptions): DBRefLike {
+ options = options || {};
+ let o: DBRefLike = {
+ $ref: this.collection,
+ $id: this.oid
+ };
+
+ if (options.legacy) {
+ return o;
+ }
+
+ if (this.db) o.$db = this.db;
+ o = Object.assign(o, this.fields);
+ return o;
+ }
+
+ /** @internal */
+ static fromExtendedJSON(doc: DBRefLike): DBRef {
+ const copy = Object.assign({}, doc) as Partial;
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(doc.$ref, doc.$id, doc.$db, copy);
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+
+ const args = [
+ inspect(this.namespace, options),
+ inspect(this.oid, options),
+ ...(this.db ? [inspect(this.db, options)] : []),
+ ...(Object.keys(this.fields).length > 0 ? [inspect(this.fields, options)] : [])
+ ];
+
+ args[1] = inspect === defaultInspect ? `new ObjectId(${args[1]})` : args[1];
+
+ return `new DBRef(${args.join(', ')})`;
+ }
+}
diff --git a/node_modules/bson/src/decimal128.ts b/node_modules/bson/src/decimal128.ts
new file mode 100644
index 00000000..8f491b3c
--- /dev/null
+++ b/node_modules/bson/src/decimal128.ts
@@ -0,0 +1,855 @@
+import { BSONValue } from './bson_value';
+import { BSONError } from './error';
+import { Long } from './long';
+import { type InspectFn, defaultInspect, isUint8Array } from './parser/utils';
+import { ByteUtils } from './utils/byte_utils';
+
+const PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/;
+const PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i;
+const PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i;
+
+const EXPONENT_MAX = 6111;
+const EXPONENT_MIN = -6176;
+const EXPONENT_BIAS = 6176;
+const MAX_DIGITS = 34;
+
+// Nan value bits as 32 bit values (due to lack of longs)
+const NAN_BUFFER = ByteUtils.fromNumberArray(
+ [
+ 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ ].reverse()
+);
+// Infinity value bits 32 bit values (due to lack of longs)
+const INF_NEGATIVE_BUFFER = ByteUtils.fromNumberArray(
+ [
+ 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ ].reverse()
+);
+const INF_POSITIVE_BUFFER = ByteUtils.fromNumberArray(
+ [
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ ].reverse()
+);
+
+const EXPONENT_REGEX = /^([-+])?(\d+)?$/;
+
+// Extract least significant 5 bits
+const COMBINATION_MASK = 0x1f;
+// Extract least significant 14 bits
+const EXPONENT_MASK = 0x3fff;
+// Value of combination field for Inf
+const COMBINATION_INFINITY = 30;
+// Value of combination field for NaN
+const COMBINATION_NAN = 31;
+
+// Detect if the value is a digit
+function isDigit(value: string): boolean {
+ return !isNaN(parseInt(value, 10));
+}
+
+// Divide two uint128 values
+function divideu128(value: { parts: [number, number, number, number] }) {
+ const DIVISOR = Long.fromNumber(1000 * 1000 * 1000);
+ let _rem = Long.fromNumber(0);
+
+ if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) {
+ return { quotient: value, rem: _rem };
+ }
+
+ for (let i = 0; i <= 3; i++) {
+ // Adjust remainder to match value of next dividend
+ _rem = _rem.shiftLeft(32);
+ // Add the divided to _rem
+ _rem = _rem.add(new Long(value.parts[i], 0));
+ value.parts[i] = _rem.div(DIVISOR).low;
+ _rem = _rem.modulo(DIVISOR);
+ }
+
+ return { quotient: value, rem: _rem };
+}
+
+// Multiply two Long values and return the 128 bit value
+function multiply64x2(left: Long, right: Long): { high: Long; low: Long } {
+ if (!left && !right) {
+ return { high: Long.fromNumber(0), low: Long.fromNumber(0) };
+ }
+
+ const leftHigh = left.shiftRightUnsigned(32);
+ const leftLow = new Long(left.getLowBits(), 0);
+ const rightHigh = right.shiftRightUnsigned(32);
+ const rightLow = new Long(right.getLowBits(), 0);
+
+ let productHigh = leftHigh.multiply(rightHigh);
+ let productMid = leftHigh.multiply(rightLow);
+ const productMid2 = leftLow.multiply(rightHigh);
+ let productLow = leftLow.multiply(rightLow);
+
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productMid = new Long(productMid.getLowBits(), 0)
+ .add(productMid2)
+ .add(productLow.shiftRightUnsigned(32));
+
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
+ productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));
+
+ // Return the 128 bit result
+ return { high: productHigh, low: productLow };
+}
+
+function lessThan(left: Long, right: Long): boolean {
+ // Make values unsigned
+ const uhleft = left.high >>> 0;
+ const uhright = right.high >>> 0;
+
+ // Compare high bits first
+ if (uhleft < uhright) {
+ return true;
+ } else if (uhleft === uhright) {
+ const ulleft = left.low >>> 0;
+ const ulright = right.low >>> 0;
+ if (ulleft < ulright) return true;
+ }
+
+ return false;
+}
+
+function invalidErr(string: string, message: string) {
+ throw new BSONError(`"${string}" is not a valid Decimal128 string - ${message}`);
+}
+
+/** @public */
+export interface Decimal128Extended {
+ $numberDecimal: string;
+}
+
+/**
+ * A class representation of the BSON Decimal128 type.
+ * @public
+ * @category BSONType
+ */
+export class Decimal128 extends BSONValue {
+ get _bsontype(): 'Decimal128' {
+ return 'Decimal128';
+ }
+
+ readonly bytes!: Uint8Array;
+
+ /**
+ * @param bytes - a buffer containing the raw Decimal128 bytes in little endian order,
+ * or a string representation as returned by .toString()
+ */
+ constructor(bytes: Uint8Array | string) {
+ super();
+ if (typeof bytes === 'string') {
+ this.bytes = Decimal128.fromString(bytes).bytes;
+ } else if (bytes instanceof Uint8Array || isUint8Array(bytes)) {
+ if (bytes.byteLength !== 16) {
+ throw new BSONError('Decimal128 must take a Buffer of 16 bytes');
+ }
+ this.bytes = bytes;
+ } else {
+ throw new BSONError('Decimal128 must take a Buffer or string');
+ }
+ }
+
+ /**
+ * Create a Decimal128 instance from a string representation
+ *
+ * @param representation - a numeric string representation.
+ */
+ static fromString(representation: string): Decimal128 {
+ return Decimal128._fromString(representation, { allowRounding: false });
+ }
+
+ /**
+ * Create a Decimal128 instance from a string representation, allowing for rounding to 34
+ * significant digits
+ *
+ * @example Example of a number that will be rounded
+ * ```ts
+ * > let d = Decimal128.fromString('37.499999999999999196428571428571375')
+ * Uncaught:
+ * BSONError: "37.499999999999999196428571428571375" is not a valid Decimal128 string - inexact rounding
+ * at invalidErr (/home/wajames/js-bson/lib/bson.cjs:1402:11)
+ * at Decimal128.fromStringInternal (/home/wajames/js-bson/lib/bson.cjs:1633:25)
+ * at Decimal128.fromString (/home/wajames/js-bson/lib/bson.cjs:1424:27)
+ *
+ * > d = Decimal128.fromStringWithRounding('37.499999999999999196428571428571375')
+ * new Decimal128("37.49999999999999919642857142857138")
+ * ```
+ * @param representation - a numeric string representation.
+ */
+ static fromStringWithRounding(representation: string): Decimal128 {
+ return Decimal128._fromString(representation, { allowRounding: true });
+ }
+
+ private static _fromString(representation: string, options: { allowRounding: boolean }) {
+ // Parse state tracking
+ let isNegative = false;
+ let sawSign = false;
+ let sawRadix = false;
+ let foundNonZero = false;
+
+ // Total number of significant digits (no leading or trailing zero)
+ let significantDigits = 0;
+ // Total number of significand digits read
+ let nDigitsRead = 0;
+ // Total number of digits (no leading zeros)
+ let nDigits = 0;
+ // The number of the digits after radix
+ let radixPosition = 0;
+ // The index of the first non-zero in *str*
+ let firstNonZero = 0;
+
+ // Digits Array
+ const digits = [0];
+ // The number of digits in digits
+ let nDigitsStored = 0;
+ // Insertion pointer for digits
+ let digitsInsert = 0;
+ // The index of the last digit
+ let lastDigit = 0;
+
+ // Exponent
+ let exponent = 0;
+ // The high 17 digits of the significand
+ let significandHigh = new Long(0, 0);
+ // The low 17 digits of the significand
+ let significandLow = new Long(0, 0);
+ // The biased exponent
+ let biasedExponent = 0;
+
+ // Read index
+ let index = 0;
+
+ // Naively prevent against REDOS attacks.
+ // TODO: implementing a custom parsing for this, or refactoring the regex would yield
+ // further gains.
+ if (representation.length >= 7000) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+
+ // Results
+ const stringMatch = representation.match(PARSE_STRING_REGEXP);
+ const infMatch = representation.match(PARSE_INF_REGEXP);
+ const nanMatch = representation.match(PARSE_NAN_REGEXP);
+
+ // Validate the string
+ if ((!stringMatch && !infMatch && !nanMatch) || representation.length === 0) {
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+ }
+
+ if (stringMatch) {
+ // full_match = stringMatch[0]
+ // sign = stringMatch[1]
+
+ const unsignedNumber = stringMatch[2];
+ // stringMatch[3] is undefined if a whole number (ex "1", 12")
+ // but defined if a number w/ decimal in it (ex "1.0, 12.2")
+
+ const e = stringMatch[4];
+ const expSign = stringMatch[5];
+ const expNumber = stringMatch[6];
+
+ // they provided e, but didn't give an exponent number. for ex "1e"
+ if (e && expNumber === undefined) invalidErr(representation, 'missing exponent power');
+
+ // they provided e, but didn't give a number before it. for ex "e1"
+ if (e && unsignedNumber === undefined) invalidErr(representation, 'missing exponent base');
+
+ if (e === undefined && (expSign || expNumber)) {
+ invalidErr(representation, 'missing e before exponent');
+ }
+ }
+
+ // Get the negative or positive sign
+ if (representation[index] === '+' || representation[index] === '-') {
+ sawSign = true;
+ isNegative = representation[index++] === '-';
+ }
+
+ // Check if user passed Infinity or NaN
+ if (!isDigit(representation[index]) && representation[index] !== '.') {
+ if (representation[index] === 'i' || representation[index] === 'I') {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ } else if (representation[index] === 'N') {
+ return new Decimal128(NAN_BUFFER);
+ }
+ }
+
+ // Read all the digits
+ while (isDigit(representation[index]) || representation[index] === '.') {
+ if (representation[index] === '.') {
+ if (sawRadix) invalidErr(representation, 'contains multiple periods');
+
+ sawRadix = true;
+ index = index + 1;
+ continue;
+ }
+
+ if (nDigitsStored < MAX_DIGITS) {
+ if (representation[index] !== '0' || foundNonZero) {
+ if (!foundNonZero) {
+ firstNonZero = nDigitsRead;
+ }
+
+ foundNonZero = true;
+
+ // Only store 34 digits
+ digits[digitsInsert++] = parseInt(representation[index], 10);
+ nDigitsStored = nDigitsStored + 1;
+ }
+ }
+
+ if (foundNonZero) nDigits = nDigits + 1;
+ if (sawRadix) radixPosition = radixPosition + 1;
+
+ nDigitsRead = nDigitsRead + 1;
+ index = index + 1;
+ }
+
+ if (sawRadix && !nDigitsRead)
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
+
+ // Read exponent if exists
+ if (representation[index] === 'e' || representation[index] === 'E') {
+ // Read exponent digits
+ const match = representation.substr(++index).match(EXPONENT_REGEX);
+
+ // No digits read
+ if (!match || !match[2]) return new Decimal128(NAN_BUFFER);
+
+ // Get exponent
+ exponent = parseInt(match[0], 10);
+
+ // Adjust the index
+ index = index + match[0].length;
+ }
+
+ // Return not a number
+ if (representation[index]) return new Decimal128(NAN_BUFFER);
+
+ // Done reading input
+ // Find first non-zero digit in digits
+ if (!nDigitsStored) {
+ digits[0] = 0;
+ nDigits = 1;
+ nDigitsStored = 1;
+ significantDigits = 0;
+ } else {
+ lastDigit = nDigitsStored - 1;
+ significantDigits = nDigits;
+ if (significantDigits !== 1) {
+ while (
+ representation[
+ firstNonZero + significantDigits - 1 + Number(sawSign) + Number(sawRadix)
+ ] === '0'
+ ) {
+ significantDigits = significantDigits - 1;
+ }
+ }
+ }
+
+ // Normalization of exponent
+ // Correct exponent based on radix position, and shift significand as needed
+ // to represent user input
+
+ // Overflow prevention
+ if (exponent <= radixPosition && radixPosition > exponent + (1 << 14)) {
+ exponent = EXPONENT_MIN;
+ } else {
+ exponent = exponent - radixPosition;
+ }
+
+ // Attempt to normalize the exponent
+ while (exponent > EXPONENT_MAX) {
+ // Shift exponent to significand and decrease
+ lastDigit = lastDigit + 1;
+ if (lastDigit >= MAX_DIGITS) {
+ // Check if we have a zero then just hard clamp, otherwise fail
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+
+ invalidErr(representation, 'overflow');
+ }
+ exponent = exponent - 1;
+ }
+
+ if (options.allowRounding) {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ // Shift last digit. can only do this if < significant digits than # stored.
+ if (lastDigit === 0 && significantDigits < nDigitsStored) {
+ exponent = EXPONENT_MIN;
+ significantDigits = 0;
+ break;
+ }
+
+ if (nDigitsStored < nDigits) {
+ // adjust to match digits not stored
+ nDigits = nDigits - 1;
+ } else {
+ // adjust to round
+ lastDigit = lastDigit - 1;
+ }
+
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ } else {
+ // Check if we have a zero then just hard clamp, otherwise fail
+ const digitsString = digits.join('');
+ if (digitsString.match(/^0+$/)) {
+ exponent = EXPONENT_MAX;
+ break;
+ }
+ invalidErr(representation, 'overflow');
+ }
+ }
+
+ // Round
+ // We've normalized the exponent, but might still need to round.
+ if (lastDigit + 1 < significantDigits) {
+ let endOfString = nDigitsRead;
+
+ // If we have seen a radix point, 'string' is 1 longer than we have
+ // documented with ndigits_read, so inc the position of the first nonzero
+ // digit and the position that digits are read to.
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+ // if negative, we need to increment again to account for - sign at start.
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ endOfString = endOfString + 1;
+ }
+
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+ let roundBit = 0;
+
+ if (roundDigit >= 5) {
+ roundBit = 1;
+ if (roundDigit === 5) {
+ roundBit = digits[lastDigit] % 2 === 1 ? 1 : 0;
+ for (let i = firstNonZero + lastDigit + 2; i < endOfString; i++) {
+ if (parseInt(representation[i], 10)) {
+ roundBit = 1;
+ break;
+ }
+ }
+ }
+ }
+
+ if (roundBit) {
+ let dIdx = lastDigit;
+
+ for (; dIdx >= 0; dIdx--) {
+ if (++digits[dIdx] > 9) {
+ digits[dIdx] = 0;
+
+ // overflowed most significant digit
+ if (dIdx === 0) {
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ digits[dIdx] = 1;
+ } else {
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
+ }
+ }
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ } else {
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
+ // Shift last digit. can only do this if < significant digits than # stored.
+ if (lastDigit === 0) {
+ if (significantDigits === 0) {
+ exponent = EXPONENT_MIN;
+ break;
+ }
+
+ invalidErr(representation, 'exponent underflow');
+ }
+
+ if (nDigitsStored < nDigits) {
+ if (
+ representation[nDigits - 1 + Number(sawSign) + Number(sawRadix)] !== '0' &&
+ significantDigits !== 0
+ ) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ // adjust to match digits not stored
+ nDigits = nDigits - 1;
+ } else {
+ if (digits[lastDigit] !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ // adjust to round
+ lastDigit = lastDigit - 1;
+ }
+
+ if (exponent < EXPONENT_MAX) {
+ exponent = exponent + 1;
+ } else {
+ invalidErr(representation, 'overflow');
+ }
+ }
+
+ // Round
+ // We've normalized the exponent, but might still need to round.
+ if (lastDigit + 1 < significantDigits) {
+ // If we have seen a radix point, 'string' is 1 longer than we have
+ // documented with ndigits_read, so inc the position of the first nonzero
+ // digit and the position that digits are read to.
+ if (sawRadix) {
+ firstNonZero = firstNonZero + 1;
+ }
+ // if saw sign, we need to increment again to account for - or + sign at start.
+ if (sawSign) {
+ firstNonZero = firstNonZero + 1;
+ }
+
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
+
+ if (roundDigit !== 0) {
+ invalidErr(representation, 'inexact rounding');
+ }
+ }
+ }
+
+ // Encode significand
+ // The high 17 digits of the significand
+ significandHigh = Long.fromNumber(0);
+ // The low 17 digits of the significand
+ significandLow = Long.fromNumber(0);
+
+ // read a zero
+ if (significantDigits === 0) {
+ significandHigh = Long.fromNumber(0);
+ significandLow = Long.fromNumber(0);
+ } else if (lastDigit < 17) {
+ let dIdx = 0;
+ significandLow = Long.fromNumber(digits[dIdx++]);
+ significandHigh = new Long(0, 0);
+
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ } else {
+ let dIdx = 0;
+ significandHigh = Long.fromNumber(digits[dIdx++]);
+
+ for (; dIdx <= lastDigit - 17; dIdx++) {
+ significandHigh = significandHigh.multiply(Long.fromNumber(10));
+ significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));
+ }
+
+ significandLow = Long.fromNumber(digits[dIdx++]);
+
+ for (; dIdx <= lastDigit; dIdx++) {
+ significandLow = significandLow.multiply(Long.fromNumber(10));
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
+ }
+ }
+
+ const significand = multiply64x2(significandHigh, Long.fromString('100000000000000000'));
+ significand.low = significand.low.add(significandLow);
+
+ if (lessThan(significand.low, significandLow)) {
+ significand.high = significand.high.add(Long.fromNumber(1));
+ }
+
+ // Biased exponent
+ biasedExponent = exponent + EXPONENT_BIAS;
+ const dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };
+
+ // Encode combination, exponent, and significand.
+ if (
+ significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1))
+ ) {
+ // Encode '11' into bits 1 to 3
+ dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));
+ dec.high = dec.high.or(
+ Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47))
+ );
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));
+ } else {
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));
+ }
+
+ dec.low = significand.low;
+
+ // Encode sign
+ if (isNegative) {
+ dec.high = dec.high.or(Long.fromString('9223372036854775808'));
+ }
+
+ // Encode into a buffer
+ const buffer = ByteUtils.allocateUnsafe(16);
+ index = 0;
+
+ // Encode the low 64 bits of the decimal
+ // Encode low bits
+ buffer[index++] = dec.low.low & 0xff;
+ buffer[index++] = (dec.low.low >> 8) & 0xff;
+ buffer[index++] = (dec.low.low >> 16) & 0xff;
+ buffer[index++] = (dec.low.low >> 24) & 0xff;
+ // Encode high bits
+ buffer[index++] = dec.low.high & 0xff;
+ buffer[index++] = (dec.low.high >> 8) & 0xff;
+ buffer[index++] = (dec.low.high >> 16) & 0xff;
+ buffer[index++] = (dec.low.high >> 24) & 0xff;
+
+ // Encode the high 64 bits of the decimal
+ // Encode low bits
+ buffer[index++] = dec.high.low & 0xff;
+ buffer[index++] = (dec.high.low >> 8) & 0xff;
+ buffer[index++] = (dec.high.low >> 16) & 0xff;
+ buffer[index++] = (dec.high.low >> 24) & 0xff;
+ // Encode high bits
+ buffer[index++] = dec.high.high & 0xff;
+ buffer[index++] = (dec.high.high >> 8) & 0xff;
+ buffer[index++] = (dec.high.high >> 16) & 0xff;
+ buffer[index++] = (dec.high.high >> 24) & 0xff;
+
+ // Return the new Decimal128
+ return new Decimal128(buffer);
+ }
+ /** Create a string representation of the raw Decimal128 value */
+ toString(): string {
+ // Note: bits in this routine are referred to starting at 0,
+ // from the sign bit, towards the coefficient.
+
+ // decoded biased exponent (14 bits)
+ let biased_exponent;
+ // the number of significand digits
+ let significand_digits = 0;
+ // the base-10 digits in the significand
+ const significand = new Array(36);
+ for (let i = 0; i < significand.length; i++) significand[i] = 0;
+ // read pointer into significand
+ let index = 0;
+
+ // true if the number is zero
+ let is_zero = false;
+
+ // the most significant significand bits (50-46)
+ let significand_msb;
+ // temporary storage for significand decoding
+ let significand128: { parts: [number, number, number, number] } = { parts: [0, 0, 0, 0] };
+ // indexing variables
+ let j, k;
+
+ // Output string
+ const string: string[] = [];
+
+ // Unpack index
+ index = 0;
+
+ // Buffer reference
+ const buffer = this.bytes;
+
+ // Unpack the low 64bits into a long
+ // bits 96 - 127
+ const low =
+ buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ // bits 64 - 95
+ const midl =
+ buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+
+ // Unpack the high 64bits into a long
+ // bits 32 - 63
+ const midh =
+ buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+ // bits 0 - 31
+ const high =
+ buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
+
+ // Unpack index
+ index = 0;
+
+ // Create the state of the decimal
+ const dec = {
+ low: new Long(low, midl),
+ high: new Long(midh, high)
+ };
+
+ if (dec.high.lessThan(Long.ZERO)) {
+ string.push('-');
+ }
+
+ // Decode combination field and exponent
+ // bits 1 - 5
+ const combination = (high >> 26) & COMBINATION_MASK;
+
+ if (combination >> 3 === 3) {
+ // Check for 'special' values
+ if (combination === COMBINATION_INFINITY) {
+ return string.join('') + 'Infinity';
+ } else if (combination === COMBINATION_NAN) {
+ return 'NaN';
+ } else {
+ biased_exponent = (high >> 15) & EXPONENT_MASK;
+ significand_msb = 0x08 + ((high >> 14) & 0x01);
+ }
+ } else {
+ significand_msb = (high >> 14) & 0x07;
+ biased_exponent = (high >> 17) & EXPONENT_MASK;
+ }
+
+ // unbiased exponent
+ const exponent = biased_exponent - EXPONENT_BIAS;
+
+ // Create string of significand digits
+
+ // Convert the 114-bit binary number represented by
+ // (significand_high, significand_low) to at most 34 decimal
+ // digits through modulo and division.
+ significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);
+ significand128.parts[1] = midh;
+ significand128.parts[2] = midl;
+ significand128.parts[3] = low;
+
+ if (
+ significand128.parts[0] === 0 &&
+ significand128.parts[1] === 0 &&
+ significand128.parts[2] === 0 &&
+ significand128.parts[3] === 0
+ ) {
+ is_zero = true;
+ } else {
+ for (k = 3; k >= 0; k--) {
+ let least_digits = 0;
+ // Perform the divide
+ const result = divideu128(significand128);
+ significand128 = result.quotient;
+ least_digits = result.rem.low;
+
+ // We now have the 9 least significant digits (in base 2).
+ // Convert and output to string.
+ if (!least_digits) continue;
+
+ for (j = 8; j >= 0; j--) {
+ // significand[k * 9 + j] = Math.round(least_digits % 10);
+ significand[k * 9 + j] = least_digits % 10;
+ // least_digits = Math.round(least_digits / 10);
+ least_digits = Math.floor(least_digits / 10);
+ }
+ }
+ }
+
+ // Output format options:
+ // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd
+ // Regular - ddd.ddd
+
+ if (is_zero) {
+ significand_digits = 1;
+ significand[index] = 0;
+ } else {
+ significand_digits = 36;
+ while (!significand[index]) {
+ significand_digits = significand_digits - 1;
+ index = index + 1;
+ }
+ }
+
+ // the exponent if scientific notation is used
+ const scientific_exponent = significand_digits - 1 + exponent;
+
+ // The scientific exponent checks are dictated by the string conversion
+ // specification and are somewhat arbitrary cutoffs.
+ //
+ // We must check exponent > 0, because if this is the case, the number
+ // has trailing zeros. However, we *cannot* output these trailing zeros,
+ // because doing so would change the precision of the value, and would
+ // change stored data if the string converted number is round tripped.
+ if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) {
+ // Scientific format
+
+ // if there are too many significant digits, we should just be treating numbers
+ // as + or - 0 and using the non-scientific exponent (this is for the "invalid
+ // representation should be treated as 0/-0" spec cases in decimal128-1.json)
+ if (significand_digits > 34) {
+ string.push(`${0}`);
+ if (exponent > 0) string.push(`E+${exponent}`);
+ else if (exponent < 0) string.push(`E${exponent}`);
+ return string.join('');
+ }
+
+ string.push(`${significand[index++]}`);
+ significand_digits = significand_digits - 1;
+
+ if (significand_digits) {
+ string.push('.');
+ }
+
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+
+ // Exponent
+ string.push('E');
+ if (scientific_exponent > 0) {
+ string.push(`+${scientific_exponent}`);
+ } else {
+ string.push(`${scientific_exponent}`);
+ }
+ } else {
+ // Regular format with no decimal place
+ if (exponent >= 0) {
+ for (let i = 0; i < significand_digits; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ } else {
+ let radix_position = significand_digits + exponent;
+
+ // non-zero digits before radix
+ if (radix_position > 0) {
+ for (let i = 0; i < radix_position; i++) {
+ string.push(`${significand[index++]}`);
+ }
+ } else {
+ string.push('0');
+ }
+
+ string.push('.');
+ // add leading zeros after radix
+ while (radix_position++ < 0) {
+ string.push('0');
+ }
+
+ for (let i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {
+ string.push(`${significand[index++]}`);
+ }
+ }
+ }
+
+ return string.join('');
+ }
+
+ toJSON(): Decimal128Extended {
+ return { $numberDecimal: this.toString() };
+ }
+
+ /** @internal */
+ toExtendedJSON(): Decimal128Extended {
+ return { $numberDecimal: this.toString() };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(doc: Decimal128Extended): Decimal128 {
+ return Decimal128.fromString(doc.$numberDecimal);
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ const d128string = inspect(this.toString(), options);
+ return `new Decimal128(${d128string})`;
+ }
+}
diff --git a/node_modules/bson/src/double.ts b/node_modules/bson/src/double.ts
new file mode 100644
index 00000000..4a3d1298
--- /dev/null
+++ b/node_modules/bson/src/double.ts
@@ -0,0 +1,115 @@
+import { BSONValue } from './bson_value';
+import { BSONError } from './error';
+import type { EJSONOptions } from './extended_json';
+import { type InspectFn, defaultInspect } from './parser/utils';
+
+/** @public */
+export interface DoubleExtended {
+ $numberDouble: string;
+}
+
+/**
+ * A class representation of the BSON Double type.
+ * @public
+ * @category BSONType
+ */
+export class Double extends BSONValue {
+ get _bsontype(): 'Double' {
+ return 'Double';
+ }
+
+ value!: number;
+ /**
+ * Create a Double type
+ *
+ * @param value - the number we want to represent as a double.
+ */
+ constructor(value: number) {
+ super();
+ if ((value as unknown) instanceof Number) {
+ value = value.valueOf();
+ }
+
+ this.value = +value;
+ }
+
+ /**
+ * Attempt to create an double type from string.
+ *
+ * This method will throw a BSONError on any string input that is not representable as a IEEE-754 64-bit double.
+ * Notably, this method will also throw on the following string formats:
+ * - Strings in non-decimal and non-exponential formats (binary, hex, or octal digits)
+ * - Strings with characters other than numeric, floating point, or leading sign characters (Note: 'Infinity', '-Infinity', and 'NaN' input strings are still allowed)
+ * - Strings with leading and/or trailing whitespace
+ *
+ * Strings with leading zeros, however, are also allowed
+ *
+ * @param value - the string we want to represent as a double.
+ */
+ static fromString(value: string): Double {
+ const coercedValue = Number(value);
+
+ if (value === 'NaN') return new Double(NaN);
+ if (value === 'Infinity') return new Double(Infinity);
+ if (value === '-Infinity') return new Double(-Infinity);
+
+ if (!Number.isFinite(coercedValue)) {
+ throw new BSONError(`Input: ${value} is not representable as a Double`);
+ }
+ if (value.trim() !== value) {
+ throw new BSONError(`Input: '${value}' contains whitespace`);
+ }
+ if (value === '') {
+ throw new BSONError(`Input is an empty string`);
+ }
+ if (/[^-0-9.+eE]/.test(value)) {
+ throw new BSONError(`Input: '${value}' is not in decimal or exponential notation`);
+ }
+ return new Double(coercedValue);
+ }
+
+ /**
+ * Access the number value.
+ *
+ * @returns returns the wrapped double number.
+ */
+ valueOf(): number {
+ return this.value;
+ }
+
+ toJSON(): number {
+ return this.value;
+ }
+
+ toString(radix?: number): string {
+ return this.value.toString(radix);
+ }
+
+ /** @internal */
+ toExtendedJSON(options?: EJSONOptions): number | DoubleExtended {
+ if (options && (options.legacy || (options.relaxed && isFinite(this.value)))) {
+ return this.value;
+ }
+
+ if (Object.is(Math.sign(this.value), -0)) {
+ // NOTE: JavaScript has +0 and -0, apparently to model limit calculations. If a user
+ // explicitly provided `-0` then we need to ensure the sign makes it into the output
+ return { $numberDouble: '-0.0' };
+ }
+
+ return {
+ $numberDouble: Number.isInteger(this.value) ? this.value.toFixed(1) : this.value.toString()
+ };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(doc: DoubleExtended, options?: EJSONOptions): number | Double {
+ const doubleValue = parseFloat(doc.$numberDouble);
+ return options && options.relaxed ? doubleValue : new Double(doubleValue);
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ return `new Double(${inspect(this.value, options)})`;
+ }
+}
diff --git a/node_modules/bson/src/error.ts b/node_modules/bson/src/error.ts
new file mode 100644
index 00000000..ef5184a4
--- /dev/null
+++ b/node_modules/bson/src/error.ts
@@ -0,0 +1,105 @@
+import { BSON_MAJOR_VERSION } from './constants';
+
+/**
+ * @public
+ * @category Error
+ *
+ * `BSONError` objects are thrown when BSON encounters an error.
+ *
+ * This is the parent class for all the other errors thrown by this library.
+ */
+export class BSONError extends Error {
+ /**
+ * @internal
+ * The underlying algorithm for isBSONError may change to improve how strict it is
+ * about determining if an input is a BSONError. But it must remain backwards compatible
+ * with previous minors & patches of the current major version.
+ */
+ protected get bsonError(): true {
+ return true;
+ }
+
+ override get name(): string {
+ return 'BSONError';
+ }
+
+ constructor(message: string, options?: { cause?: unknown }) {
+ super(message, options);
+ }
+
+ /**
+ * @public
+ *
+ * All errors thrown from the BSON library inherit from `BSONError`.
+ * This method can assist with determining if an error originates from the BSON library
+ * even if it does not pass an `instanceof` check against this class' constructor.
+ *
+ * @param value - any javascript value that needs type checking
+ */
+ public static isBSONError(value: unknown): value is BSONError {
+ return (
+ value != null &&
+ typeof value === 'object' &&
+ 'bsonError' in value &&
+ value.bsonError === true &&
+ // Do not access the following properties, just check existence
+ 'name' in value &&
+ 'message' in value &&
+ 'stack' in value
+ );
+ }
+}
+
+/**
+ * @public
+ * @category Error
+ */
+export class BSONVersionError extends BSONError {
+ get name(): 'BSONVersionError' {
+ return 'BSONVersionError';
+ }
+
+ constructor() {
+ super(`Unsupported BSON version, bson types must be from bson ${BSON_MAJOR_VERSION}.x.x`);
+ }
+}
+
+/**
+ * @public
+ * @category Error
+ *
+ * An error generated when BSON functions encounter an unexpected input
+ * or reaches an unexpected/invalid internal state
+ *
+ */
+export class BSONRuntimeError extends BSONError {
+ get name(): 'BSONRuntimeError' {
+ return 'BSONRuntimeError';
+ }
+
+ constructor(message: string) {
+ super(message);
+ }
+}
+
+/**
+ * @public
+ * @category Error
+ *
+ * @experimental
+ *
+ * An error generated when BSON bytes are invalid.
+ * Reports the offset the parser was able to reach before encountering the error.
+ */
+export class BSONOffsetError extends BSONError {
+ public get name(): 'BSONOffsetError' {
+ return 'BSONOffsetError';
+ }
+
+ public offset: number;
+
+ constructor(message: string, offset: number, options?: { cause?: unknown }) {
+ super(`${message}. offset: ${offset}`, options);
+ this.offset = offset;
+ }
+}
diff --git a/node_modules/bson/src/extended_json.ts b/node_modules/bson/src/extended_json.ts
new file mode 100644
index 00000000..67850c90
--- /dev/null
+++ b/node_modules/bson/src/extended_json.ts
@@ -0,0 +1,533 @@
+import { Binary } from './binary';
+import type { Document } from './bson';
+import { Code } from './code';
+import {
+ BSON_INT32_MAX,
+ BSON_INT32_MIN,
+ BSON_INT64_MAX,
+ BSON_INT64_MIN,
+ BSON_MAJOR_VERSION,
+ BSON_VERSION_SYMBOL
+} from './constants';
+import { DBRef, isDBRefLike } from './db_ref';
+import { Decimal128 } from './decimal128';
+import { Double } from './double';
+import { BSONError, BSONRuntimeError, BSONVersionError } from './error';
+import { Int32 } from './int_32';
+import { Long } from './long';
+import { MaxKey } from './max_key';
+import { MinKey } from './min_key';
+import { ObjectId } from './objectid';
+import { isDate, isRegExp, isMap } from './parser/utils';
+import { BSONRegExp } from './regexp';
+import { BSONSymbol } from './symbol';
+import { Timestamp } from './timestamp';
+
+/** @public */
+export type EJSONOptionsBase = {
+ /**
+ * Output using the Extended JSON v1 spec
+ * @defaultValue `false`
+ */
+ legacy?: boolean;
+ /**
+ * Enable Extended JSON's `relaxed` mode, which attempts to return native JS types where possible, rather than BSON types
+ * @defaultValue `false`
+ */
+ relaxed?: boolean;
+};
+
+/** @public */
+export type EJSONSerializeOptions = EJSONOptionsBase & {
+ /**
+ * Omits undefined values from the output instead of converting them to null
+ * @defaultValue `false`
+ */
+ ignoreUndefined?: boolean;
+};
+
+/** @public */
+export type EJSONParseOptions = EJSONOptionsBase & {
+ /**
+ * Enable native bigint support
+ * @defaultValue `false`
+ */
+ useBigInt64?: boolean;
+};
+
+/** @public */
+export type EJSONOptions = EJSONSerializeOptions & EJSONParseOptions;
+
+/** @internal */
+type BSONType =
+ | Binary
+ | Code
+ | DBRef
+ | Decimal128
+ | Double
+ | Int32
+ | Long
+ | MaxKey
+ | MinKey
+ | ObjectId
+ | BSONRegExp
+ | BSONSymbol
+ | Timestamp;
+
+function isBSONType(value: unknown): value is BSONType {
+ return (
+ value != null &&
+ typeof value === 'object' &&
+ '_bsontype' in value &&
+ typeof value._bsontype === 'string'
+ );
+}
+
+// all the types where we don't need to do any special processing and can just pass the EJSON
+//straight to type.fromExtendedJSON
+const keysToCodecs = {
+ $oid: ObjectId,
+ $binary: Binary,
+ $uuid: Binary,
+ $symbol: BSONSymbol,
+ $numberInt: Int32,
+ $numberDecimal: Decimal128,
+ $numberDouble: Double,
+ $numberLong: Long,
+ $minKey: MinKey,
+ $maxKey: MaxKey,
+ $regex: BSONRegExp,
+ $regularExpression: BSONRegExp,
+ $timestamp: Timestamp
+} as const;
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function deserializeValue(value: any, options: EJSONOptions = {}) {
+ if (typeof value === 'number') {
+ // TODO(NODE-4377): EJSON js number handling diverges from BSON
+ const in32BitRange = value <= BSON_INT32_MAX && value >= BSON_INT32_MIN;
+ const in64BitRange = value <= BSON_INT64_MAX && value >= BSON_INT64_MIN;
+
+ if (options.relaxed || options.legacy) {
+ return value;
+ }
+
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ // interpret as being of the smallest BSON integer type that can represent the number exactly
+ if (in32BitRange) {
+ return new Int32(value);
+ }
+ if (in64BitRange) {
+ if (options.useBigInt64) {
+ return BigInt(value);
+ }
+ return Long.fromNumber(value);
+ }
+ }
+
+ // If the number is a non-integer or out of integer range, should interpret as BSON Double.
+ return new Double(value);
+ }
+
+ // from here on out we're looking for bson types, so bail if its not an object
+ if (value == null || typeof value !== 'object') return value;
+
+ // upgrade deprecated undefined to null
+ if (value.$undefined) return null;
+
+ const keys = Object.keys(value).filter(
+ k => k.startsWith('$') && value[k] != null
+ ) as (keyof typeof keysToCodecs)[];
+ for (let i = 0; i < keys.length; i++) {
+ const c = keysToCodecs[keys[i]];
+ if (c) return c.fromExtendedJSON(value, options);
+ }
+
+ if (value.$date != null) {
+ const d = value.$date;
+ const date = new Date();
+
+ if (options.legacy) {
+ if (typeof d === 'number') date.setTime(d);
+ else if (typeof d === 'string') date.setTime(Date.parse(d));
+ else if (typeof d === 'bigint') date.setTime(Number(d));
+ else throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ } else {
+ if (typeof d === 'string') date.setTime(Date.parse(d));
+ else if (Long.isLong(d)) date.setTime(d.toNumber());
+ else if (typeof d === 'number' && options.relaxed) date.setTime(d);
+ else if (typeof d === 'bigint') date.setTime(Number(d));
+ else throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
+ }
+ return date;
+ }
+
+ if (value.$code != null) {
+ const copy = Object.assign({}, value);
+ if (value.$scope) {
+ copy.$scope = deserializeValue(value.$scope);
+ }
+
+ return Code.fromExtendedJSON(value);
+ }
+
+ if (isDBRefLike(value) || value.$dbPointer) {
+ const v = value.$ref ? value : value.$dbPointer;
+
+ // we run into this in a "degenerate EJSON" case (with $id and $ref order flipped)
+ // because of the order JSON.parse goes through the document
+ if (v instanceof DBRef) return v;
+
+ const dollarKeys = Object.keys(v).filter(k => k.startsWith('$'));
+ let valid = true;
+ dollarKeys.forEach(k => {
+ if (['$ref', '$id', '$db'].indexOf(k) === -1) valid = false;
+ });
+
+ // only make DBRef if $ keys are all valid
+ if (valid) return DBRef.fromExtendedJSON(v);
+ }
+
+ return value;
+}
+
+type EJSONSerializeInternalOptions = EJSONSerializeOptions & {
+ seenObjects: { obj: unknown; propertyName: string }[];
+};
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function serializeArray(array: any[], options: EJSONSerializeInternalOptions): any[] {
+ return array.map((v: unknown, index: number) => {
+ options.seenObjects.push({ propertyName: `index ${index}`, obj: null });
+ try {
+ return serializeValue(v, options);
+ } finally {
+ options.seenObjects.pop();
+ }
+ });
+}
+
+function getISOString(date: Date) {
+ const isoStr = date.toISOString();
+ // we should only show milliseconds in timestamp if they're non-zero
+ return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';
+}
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function serializeValue(value: any, options: EJSONSerializeInternalOptions): any {
+ if (value instanceof Map || isMap(value)) {
+ const obj: Record = Object.create(null);
+ for (const [k, v] of value) {
+ if (typeof k !== 'string') {
+ throw new BSONError('Can only serialize maps with string keys');
+ }
+ obj[k] = v;
+ }
+
+ return serializeValue(obj, options);
+ }
+
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null) {
+ const index = options.seenObjects.findIndex(entry => entry.obj === value);
+ if (index !== -1) {
+ const props = options.seenObjects.map(entry => entry.propertyName);
+ const leadingPart = props
+ .slice(0, index)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const alreadySeen = props[index];
+ const circularPart =
+ ' -> ' +
+ props
+ .slice(index + 1, props.length - 1)
+ .map(prop => `${prop} -> `)
+ .join('');
+ const current = props[props.length - 1];
+ const leadingSpace = ' '.repeat(leadingPart.length + alreadySeen.length / 2);
+ const dashes = '-'.repeat(
+ circularPart.length + (alreadySeen.length + current.length) / 2 - 1
+ );
+
+ throw new BSONError(
+ 'Converting circular structure to EJSON:\n' +
+ ` ${leadingPart}${alreadySeen}${circularPart}${current}\n` +
+ ` ${leadingSpace}\\${dashes}/`
+ );
+ }
+ options.seenObjects[options.seenObjects.length - 1].obj = value;
+ }
+
+ if (Array.isArray(value)) return serializeArray(value, options);
+
+ if (value === undefined) return options.ignoreUndefined ? undefined : null;
+
+ if (value instanceof Date || isDate(value)) {
+ const dateNum = value.getTime(),
+ // is it in year range 1970-9999?
+ inRange = dateNum > -1 && dateNum < 253402318800000;
+
+ if (options.legacy) {
+ return options.relaxed && inRange
+ ? { $date: value.getTime() }
+ : { $date: getISOString(value) };
+ }
+ return options.relaxed && inRange
+ ? { $date: getISOString(value) }
+ : { $date: { $numberLong: value.getTime().toString() } };
+ }
+
+ if (typeof value === 'number' && (!options.relaxed || !isFinite(value))) {
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
+ // interpret as being of the smallest BSON integer type that can represent the number exactly
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
+ return { $numberInt: value.toString() };
+ }
+ if (value >= BSON_INT64_MIN && value <= BSON_INT64_MAX) {
+ // TODO(NODE-4377): EJSON js number handling diverges from BSON
+ return { $numberLong: value.toString() };
+ }
+ }
+ return { $numberDouble: Object.is(value, -0) ? '-0.0' : value.toString() };
+ }
+
+ if (typeof value === 'bigint') {
+ if (!options.relaxed) {
+ return { $numberLong: BigInt.asIntN(64, value).toString() };
+ }
+ return Number(BigInt.asIntN(64, value));
+ }
+
+ if (value instanceof RegExp || isRegExp(value)) {
+ let flags = value.flags;
+ if (flags === undefined) {
+ const match = value.toString().match(/[gimuy]*$/);
+ if (match) {
+ flags = match[0];
+ }
+ }
+
+ const rx = new BSONRegExp(value.source, flags);
+ return rx.toExtendedJSON(options);
+ }
+
+ if (value != null && typeof value === 'object') return serializeDocument(value, options);
+ return value;
+}
+
+const BSON_TYPE_MAPPINGS = {
+ Binary: (o: Binary) => new Binary(o.value(), o.sub_type),
+ Code: (o: Code) => new Code(o.code, o.scope),
+ DBRef: (o: DBRef) => new DBRef(o.collection || o.namespace, o.oid, o.db, o.fields), // "namespace" for 1.x library backwards compat
+ Decimal128: (o: Decimal128) => new Decimal128(o.bytes),
+ Double: (o: Double) => new Double(o.value),
+ Int32: (o: Int32) => new Int32(o.value),
+ Long: (
+ o: Long & {
+ low_: number;
+ high_: number;
+ unsigned_: boolean | undefined;
+ }
+ ) =>
+ Long.fromBits(
+ // underscore variants for 1.x backwards compatibility
+ o.low != null ? o.low : o.low_,
+ o.low != null ? o.high : o.high_,
+ o.low != null ? o.unsigned : o.unsigned_
+ ),
+ MaxKey: () => new MaxKey(),
+ MinKey: () => new MinKey(),
+ ObjectId: (o: ObjectId) => new ObjectId(o),
+ BSONRegExp: (o: BSONRegExp) => new BSONRegExp(o.pattern, o.options),
+ BSONSymbol: (o: BSONSymbol) => new BSONSymbol(o.value),
+ Timestamp: (o: Timestamp) => Timestamp.fromBits(o.low, o.high)
+} as const;
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function serializeDocument(doc: any, options: EJSONSerializeInternalOptions) {
+ if (doc == null || typeof doc !== 'object') throw new BSONError('not an object instance');
+
+ const bsontype: BSONType['_bsontype'] = doc._bsontype;
+ if (typeof bsontype === 'undefined') {
+ // It's a regular object. Recursively serialize its property values.
+ const _doc: Document = {};
+ for (const name of Object.keys(doc)) {
+ options.seenObjects.push({ propertyName: name, obj: null });
+ try {
+ const value = serializeValue(doc[name], options);
+ if (name === '__proto__') {
+ Object.defineProperty(_doc, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ } else {
+ _doc[name] = value;
+ }
+ } finally {
+ options.seenObjects.pop();
+ }
+ }
+ return _doc;
+ } else if (
+ doc != null &&
+ typeof doc === 'object' &&
+ typeof doc._bsontype === 'string' &&
+ doc[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION
+ ) {
+ throw new BSONVersionError();
+ } else if (isBSONType(doc)) {
+ // the "document" is really just a BSON type object
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ let outDoc: any = doc;
+ if (typeof outDoc.toExtendedJSON !== 'function') {
+ // There's no EJSON serialization function on the object. It's probably an
+ // object created by a previous version of this library (or another library)
+ // that's duck-typing objects to look like they were generated by this library).
+ // Copy the object into this library's version of that type.
+ const mapper = BSON_TYPE_MAPPINGS[doc._bsontype];
+ if (!mapper) {
+ throw new BSONError('Unrecognized or invalid _bsontype: ' + doc._bsontype);
+ }
+ outDoc = mapper(outDoc);
+ }
+
+ // Two BSON types may have nested objects that may need to be serialized too
+ if (bsontype === 'Code' && outDoc.scope) {
+ outDoc = new Code(outDoc.code, serializeValue(outDoc.scope, options));
+ } else if (bsontype === 'DBRef' && outDoc.oid) {
+ outDoc = new DBRef(
+ serializeValue(outDoc.collection, options),
+ serializeValue(outDoc.oid, options),
+ serializeValue(outDoc.db, options),
+ serializeValue(outDoc.fields, options)
+ );
+ }
+
+ return outDoc.toExtendedJSON(options);
+ } else {
+ throw new BSONError('_bsontype must be a string, but was: ' + typeof bsontype);
+ }
+}
+
+/**
+ * Parse an Extended JSON string, constructing the JavaScript value or object described by that
+ * string.
+ *
+ * @example
+ * ```js
+ * const { EJSON } = require('bson');
+ * const text = '{ "int32": { "$numberInt": "10" } }';
+ *
+ * // prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }
+ * console.log(EJSON.parse(text, { relaxed: false }));
+ *
+ * // prints { int32: 10 }
+ * console.log(EJSON.parse(text));
+ * ```
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function parse(text: string, options?: EJSONParseOptions): any {
+ const ejsonOptions = {
+ useBigInt64: options?.useBigInt64 ?? false,
+ relaxed: options?.relaxed ?? true,
+ legacy: options?.legacy ?? false
+ };
+ return JSON.parse(text, (key, value) => {
+ if (key.indexOf('\x00') !== -1) {
+ throw new BSONError(
+ `BSON Document field names cannot contain null bytes, found: ${JSON.stringify(key)}`
+ );
+ }
+ return deserializeValue(value, ejsonOptions);
+ });
+}
+
+/**
+ * Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer
+ * function is specified or optionally including only the specified properties if a replacer array
+ * is specified.
+ *
+ * @param value - The value to convert to extended JSON
+ * @param replacer - A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string
+ * @param space - A String or Number object that's used to insert white space into the output JSON string for readability purposes.
+ * @param options - Optional settings
+ *
+ * @example
+ * ```js
+ * const { EJSON } = require('bson');
+ * const Int32 = require('mongodb').Int32;
+ * const doc = { int32: new Int32(10) };
+ *
+ * // prints '{"int32":{"$numberInt":"10"}}'
+ * console.log(EJSON.stringify(doc, { relaxed: false }));
+ *
+ * // prints '{"int32":10}'
+ * console.log(EJSON.stringify(doc));
+ * ```
+ */
+function stringify(
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ value: any,
+ replacer?:
+ | (number | string)[]
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ | ((this: any, key: string, value: any) => any)
+ | EJSONSerializeOptions,
+ space?: string | number,
+ options?: EJSONSerializeOptions
+): string {
+ if (space != null && typeof space === 'object') {
+ options = space;
+ space = 0;
+ }
+ if (replacer != null && typeof replacer === 'object' && !Array.isArray(replacer)) {
+ options = replacer;
+ replacer = undefined;
+ space = 0;
+ }
+ const serializeOptions = Object.assign({ relaxed: true, legacy: false }, options, {
+ seenObjects: [{ propertyName: '(root)', obj: null }]
+ });
+
+ const doc = serializeValue(value, serializeOptions);
+ return JSON.stringify(doc, replacer as Parameters[1], space);
+}
+
+/**
+ * Serializes an object to an Extended JSON string, and reparse it as a JavaScript object.
+ *
+ * @param value - The object to serialize
+ * @param options - Optional settings passed to the `stringify` function
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function EJSONserialize(value: any, options?: EJSONSerializeOptions): Document {
+ options = options || {};
+ return JSON.parse(stringify(value, options));
+}
+
+/**
+ * Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types
+ *
+ * @param ejson - The Extended JSON object to deserialize
+ * @param options - Optional settings passed to the parse method
+ */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function EJSONdeserialize(ejson: Document, options?: EJSONParseOptions): any {
+ options = options || {};
+ return parse(JSON.stringify(ejson), options);
+}
+
+/** @public */
+const EJSON: {
+ parse: typeof parse;
+ stringify: typeof stringify;
+ serialize: typeof EJSONserialize;
+ deserialize: typeof EJSONdeserialize;
+} = Object.create(null);
+EJSON.parse = parse;
+EJSON.stringify = stringify;
+EJSON.serialize = EJSONserialize;
+EJSON.deserialize = EJSONdeserialize;
+Object.freeze(EJSON);
+export { EJSON };
diff --git a/node_modules/bson/src/index.ts b/node_modules/bson/src/index.ts
new file mode 100644
index 00000000..5ef41575
--- /dev/null
+++ b/node_modules/bson/src/index.ts
@@ -0,0 +1,19 @@
+import * as BSON from './bson';
+
+// Export all named properties from BSON to support
+// import { ObjectId, serialize } from 'bson';
+// const { ObjectId, serialize } = require('bson');
+export * from './bson';
+
+// Export BSON as a namespace to support:
+// import { BSON } from 'bson';
+// const { BSON } = require('bson');
+export { BSON };
+
+// BSON does **NOT** have a default export
+
+// The following will crash in es module environments
+// import BSON from 'bson';
+
+// The following will work as expected, BSON as a namespace of all the APIs (BSON.ObjectId, BSON.serialize)
+// const BSON = require('bson');
diff --git a/node_modules/bson/src/int_32.ts b/node_modules/bson/src/int_32.ts
new file mode 100644
index 00000000..7c95027c
--- /dev/null
+++ b/node_modules/bson/src/int_32.ts
@@ -0,0 +1,101 @@
+import { BSONValue } from './bson_value';
+import { BSON_INT32_MAX, BSON_INT32_MIN } from './constants';
+import { BSONError } from './error';
+import type { EJSONOptions } from './extended_json';
+import { type InspectFn, defaultInspect } from './parser/utils';
+import { removeLeadingZerosAndExplicitPlus } from './utils/string_utils';
+
+/** @public */
+export interface Int32Extended {
+ $numberInt: string;
+}
+
+/**
+ * A class representation of a BSON Int32 type.
+ * @public
+ * @category BSONType
+ */
+export class Int32 extends BSONValue {
+ get _bsontype(): 'Int32' {
+ return 'Int32';
+ }
+
+ value!: number;
+ /**
+ * Create an Int32 type
+ *
+ * @param value - the number we want to represent as an int32.
+ */
+ constructor(value: number | string) {
+ super();
+ if ((value as unknown) instanceof Number) {
+ value = value.valueOf();
+ }
+
+ this.value = +value | 0;
+ }
+
+ /**
+ * Attempt to create an Int32 type from string.
+ *
+ * This method will throw a BSONError on any string input that is not representable as an Int32.
+ * Notably, this method will also throw on the following string formats:
+ * - Strings in non-decimal formats (exponent notation, binary, hex, or octal digits)
+ * - Strings non-numeric and non-leading sign characters (ex: '2.0', '24,000')
+ * - Strings with leading and/or trailing whitespace
+ *
+ * Strings with leading zeros, however, are allowed.
+ *
+ * @param value - the string we want to represent as an int32.
+ */
+ static fromString(value: string): Int32 {
+ const cleanedValue = removeLeadingZerosAndExplicitPlus(value);
+
+ const coercedValue = Number(value);
+
+ if (BSON_INT32_MAX < coercedValue) {
+ throw new BSONError(`Input: '${value}' is larger than the maximum value for Int32`);
+ } else if (BSON_INT32_MIN > coercedValue) {
+ throw new BSONError(`Input: '${value}' is smaller than the minimum value for Int32`);
+ } else if (!Number.isSafeInteger(coercedValue)) {
+ throw new BSONError(`Input: '${value}' is not a safe integer`);
+ } else if (coercedValue.toString() !== cleanedValue) {
+ // catch all case
+ throw new BSONError(`Input: '${value}' is not a valid Int32 string`);
+ }
+ return new Int32(coercedValue);
+ }
+
+ /**
+ * Access the number value.
+ *
+ * @returns returns the wrapped int32 number.
+ */
+ valueOf(): number {
+ return this.value;
+ }
+
+ toString(radix?: number): string {
+ return this.value.toString(radix);
+ }
+
+ toJSON(): number {
+ return this.value;
+ }
+
+ /** @internal */
+ toExtendedJSON(options?: EJSONOptions): number | Int32Extended {
+ if (options && (options.relaxed || options.legacy)) return this.value;
+ return { $numberInt: this.value.toString() };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(doc: Int32Extended, options?: EJSONOptions): number | Int32 {
+ return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new Int32(doc.$numberInt);
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ return `new Int32(${inspect(this.value, options)})`;
+ }
+}
diff --git a/node_modules/bson/src/long.ts b/node_modules/bson/src/long.ts
new file mode 100644
index 00000000..5c93182f
--- /dev/null
+++ b/node_modules/bson/src/long.ts
@@ -0,0 +1,1240 @@
+import { BSONValue } from './bson_value';
+import { BSONError } from './error';
+import type { EJSONOptions } from './extended_json';
+import { type InspectFn, defaultInspect } from './parser/utils';
+import type { Timestamp } from './timestamp';
+import * as StringUtils from './utils/string_utils';
+
+interface LongWASMHelpers {
+ /** Gets the high bits of the last operation performed */
+ get_high(this: void): number;
+ div_u(
+ this: void,
+ lowBits: number,
+ highBits: number,
+ lowBitsDivisor: number,
+ highBitsDivisor: number
+ ): number;
+ div_s(
+ this: void,
+ lowBits: number,
+ highBits: number,
+ lowBitsDivisor: number,
+ highBitsDivisor: number
+ ): number;
+ rem_u(
+ this: void,
+ lowBits: number,
+ highBits: number,
+ lowBitsDivisor: number,
+ highBitsDivisor: number
+ ): number;
+ rem_s(
+ this: void,
+ lowBits: number,
+ highBits: number,
+ lowBitsDivisor: number,
+ highBitsDivisor: number
+ ): number;
+ mul(
+ this: void,
+ lowBits: number,
+ highBits: number,
+ lowBitsMultiplier: number,
+ highBitsMultiplier: number
+ ): number;
+}
+
+/**
+ * wasm optimizations, to do native i64 multiplication and divide
+ */
+let wasm: LongWASMHelpers | undefined = undefined;
+
+/* We do not want to have to include DOM types just for this check */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+declare const WebAssembly: any;
+
+try {
+ wasm = new WebAssembly.Instance(
+ new WebAssembly.Module(
+ // prettier-ignore
+ 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 as unknown as LongWASMHelpers;
+} catch {
+ // no wasm support
+}
+
+const TWO_PWR_16_DBL = 1 << 16;
+const TWO_PWR_24_DBL = 1 << 24;
+const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+const TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+const TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+
+/** A cache of the Long representations of small integer values. */
+const INT_CACHE: { [key: number]: Long } = {};
+
+/** A cache of the Long representations of small unsigned integer values. */
+const UINT_CACHE: { [key: number]: Long } = {};
+
+const MAX_INT64_STRING_LENGTH = 20;
+
+const DECIMAL_REG_EX = /^(\+?0|(\+|-)?[1-9][0-9]*)$/;
+
+/** @public */
+export interface LongExtended {
+ $numberLong: string;
+}
+
+/**
+ * A class representing a 64-bit integer
+ * @public
+ * @category BSONType
+ * @remarks
+ * The internal representation of a long is the two given signed, 32-bit values.
+ * We use 32-bit pieces because these are the size of integers on which
+ * Javascript performs bit-operations. For operations like addition and
+ * multiplication, we split each number into 16 bit pieces, which can easily be
+ * multiplied within Javascript's floating-point representation without overflow
+ * or change in sign.
+ * In the algorithms below, we frequently reduce the negative case to the
+ * positive case by negating the input(s) and then post-processing the result.
+ * Note that we must ALWAYS check specially whether those values are MIN_VALUE
+ * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
+ * a positive number, it overflows back into a negative). Not handling this
+ * case would often result in infinite recursion.
+ * Common constant values ZERO, ONE, NEG_ONE, etc. are found as static properties on this class.
+ */
+export class Long extends BSONValue {
+ get _bsontype(): 'Long' {
+ return 'Long';
+ }
+
+ /** An indicator used to reliably determine if an object is a Long or not. */
+ get __isLong__(): boolean {
+ return true;
+ }
+
+ /**
+ * The high 32 bits as a signed value.
+ */
+ high: number;
+
+ /**
+ * The low 32 bits as a signed value.
+ */
+ low: number;
+
+ /**
+ * Whether unsigned or not.
+ */
+ unsigned: boolean;
+
+ /**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
+ *
+ * @param low - The low (signed) 32 bits of the long
+ * @param high - The high (signed) 32 bits of the long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ */
+ constructor(low: number, high?: number, unsigned?: boolean);
+ /**
+ * Constructs a 64 bit two's-complement integer, given a bigint representation.
+ *
+ * @param value - BigInt representation of the long value
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ */
+ constructor(value: bigint, unsigned?: boolean);
+ /**
+ * Constructs a 64 bit two's-complement integer, given a string representation.
+ *
+ * @param value - String representation of the long value
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ */
+ constructor(value: string, unsigned?: boolean);
+ constructor(
+ lowOrValue: number | bigint | string = 0,
+ highOrUnsigned?: number | boolean,
+ unsigned?: boolean
+ ) {
+ super();
+ const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
+ const high = typeof highOrUnsigned === 'number' ? highOrUnsigned : 0;
+ const res =
+ typeof lowOrValue === 'string'
+ ? Long.fromString(lowOrValue, unsignedBool)
+ : typeof lowOrValue === 'bigint'
+ ? Long.fromBigInt(lowOrValue, unsignedBool)
+ : { low: lowOrValue | 0, high: high | 0, unsigned: unsignedBool };
+ this.low = res.low;
+ this.high = res.high;
+ this.unsigned = res.unsigned;
+ }
+
+ static TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
+
+ /** Maximum unsigned value. */
+ static MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true);
+ /** Signed zero */
+ static ZERO = Long.fromInt(0);
+ /** Unsigned zero. */
+ static UZERO = Long.fromInt(0, true);
+ /** Signed one. */
+ static ONE = Long.fromInt(1);
+ /** Unsigned one. */
+ static UONE = Long.fromInt(1, true);
+ /** Signed negative one. */
+ static NEG_ONE = Long.fromInt(-1);
+ /** Maximum signed value. */
+ static MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
+ /** Minimum signed value. */
+ static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false);
+
+ /**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits.
+ * Each is assumed to use 32 bits.
+ * @param lowBits - The low 32 bits
+ * @param highBits - The high 32 bits
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long {
+ return new Long(lowBits, highBits, unsigned);
+ }
+
+ /**
+ * Returns a Long representing the given 32 bit integer value.
+ * @param value - The 32 bit integer in question
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromInt(value: number, unsigned?: boolean): Long {
+ let obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if ((cache = 0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj) return cachedObj;
+ }
+ obj = Long.fromBits(value, (value | 0) < 0 ? -1 : 0, true);
+ if (cache) UINT_CACHE[value] = obj;
+ return obj;
+ } else {
+ value |= 0;
+ if ((cache = -128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj) return cachedObj;
+ }
+ obj = Long.fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache) INT_CACHE[value] = obj;
+ return obj;
+ }
+ }
+
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ * @param value - The number in question
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromNumber(value: number, unsigned?: boolean): Long {
+ if (isNaN(value)) return unsigned ? Long.UZERO : Long.ZERO;
+ if (unsigned) {
+ if (value < 0) return Long.UZERO;
+ if (value >= TWO_PWR_64_DBL) return Long.MAX_UNSIGNED_VALUE;
+ } else {
+ if (value <= -TWO_PWR_63_DBL) return Long.MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL) return Long.MAX_VALUE;
+ }
+ if (value < 0) return Long.fromNumber(-value, unsigned).neg();
+ return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
+ }
+
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ * @param value - The number in question
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromBigInt(value: bigint, unsigned?: boolean): Long {
+ const FROM_BIGINT_BIT_MASK = 0xffffffffn;
+ const FROM_BIGINT_BIT_SHIFT = 32n;
+ return new Long(
+ Number(value & FROM_BIGINT_BIT_MASK),
+ Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK),
+ unsigned
+ );
+ }
+
+ /**
+ * @internal
+ * Returns a Long representation of the given string, written using the specified radix.
+ * Throws an error if `throwsError` is set to true and any of the following conditions are true:
+ * - the string contains invalid characters for the given radix
+ * - the string contains whitespace
+ * @param str - The textual representation of the Long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ * @returns The corresponding Long value
+ */
+ private static _fromString(str: string, unsigned: boolean, radix: number): Long {
+ if (str.length === 0) throw new BSONError('empty string');
+ if (radix < 2 || 36 < radix) throw new BSONError('radix');
+
+ let p;
+ if ((p = str.indexOf('-')) > 0) throw new BSONError('interior hyphen');
+ else if (p === 0) {
+ return Long._fromString(str.substring(1), unsigned, radix).neg();
+ }
+
+ // Do several (8) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ const radixToPower = Long.fromNumber(Math.pow(radix, 8));
+
+ let result = Long.ZERO;
+ for (let i = 0; i < str.length; i += 8) {
+ const size = Math.min(8, str.length - i),
+ value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ const power = Long.fromNumber(Math.pow(radix, size));
+ result = result.mul(power).add(Long.fromNumber(value));
+ } else {
+ result = result.mul(radixToPower);
+ result = result.add(Long.fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+ }
+
+ /**
+ * Returns a signed Long representation of the given string, written using radix 10.
+ * Will throw an error if the given text is not exactly representable as a Long.
+ * Throws an error if any of the following conditions are true:
+ * - the string contains invalid characters for the radix 10
+ * - the string contains whitespace
+ * - the value the string represents is too large or too small to be a Long
+ * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero
+ * @param str - The textual representation of the Long
+ * @returns The corresponding Long value
+ */
+ static fromStringStrict(str: string): Long;
+ /**
+ * Returns a Long representation of the given string, written using the radix 10.
+ * Will throw an error if the given parameters are not exactly representable as a Long.
+ * Throws an error if any of the following conditions are true:
+ * - the string contains invalid characters for the given radix
+ * - the string contains whitespace
+ * - the value the string represents is too large or too small to be a Long
+ * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero
+ * @param str - The textual representation of the Long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromStringStrict(str: string, unsigned?: boolean): Long;
+ /**
+ * Returns a signed Long representation of the given string, written using the specified radix.
+ * Will throw an error if the given parameters are not exactly representable as a Long.
+ * Throws an error if any of the following conditions are true:
+ * - the string contains invalid characters for the given radix
+ * - the string contains whitespace
+ * - the value the string represents is too large or too small to be a Long
+ * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero
+ * @param str - The textual representation of the Long
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ * @returns The corresponding Long value
+ */
+ static fromStringStrict(str: string, radix?: boolean): Long;
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ * Will throw an error if the given parameters are not exactly representable as a Long.
+ * Throws an error if any of the following conditions are true:
+ * - the string contains invalid characters for the given radix
+ * - the string contains whitespace
+ * - the value the string represents is too large or too small to be a Long
+ * Unlike Long.fromString, this method does not coerce '+/-Infinity' and 'NaN' to Long.Zero
+ * @param str - The textual representation of the Long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ * @returns The corresponding Long value
+ */
+ static fromStringStrict(str: string, unsigned?: boolean, radix?: number): Long;
+ static fromStringStrict(str: string, unsignedOrRadix?: boolean | number, radix?: number): Long {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ // For goog.math.long compatibility
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ } else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+
+ if (str.trim() !== str) {
+ throw new BSONError(`Input: '${str}' contains leading and/or trailing whitespace`);
+ }
+ if (!StringUtils.validateStringCharacters(str, radix)) {
+ throw new BSONError(`Input: '${str}' contains invalid characters for radix: ${radix}`);
+ }
+
+ // remove leading zeros (for later string comparison and to make math faster)
+ const cleanedStr = StringUtils.removeLeadingZerosAndExplicitPlus(str);
+
+ // check roundtrip result
+ const result = Long._fromString(cleanedStr, unsigned, radix);
+ if (result.toString(radix).toLowerCase() !== cleanedStr.toLowerCase()) {
+ throw new BSONError(
+ `Input: ${str} is not representable as ${result.unsigned ? 'an unsigned' : 'a signed'} 64-bit Long ${radix != null ? `with radix: ${radix}` : ''}`
+ );
+ }
+ return result;
+ }
+
+ /**
+ * Returns a signed Long representation of the given string, written using radix 10.
+ *
+ * If the input string is empty, this function will throw a BSONError.
+ *
+ * If input string does not have valid signed 64-bit Long representation, this method will return a coerced value:
+ * - inputs that overflow 64-bit signed long will be coerced to Long.MAX_VALUE and Long.MIN_VALUE respectively
+ * - 'NaN' or '+/-Infinity' are coerced to Long.ZERO
+ * - other invalid characters sequences have variable behavior
+ *
+ * @param str - The textual representation of the Long
+ * @returns The corresponding Long value
+ */
+ static fromString(str: string): Long;
+ /**
+ * Returns a signed Long representation of the given string, written using the provided radix.
+ *
+ * If the input string is empty or a provided radix is not within (2-36), this function will throw a BSONError.
+ *
+ * If input parameters do not have valid signed 64-bit Long representation, this method will return a coerced value:
+ * - inputs that overflow 64-bit signed long will be coerced to Long.MAX_VALUE and Long.MIN_VALUE respectively
+ * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO
+ * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO
+ * - other invalid characters sequences have variable behavior
+ * @param str - The textual representation of the Long
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ * @returns The corresponding Long value
+ */
+ static fromString(str: string, radix?: number): Long;
+ /**
+ * Returns a Long representation of the given string, written using radix 10.
+ *
+ * If the input string is empty, this function will throw a BSONError.
+ *
+ * If input parameters do not have a valid 64-bit Long representation, this method will return a coerced value:
+ * - inputs that overflow 64-bit long will be coerced to max or min (if signed) values
+ * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO
+ * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO
+ * - other invalid characters sequences have variable behavior
+ * @param str - The textual representation of the Long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromString(str: string, unsigned?: boolean): Long;
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ *
+ * If the input string is empty or a provided radix is not within (2-36), this function will throw a BSONError.
+ *
+ * If input parameters do not have a valid 64-bit Long representation, this method will return a coerced value:
+ * - inputs that overflow 64-bit long will be coerced to max or min (if signed) values
+ * - if the radix is less than 24, 'NaN' is coerced to Long.ZERO
+ * - if the radix is less than 35, '+/-Infinity' inputs are coerced to Long.ZERO
+ * - other invalid characters sequences have variable behavior
+ * @param str - The textual representation of the Long
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ * @returns The corresponding Long value
+ */
+ static fromString(str: string, unsigned?: boolean, radix?: number): Long;
+ static fromString(str: string, unsignedOrRadix?: boolean | number, radix?: number): Long {
+ let unsigned = false;
+ if (typeof unsignedOrRadix === 'number') {
+ // For goog.math.long compatibility
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
+ } else {
+ unsigned = !!unsignedOrRadix;
+ }
+ radix ??= 10;
+ if (str === 'NaN' && radix < 24) {
+ // radix does not support n, so coerce to zero
+ return Long.ZERO;
+ } else if ((str === 'Infinity' || str === '+Infinity' || str === '-Infinity') && radix < 35) {
+ // radix does not support y, so coerce to zero
+ return Long.ZERO;
+ }
+ return Long._fromString(str, unsigned, radix);
+ }
+
+ /**
+ * Creates a Long from its byte representation.
+ * @param bytes - Byte representation
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @param le - Whether little or big endian, defaults to big endian
+ * @returns The corresponding Long value
+ */
+ static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long {
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
+ }
+
+ /**
+ * Creates a Long from its little endian byte representation.
+ * @param bytes - Little endian byte representation
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromBytesLE(bytes: number[], unsigned?: boolean): Long {
+ 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
+ );
+ }
+
+ /**
+ * Creates a Long from its big endian byte representation.
+ * @param bytes - Big endian byte representation
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ * @returns The corresponding Long value
+ */
+ static fromBytesBE(bytes: number[], unsigned?: boolean): Long {
+ 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
+ );
+ }
+
+ /**
+ * Tests if the specified object is a Long.
+ */
+ static isLong(value: unknown): value is Long {
+ return (
+ value != null &&
+ typeof value === 'object' &&
+ '__isLong__' in value &&
+ value.__isLong__ === true
+ );
+ }
+
+ /**
+ * Converts the specified value to a Long.
+ * @param unsigned - Whether unsigned or not, defaults to signed
+ */
+ static fromValue(
+ val: number | string | { low: number; high: number; unsigned?: boolean },
+ unsigned?: boolean
+ ): Long {
+ if (typeof val === 'number') return Long.fromNumber(val, unsigned);
+ if (typeof val === 'string') return Long.fromString(val, unsigned);
+ // Throws for non-objects, converts non-instanceof Long:
+ return Long.fromBits(
+ val.low,
+ val.high,
+ typeof unsigned === 'boolean' ? unsigned : val.unsigned
+ );
+ }
+
+ /** Returns the sum of this and the specified Long. */
+ add(addend: string | number | Long | Timestamp): Long {
+ if (!Long.isLong(addend)) addend = Long.fromValue(addend);
+
+ // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
+
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+
+ const b48 = addend.high >>> 16;
+ const b32 = addend.high & 0xffff;
+ const b16 = addend.low >>> 16;
+ const b00 = addend.low & 0xffff;
+
+ let c48 = 0,
+ c32 = 0,
+ c16 = 0,
+ c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 + b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+
+ /**
+ * Returns the sum of this and the specified Long.
+ * @returns Sum
+ */
+ and(other: string | number | Long | Timestamp): Long {
+ if (!Long.isLong(other)) other = Long.fromValue(other);
+ return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+ }
+
+ /**
+ * Compares this Long's value with the specified's.
+ * @returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
+ */
+ compare(other: string | number | Long | Timestamp): 0 | 1 | -1 {
+ if (!Long.isLong(other)) other = Long.fromValue(other);
+ if (this.eq(other)) return 0;
+ const thisNeg = this.isNegative(),
+ otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg) return -1;
+ if (!thisNeg && otherNeg) return 1;
+ // At this point the sign bits are the same
+ if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1;
+ // Both are positive if at least one is unsigned
+ return other.high >>> 0 > this.high >>> 0 ||
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
+ ? -1
+ : 1;
+ }
+
+ /** This is an alias of {@link Long.compare} */
+ comp(other: string | number | Long | Timestamp): 0 | 1 | -1 {
+ return this.compare(other);
+ }
+
+ /**
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned.
+ * @returns Quotient
+ */
+ divide(divisor: string | number | Long | Timestamp): Long {
+ if (!Long.isLong(divisor)) divisor = Long.fromValue(divisor);
+ if (divisor.isZero()) throw new BSONError('division by zero');
+
+ // use wasm support if present
+ if (wasm) {
+ // guard against signed division overflow: the largest
+ // negative number / -1 would be 1 larger than the largest
+ // positive number, due to two's complement.
+ if (
+ !this.unsigned &&
+ this.high === -0x80000000 &&
+ divisor.low === -1 &&
+ divisor.high === -1
+ ) {
+ // be consistent with non-wasm code path
+ return this;
+ }
+ const low = (this.unsigned ? wasm.div_u : wasm.div_s)(
+ this.low,
+ this.high,
+ divisor.low,
+ divisor.high
+ );
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+
+ if (this.isZero()) return this.unsigned ? Long.UZERO : Long.ZERO;
+ let approx, rem, res;
+ if (!this.unsigned) {
+ // This section is only relevant for signed longs and is derived from the
+ // closure library as a whole.
+ if (this.eq(Long.MIN_VALUE)) {
+ if (divisor.eq(Long.ONE) || divisor.eq(Long.NEG_ONE)) return Long.MIN_VALUE;
+ // recall that -MIN_VALUE == MIN_VALUE
+ else if (divisor.eq(Long.MIN_VALUE)) return Long.ONE;
+ else {
+ // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
+ const halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(Long.ZERO)) {
+ return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
+ } else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ } else if (divisor.eq(Long.MIN_VALUE)) return this.unsigned ? Long.UZERO : Long.ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative()) return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ } else if (divisor.isNegative()) return this.div(divisor.neg()).neg();
+ res = Long.ZERO;
+ } else {
+ // The algorithm below has not been made for unsigned longs. It's therefore
+ // required to take special care of the MSB prior to running it.
+ if (!divisor.unsigned) divisor = divisor.toUnsigned();
+ if (divisor.gt(this)) return Long.UZERO;
+ if (divisor.gt(this.shru(1)))
+ // 15 >>> 1 = 7 ; with divisor = 8 ; true
+ return Long.UONE;
+ res = Long.UZERO;
+ }
+
+ // Repeat the following until the remainder is less than other: find a
+ // floating-point that approximates remainder / other *from below*, add this
+ // into the result, and subtract it from the remainder. It is critical that
+ // the approximate value is less than or equal to the real value so that the
+ // remainder never becomes negative.
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
+ rem = this;
+ while (rem.gte(divisor)) {
+ // Approximate the result of division. This may be a little greater or
+ // smaller than the actual value.
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+
+ // We will tweak the approximate result by changing it in the 48-th digit or
+ // the smallest non-fractional digit, whichever is larger.
+ const log2 = Math.ceil(Math.log(approx) / Math.LN2);
+ const delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);
+ // Decrease the approximation until it is smaller than the remainder. Note
+ // that if it is too large, the product overflows and is negative.
+ let approxRes = Long.fromNumber(approx);
+ let approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = Long.fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+
+ // We know the answer can't be zero... and actually, zero would cause
+ // infinite recursion since we would make no progress.
+ if (approxRes.isZero()) approxRes = Long.ONE;
+
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+ }
+
+ /**This is an alias of {@link Long.divide} */
+ div(divisor: string | number | Long | Timestamp): Long {
+ return this.divide(divisor);
+ }
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ * @param other - Other value
+ */
+ equals(other: string | number | Long | Timestamp): boolean {
+ if (!Long.isLong(other)) other = Long.fromValue(other);
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
+ return false;
+ return this.high === other.high && this.low === other.low;
+ }
+
+ /** This is an alias of {@link Long.equals} */
+ eq(other: string | number | Long | Timestamp): boolean {
+ return this.equals(other);
+ }
+
+ /** Gets the high 32 bits as a signed integer. */
+ getHighBits(): number {
+ return this.high;
+ }
+
+ /** Gets the high 32 bits as an unsigned integer. */
+ getHighBitsUnsigned(): number {
+ return this.high >>> 0;
+ }
+
+ /** Gets the low 32 bits as a signed integer. */
+ getLowBits(): number {
+ return this.low;
+ }
+
+ /** Gets the low 32 bits as an unsigned integer. */
+ getLowBitsUnsigned(): number {
+ return this.low >>> 0;
+ }
+
+ /** Gets the number of bits needed to represent the absolute value of this Long. */
+ getNumBitsAbs(): number {
+ if (this.isNegative()) {
+ // Unsigned Longs are never negative
+ return this.eq(Long.MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ }
+ const val = this.high !== 0 ? this.high : this.low;
+ let bit: number;
+ for (bit = 31; bit > 0; bit--) if ((val & (1 << bit)) !== 0) break;
+ return this.high !== 0 ? bit + 33 : bit + 1;
+ }
+
+ /** Tests if this Long's value is greater than the specified's. */
+ greaterThan(other: string | number | Long | Timestamp): boolean {
+ return this.comp(other) > 0;
+ }
+
+ /** This is an alias of {@link Long.greaterThan} */
+ gt(other: string | number | Long | Timestamp): boolean {
+ return this.greaterThan(other);
+ }
+
+ /** Tests if this Long's value is greater than or equal the specified's. */
+ greaterThanOrEqual(other: string | number | Long | Timestamp): boolean {
+ return this.comp(other) >= 0;
+ }
+
+ /** This is an alias of {@link Long.greaterThanOrEqual} */
+ gte(other: string | number | Long | Timestamp): boolean {
+ return this.greaterThanOrEqual(other);
+ }
+ /** This is an alias of {@link Long.greaterThanOrEqual} */
+ ge(other: string | number | Long | Timestamp): boolean {
+ return this.greaterThanOrEqual(other);
+ }
+
+ /** Tests if this Long's value is even. */
+ isEven(): boolean {
+ return (this.low & 1) === 0;
+ }
+
+ /** Tests if this Long's value is negative. */
+ isNegative(): boolean {
+ return !this.unsigned && this.high < 0;
+ }
+
+ /** Tests if this Long's value is odd. */
+ isOdd(): boolean {
+ return (this.low & 1) === 1;
+ }
+
+ /** Tests if this Long's value is positive. */
+ isPositive(): boolean {
+ return this.unsigned || this.high >= 0;
+ }
+
+ /** Tests if this Long's value equals zero. */
+ isZero(): boolean {
+ return this.high === 0 && this.low === 0;
+ }
+
+ /** Tests if this Long's value is less than the specified's. */
+ lessThan(other: string | number | Long | Timestamp): boolean {
+ return this.comp(other) < 0;
+ }
+
+ /** This is an alias of {@link Long#lessThan}. */
+ lt(other: string | number | Long | Timestamp): boolean {
+ return this.lessThan(other);
+ }
+
+ /** Tests if this Long's value is less than or equal the specified's. */
+ lessThanOrEqual(other: string | number | Long | Timestamp): boolean {
+ return this.comp(other) <= 0;
+ }
+
+ /** This is an alias of {@link Long.lessThanOrEqual} */
+ lte(other: string | number | Long | Timestamp): boolean {
+ return this.lessThanOrEqual(other);
+ }
+
+ /** Returns this Long modulo the specified. */
+ modulo(divisor: string | number | Long | Timestamp): Long {
+ if (!Long.isLong(divisor)) divisor = Long.fromValue(divisor);
+
+ // use wasm support if present
+ if (wasm) {
+ const low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(
+ this.low,
+ this.high,
+ divisor.low,
+ divisor.high
+ );
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+
+ return this.sub(this.div(divisor).mul(divisor));
+ }
+
+ /** This is an alias of {@link Long.modulo} */
+ mod(divisor: string | number | Long | Timestamp): Long {
+ return this.modulo(divisor);
+ }
+ /** This is an alias of {@link Long.modulo} */
+ rem(divisor: string | number | Long | Timestamp): Long {
+ return this.modulo(divisor);
+ }
+
+ /**
+ * Returns the product of this and the specified Long.
+ * @param multiplier - Multiplier
+ * @returns Product
+ */
+ multiply(multiplier: string | number | Long | Timestamp): Long {
+ if (this.isZero()) return Long.ZERO;
+ if (!Long.isLong(multiplier)) multiplier = Long.fromValue(multiplier);
+
+ // use wasm support if present
+ if (wasm) {
+ const low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high);
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
+ }
+
+ if (multiplier.isZero()) return Long.ZERO;
+ if (this.eq(Long.MIN_VALUE)) return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+ if (multiplier.eq(Long.MIN_VALUE)) return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
+
+ if (this.isNegative()) {
+ if (multiplier.isNegative()) return this.neg().mul(multiplier.neg());
+ else return this.neg().mul(multiplier).neg();
+ } else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg();
+
+ // If both longs are small, use float multiplication
+ if (this.lt(Long.TWO_PWR_24) && multiplier.lt(Long.TWO_PWR_24))
+ return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
+
+ // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
+ // We can skip products that would overflow.
+
+ const a48 = this.high >>> 16;
+ const a32 = this.high & 0xffff;
+ const a16 = this.low >>> 16;
+ const a00 = this.low & 0xffff;
+
+ const b48 = multiplier.high >>> 16;
+ const b32 = multiplier.high & 0xffff;
+ const b16 = multiplier.low >>> 16;
+ const b00 = multiplier.low & 0xffff;
+
+ let c48 = 0,
+ c32 = 0,
+ c16 = 0,
+ c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xffff;
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ }
+
+ /** This is an alias of {@link Long.multiply} */
+ mul(multiplier: string | number | Long | Timestamp): Long {
+ return this.multiply(multiplier);
+ }
+
+ /** Returns the Negation of this Long's value. */
+ negate(): Long {
+ if (!this.unsigned && this.eq(Long.MIN_VALUE)) return Long.MIN_VALUE;
+ return this.not().add(Long.ONE);
+ }
+
+ /** This is an alias of {@link Long.negate} */
+ neg(): Long {
+ return this.negate();
+ }
+
+ /** Returns the bitwise NOT of this Long. */
+ not(): Long {
+ return Long.fromBits(~this.low, ~this.high, this.unsigned);
+ }
+
+ /** Tests if this Long's value differs from the specified's. */
+ notEquals(other: string | number | Long | Timestamp): boolean {
+ return !this.equals(other);
+ }
+
+ /** This is an alias of {@link Long.notEquals} */
+ neq(other: string | number | Long | Timestamp): boolean {
+ return this.notEquals(other);
+ }
+ /** This is an alias of {@link Long.notEquals} */
+ ne(other: string | number | Long | Timestamp): boolean {
+ return this.notEquals(other);
+ }
+
+ /**
+ * Returns the bitwise OR of this Long and the specified.
+ */
+ or(other: number | string | Long): Long {
+ if (!Long.isLong(other)) other = Long.fromValue(other);
+ return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+ }
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ * @param numBits - Number of bits
+ * @returns Shifted Long
+ */
+ shiftLeft(numBits: number | Long): Long {
+ if (Long.isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ else if (numBits < 32)
+ return Long.fromBits(
+ this.low << numBits,
+ (this.high << numBits) | (this.low >>> (32 - numBits)),
+ this.unsigned
+ );
+ else return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
+ }
+
+ /** This is an alias of {@link Long.shiftLeft} */
+ shl(numBits: number | Long): Long {
+ return this.shiftLeft(numBits);
+ }
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ * @param numBits - Number of bits
+ * @returns Shifted Long
+ */
+ shiftRight(numBits: number | Long): Long {
+ if (Long.isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ else if (numBits < 32)
+ return Long.fromBits(
+ (this.low >>> numBits) | (this.high << (32 - numBits)),
+ this.high >> numBits,
+ this.unsigned
+ );
+ else return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
+ }
+
+ /** This is an alias of {@link Long.shiftRight} */
+ shr(numBits: number | Long): Long {
+ return this.shiftRight(numBits);
+ }
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ * @param numBits - Number of bits
+ * @returns Shifted Long
+ */
+ shiftRightUnsigned(numBits: Long | number): Long {
+ if (Long.isLong(numBits)) numBits = numBits.toInt();
+ numBits &= 63;
+ if (numBits === 0) return this;
+ else {
+ const high = this.high;
+ if (numBits < 32) {
+ const low = this.low;
+ return Long.fromBits(
+ (low >>> numBits) | (high << (32 - numBits)),
+ high >>> numBits,
+ this.unsigned
+ );
+ } else if (numBits === 32) return Long.fromBits(high, 0, this.unsigned);
+ else return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
+ }
+ }
+
+ /** This is an alias of {@link Long.shiftRightUnsigned} */
+ shr_u(numBits: number | Long): Long {
+ return this.shiftRightUnsigned(numBits);
+ }
+ /** This is an alias of {@link Long.shiftRightUnsigned} */
+ shru(numBits: number | Long): Long {
+ return this.shiftRightUnsigned(numBits);
+ }
+
+ /**
+ * Returns the difference of this and the specified Long.
+ * @param subtrahend - Subtrahend
+ * @returns Difference
+ */
+ subtract(subtrahend: string | number | Long | Timestamp): Long {
+ if (!Long.isLong(subtrahend)) subtrahend = Long.fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+ }
+
+ /** This is an alias of {@link Long.subtract} */
+ sub(subtrahend: string | number | Long | Timestamp): Long {
+ return this.subtract(subtrahend);
+ }
+
+ /** Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. */
+ toInt(): number {
+ return this.unsigned ? this.low >>> 0 : this.low;
+ }
+
+ /** Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). */
+ toNumber(): number {
+ if (this.unsigned) return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+ }
+
+ /** Converts the Long to a BigInt (arbitrary precision). */
+ toBigInt(): bigint {
+ return BigInt(this.toString());
+ }
+
+ /**
+ * Converts this Long to its byte representation.
+ * @param le - Whether little or big endian, defaults to big endian
+ * @returns Byte representation
+ */
+ toBytes(le?: boolean): number[] {
+ return le ? this.toBytesLE() : this.toBytesBE();
+ }
+
+ /**
+ * Converts this Long to its little endian byte representation.
+ * @returns Little endian byte representation
+ */
+ toBytesLE(): number[] {
+ const hi = this.high,
+ lo = this.low;
+ return [
+ lo & 0xff,
+ (lo >>> 8) & 0xff,
+ (lo >>> 16) & 0xff,
+ lo >>> 24,
+ hi & 0xff,
+ (hi >>> 8) & 0xff,
+ (hi >>> 16) & 0xff,
+ hi >>> 24
+ ];
+ }
+
+ /**
+ * Converts this Long to its big endian byte representation.
+ * @returns Big endian byte representation
+ */
+ toBytesBE(): number[] {
+ const hi = this.high,
+ lo = this.low;
+ return [
+ hi >>> 24,
+ (hi >>> 16) & 0xff,
+ (hi >>> 8) & 0xff,
+ hi & 0xff,
+ lo >>> 24,
+ (lo >>> 16) & 0xff,
+ (lo >>> 8) & 0xff,
+ lo & 0xff
+ ];
+ }
+
+ /**
+ * Converts this Long to signed.
+ */
+ toSigned(): Long {
+ if (!this.unsigned) return this;
+ return Long.fromBits(this.low, this.high, false);
+ }
+
+ /**
+ * Converts the Long to a string written in the specified radix.
+ * @param radix - Radix (2-36), defaults to 10
+ * @throws RangeError If `radix` is out of range
+ */
+ toString(radix?: number): string {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix) throw new BSONError('radix');
+ if (this.isZero()) return '0';
+ if (this.isNegative()) {
+ // Unsigned Longs are never negative
+ if (this.eq(Long.MIN_VALUE)) {
+ // We need to change the Long value before it can be negated, so we remove
+ // the bottom-most digit in this base and then recurse to do the rest.
+ const radixLong = Long.fromNumber(radix),
+ div = this.div(radixLong),
+ rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ } else return '-' + this.neg().toString(radix);
+ }
+
+ // Do several (6) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ const radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
+ let rem: Long = this;
+ let result = '';
+ while (true) {
+ const remDiv = rem.div(radixToPower);
+ const intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0;
+ let digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero()) {
+ return digits + result;
+ } else {
+ while (digits.length < 6) digits = '0' + digits;
+ result = '' + digits + result;
+ }
+ }
+ }
+
+ /** Converts this Long to unsigned. */
+ toUnsigned(): Long {
+ if (this.unsigned) return this;
+ return Long.fromBits(this.low, this.high, true);
+ }
+
+ /** Returns the bitwise XOR of this Long and the given one. */
+ xor(other: Long | number | string): Long {
+ if (!Long.isLong(other)) other = Long.fromValue(other);
+ return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+ }
+
+ /** This is an alias of {@link Long.isZero} */
+ eqz(): boolean {
+ return this.isZero();
+ }
+
+ /** This is an alias of {@link Long.lessThanOrEqual} */
+ le(other: string | number | Long | Timestamp): boolean {
+ return this.lessThanOrEqual(other);
+ }
+
+ /*
+ ****************************************************************
+ * BSON SPECIFIC ADDITIONS *
+ ****************************************************************
+ */
+ toExtendedJSON(options?: EJSONOptions): number | LongExtended {
+ if (options && options.relaxed) return this.toNumber();
+ return { $numberLong: this.toString() };
+ }
+ static fromExtendedJSON(
+ doc: { $numberLong: string },
+ options?: EJSONOptions
+ ): number | Long | bigint {
+ const { useBigInt64 = false, relaxed = true } = { ...options };
+
+ if (doc.$numberLong.length > MAX_INT64_STRING_LENGTH) {
+ throw new BSONError('$numberLong string is too long');
+ }
+
+ if (!DECIMAL_REG_EX.test(doc.$numberLong)) {
+ throw new BSONError(`$numberLong string "${doc.$numberLong}" is in an invalid format`);
+ }
+
+ if (useBigInt64) {
+ const bigIntResult = BigInt(doc.$numberLong);
+ return BigInt.asIntN(64, bigIntResult);
+ }
+
+ const longResult = Long.fromString(doc.$numberLong);
+ if (relaxed) {
+ return longResult.toNumber();
+ }
+ return longResult;
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ const longVal = inspect(this.toString(), options);
+ const unsignedVal = this.unsigned ? `, ${inspect(this.unsigned, options)}` : '';
+ return `new Long(${longVal}${unsignedVal})`;
+ }
+}
diff --git a/node_modules/bson/src/max_key.ts b/node_modules/bson/src/max_key.ts
new file mode 100644
index 00000000..903f1d16
--- /dev/null
+++ b/node_modules/bson/src/max_key.ts
@@ -0,0 +1,31 @@
+import { BSONValue } from './bson_value';
+
+/** @public */
+export interface MaxKeyExtended {
+ $maxKey: 1;
+}
+
+/**
+ * A class representation of the BSON MaxKey type.
+ * @public
+ * @category BSONType
+ */
+export class MaxKey extends BSONValue {
+ get _bsontype(): 'MaxKey' {
+ return 'MaxKey';
+ }
+
+ /** @internal */
+ toExtendedJSON(): MaxKeyExtended {
+ return { $maxKey: 1 };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(): MaxKey {
+ return new MaxKey();
+ }
+
+ inspect(): string {
+ return 'new MaxKey()';
+ }
+}
diff --git a/node_modules/bson/src/min_key.ts b/node_modules/bson/src/min_key.ts
new file mode 100644
index 00000000..244e645a
--- /dev/null
+++ b/node_modules/bson/src/min_key.ts
@@ -0,0 +1,31 @@
+import { BSONValue } from './bson_value';
+
+/** @public */
+export interface MinKeyExtended {
+ $minKey: 1;
+}
+
+/**
+ * A class representation of the BSON MinKey type.
+ * @public
+ * @category BSONType
+ */
+export class MinKey extends BSONValue {
+ get _bsontype(): 'MinKey' {
+ return 'MinKey';
+ }
+
+ /** @internal */
+ toExtendedJSON(): MinKeyExtended {
+ return { $minKey: 1 };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(): MinKey {
+ return new MinKey();
+ }
+
+ inspect(): string {
+ return 'new MinKey()';
+ }
+}
diff --git a/node_modules/bson/src/objectid.ts b/node_modules/bson/src/objectid.ts
new file mode 100644
index 00000000..a84a5790
--- /dev/null
+++ b/node_modules/bson/src/objectid.ts
@@ -0,0 +1,382 @@
+import { BSONValue } from './bson_value';
+import { BSONError } from './error';
+import { type InspectFn, defaultInspect } from './parser/utils';
+import { ByteUtils } from './utils/byte_utils';
+import { NumberUtils } from './utils/number_utils';
+
+// Unique sequence for the current process (initialized on first use)
+let PROCESS_UNIQUE: Uint8Array | null = null;
+
+/** ObjectId hexString cache @internal */
+const __idCache = new WeakMap(); // TODO(NODE-6549): convert this to #__id private field when target updated to ES2022
+
+/** @public */
+export interface ObjectIdLike {
+ id: string | Uint8Array;
+ __id?: string;
+ toHexString(): string;
+}
+
+/** @public */
+export interface ObjectIdExtended {
+ $oid: string;
+}
+
+/**
+ * A class representation of the BSON ObjectId type.
+ * @public
+ * @category BSONType
+ */
+export class ObjectId extends BSONValue {
+ get _bsontype(): 'ObjectId' {
+ return 'ObjectId';
+ }
+
+ /** @internal */
+ private static index = Math.floor(Math.random() * 0xffffff);
+
+ static cacheHexString: boolean;
+
+ /** ObjectId Bytes @internal */
+ private buffer!: Uint8Array;
+
+ /** To generate a new ObjectId, use ObjectId() with no argument. */
+ constructor();
+ /**
+ * Create ObjectId from a 24 character hex string.
+ *
+ * @param inputId - A 24 character hex string.
+ */
+ constructor(inputId: string);
+ /**
+ * Create ObjectId from the BSON ObjectId type.
+ *
+ * @param inputId - The BSON ObjectId type.
+ */
+ constructor(inputId: ObjectId);
+ /**
+ * Create ObjectId from the object type that has the toHexString method.
+ *
+ * @param inputId - The ObjectIdLike type.
+ */
+ constructor(inputId: ObjectIdLike);
+ /**
+ * Create ObjectId from a 12 byte binary Buffer.
+ *
+ * @param inputId - A 12 byte binary Buffer.
+ */
+ constructor(inputId: Uint8Array);
+ /**
+ * Implementation overload.
+ *
+ * @param inputId - All input types that are used in the constructor implementation.
+ */
+ constructor(inputId?: string | ObjectId | ObjectIdLike | Uint8Array);
+ /**
+ * Create a new ObjectId.
+ *
+ * @param inputId - An input value to create a new ObjectId from.
+ */
+ constructor(inputId?: string | ObjectId | ObjectIdLike | Uint8Array) {
+ super();
+ // workingId is set based on type of input and whether valid id exists for the input
+ let workingId;
+ if (typeof inputId === 'object' && inputId && 'id' in inputId) {
+ if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
+ throw new BSONError('Argument passed in must have an id that is of type string or Buffer');
+ }
+ if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
+ workingId = ByteUtils.fromHex(inputId.toHexString());
+ } else {
+ workingId = inputId.id;
+ }
+ } else {
+ workingId = inputId;
+ }
+
+ // The following cases use workingId to construct an ObjectId
+ if (workingId == null) {
+ // The most common use case (blank id, new objectId instance)
+ // Generate a new id
+ this.buffer = ObjectId.generate();
+ } else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
+ // If instanceof matches we can escape calling ensure buffer in Node.js environments
+ this.buffer = ByteUtils.toLocalBufferType(workingId);
+ } else if (typeof workingId === 'string') {
+ if (ObjectId.validateHexString(workingId)) {
+ this.buffer = ByteUtils.fromHex(workingId);
+ // If we are caching the hex string
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, workingId);
+ }
+ } else {
+ throw new BSONError(
+ 'input must be a 24 character hex string, 12 byte Uint8Array, or an integer'
+ );
+ }
+ } else {
+ throw new BSONError('Argument passed in does not match the accepted types');
+ }
+ }
+
+ /**
+ * The ObjectId bytes
+ * @readonly
+ */
+ get id(): Uint8Array {
+ return this.buffer;
+ }
+
+ set id(value: Uint8Array) {
+ this.buffer = value;
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, ByteUtils.toHex(value));
+ }
+ }
+
+ /**
+ * @internal
+ * Validates the input string is a valid hex representation of an ObjectId.
+ */
+ private static validateHexString(string: string): boolean {
+ if (string?.length !== 24) return false;
+ for (let i = 0; i < 24; i++) {
+ const char = string.charCodeAt(i);
+ if (
+ // Check for ASCII 0-9
+ (char >= 48 && char <= 57) ||
+ // Check for ASCII a-f
+ (char >= 97 && char <= 102) ||
+ // Check for ASCII A-F
+ (char >= 65 && char <= 70)
+ ) {
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /** Returns the ObjectId id as a 24 lowercase character hex string representation */
+ toHexString(): string {
+ if (ObjectId.cacheHexString) {
+ const __id = __idCache.get(this);
+ if (__id) return __id;
+ }
+
+ const hexString = ByteUtils.toHex(this.id);
+
+ if (ObjectId.cacheHexString) {
+ __idCache.set(this, hexString);
+ }
+
+ return hexString;
+ }
+
+ /**
+ * Update the ObjectId index
+ * @internal
+ */
+ private static getInc(): number {
+ return (ObjectId.index = (ObjectId.index + 1) % 0xffffff);
+ }
+
+ /**
+ * Generate a 12 byte id buffer used in ObjectId's
+ *
+ * @param time - pass in a second based timestamp.
+ */
+ static generate(time?: number): Uint8Array {
+ if ('number' !== typeof time) {
+ time = Math.floor(Date.now() / 1000);
+ }
+
+ const inc = ObjectId.getInc();
+ const buffer = ByteUtils.allocateUnsafe(12);
+
+ // 4-byte timestamp
+ NumberUtils.setInt32BE(buffer, 0, time);
+
+ // set PROCESS_UNIQUE if yet not initialized
+ if (PROCESS_UNIQUE === null) {
+ PROCESS_UNIQUE = ByteUtils.randomBytes(5);
+ }
+
+ // 5-byte process unique
+ buffer[4] = PROCESS_UNIQUE[0];
+ buffer[5] = PROCESS_UNIQUE[1];
+ buffer[6] = PROCESS_UNIQUE[2];
+ buffer[7] = PROCESS_UNIQUE[3];
+ buffer[8] = PROCESS_UNIQUE[4];
+
+ // 3-byte counter
+ buffer[11] = inc & 0xff;
+ buffer[10] = (inc >> 8) & 0xff;
+ buffer[9] = (inc >> 16) & 0xff;
+
+ return buffer;
+ }
+
+ /**
+ * Converts the id into a 24 character hex string for printing, unless encoding is provided.
+ * @param encoding - hex or base64
+ */
+ toString(encoding?: 'hex' | 'base64'): string {
+ // Is the id a buffer then use the buffer toString method to return the format
+ if (encoding === 'base64') return ByteUtils.toBase64(this.id);
+ if (encoding === 'hex') return this.toHexString();
+ return this.toHexString();
+ }
+
+ /** Converts to its JSON the 24 character hex string representation. */
+ toJSON(): string {
+ return this.toHexString();
+ }
+
+ /** @internal */
+ private static is(variable: unknown): variable is ObjectId {
+ return (
+ variable != null &&
+ typeof variable === 'object' &&
+ '_bsontype' in variable &&
+ variable._bsontype === 'ObjectId'
+ );
+ }
+
+ /**
+ * Compares the equality of this ObjectId with `otherID`.
+ *
+ * @param otherId - ObjectId instance to compare against.
+ */
+ equals(otherId: string | ObjectId | ObjectIdLike | undefined | null): boolean {
+ if (otherId === undefined || otherId === null) {
+ return false;
+ }
+
+ if (ObjectId.is(otherId)) {
+ return (
+ this.buffer[11] === otherId.buffer[11] && ByteUtils.equals(this.buffer, otherId.buffer)
+ );
+ }
+
+ if (typeof otherId === 'string') {
+ return otherId.toLowerCase() === this.toHexString();
+ }
+
+ if (typeof otherId === 'object' && typeof otherId.toHexString === 'function') {
+ const otherIdString = otherId.toHexString();
+ const thisIdString = this.toHexString();
+ return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
+ }
+
+ return false;
+ }
+
+ /** Returns the generation date (accurate up to the second) that this ID was generated. */
+ getTimestamp(): Date {
+ const timestamp = new Date();
+ const time = NumberUtils.getUint32BE(this.buffer, 0);
+ timestamp.setTime(Math.floor(time) * 1000);
+ return timestamp;
+ }
+
+ /** @internal */
+ static createPk(): ObjectId {
+ return new ObjectId();
+ }
+
+ /** @internal */
+ serializeInto(uint8array: Uint8Array, index: number): 12 {
+ uint8array[index] = this.buffer[0];
+ uint8array[index + 1] = this.buffer[1];
+ uint8array[index + 2] = this.buffer[2];
+ uint8array[index + 3] = this.buffer[3];
+ uint8array[index + 4] = this.buffer[4];
+ uint8array[index + 5] = this.buffer[5];
+ uint8array[index + 6] = this.buffer[6];
+ uint8array[index + 7] = this.buffer[7];
+ uint8array[index + 8] = this.buffer[8];
+ uint8array[index + 9] = this.buffer[9];
+ uint8array[index + 10] = this.buffer[10];
+ uint8array[index + 11] = this.buffer[11];
+ return 12;
+ }
+
+ /**
+ * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
+ *
+ * @param time - an integer number representing a number of seconds.
+ */
+ static createFromTime(time: number): ObjectId {
+ const buffer = ByteUtils.allocate(12);
+ for (let i = 11; i >= 4; i--) buffer[i] = 0;
+ // Encode time into first 4 bytes
+ NumberUtils.setInt32BE(buffer, 0, time);
+ // Return the new objectId
+ return new ObjectId(buffer);
+ }
+
+ /**
+ * Creates an ObjectId from a hex string representation of an ObjectId.
+ *
+ * @param hexString - create a ObjectId from a passed in 24 character hexstring.
+ */
+ static createFromHexString(hexString: string): ObjectId {
+ if (hexString?.length !== 24) {
+ throw new BSONError('hex string must be 24 characters');
+ }
+
+ return new ObjectId(ByteUtils.fromHex(hexString));
+ }
+
+ /** Creates an ObjectId instance from a base64 string */
+ static createFromBase64(base64: string): ObjectId {
+ if (base64?.length !== 16) {
+ throw new BSONError('base64 string must be 16 characters');
+ }
+
+ return new ObjectId(ByteUtils.fromBase64(base64));
+ }
+
+ /**
+ * Checks if a value can be used to create a valid bson ObjectId
+ * @param id - any JS value
+ */
+ static isValid(id: string | ObjectId | ObjectIdLike | Uint8Array): boolean {
+ if (id == null) return false;
+ if (typeof id === 'string') return ObjectId.validateHexString(id);
+
+ try {
+ new ObjectId(id);
+ return true;
+ } catch {
+ return false;
+ }
+ }
+
+ /** @internal */
+ toExtendedJSON(): ObjectIdExtended {
+ if (this.toHexString) return { $oid: this.toHexString() };
+ return { $oid: this.toString('hex') };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(doc: ObjectIdExtended): ObjectId {
+ return new ObjectId(doc.$oid);
+ }
+
+ /** @internal */
+ private isCached(): boolean {
+ return ObjectId.cacheHexString && __idCache.has(this);
+ }
+
+ /**
+ * Converts to a string representation of this Id.
+ *
+ * @returns return the 24 character hex string representation.
+ */
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ return `new ObjectId(${inspect(this.toHexString(), options)})`;
+ }
+}
diff --git a/node_modules/bson/src/parse_utf8.ts b/node_modules/bson/src/parse_utf8.ts
new file mode 100644
index 00000000..045a9080
--- /dev/null
+++ b/node_modules/bson/src/parse_utf8.ts
@@ -0,0 +1,35 @@
+import { BSONError } from './error';
+
+type TextDecoder = {
+ readonly encoding: string;
+ readonly fatal: boolean;
+ readonly ignoreBOM: boolean;
+ decode(input?: Uint8Array): string;
+};
+type TextDecoderConstructor = {
+ new (label: 'utf8', options: { fatal: boolean; ignoreBOM?: boolean }): TextDecoder;
+};
+
+// parse utf8 globals
+declare const TextDecoder: TextDecoderConstructor;
+let TextDecoderFatal: TextDecoder;
+let TextDecoderNonFatal: TextDecoder;
+
+/**
+ * Determines if the passed in bytes are valid utf8
+ * @param bytes - An array of 8-bit bytes. Must be indexable and have length property
+ * @param start - The index to start validating
+ * @param end - The index to end validating
+ */
+export function parseUtf8(buffer: Uint8Array, start: number, end: number, fatal: boolean): string {
+ if (fatal) {
+ TextDecoderFatal ??= new TextDecoder('utf8', { fatal: true });
+ try {
+ return TextDecoderFatal.decode(buffer.subarray(start, end));
+ } catch (cause) {
+ throw new BSONError('Invalid UTF-8 string in BSON document', { cause });
+ }
+ }
+ TextDecoderNonFatal ??= new TextDecoder('utf8', { fatal: false });
+ return TextDecoderNonFatal.decode(buffer.subarray(start, end));
+}
diff --git a/node_modules/bson/src/parser/calculate_size.ts b/node_modules/bson/src/parser/calculate_size.ts
new file mode 100644
index 00000000..557d15a8
--- /dev/null
+++ b/node_modules/bson/src/parser/calculate_size.ts
@@ -0,0 +1,218 @@
+import { Binary } from '../binary';
+import type { Document } from '../bson';
+import { BSONError, BSONVersionError } from '../error';
+import * as constants from '../constants';
+import { ByteUtils } from '../utils/byte_utils';
+import { isAnyArrayBuffer, isDate, isRegExp } from './utils';
+
+export function internalCalculateObjectSize(
+ object: Document,
+ serializeFunctions?: boolean,
+ ignoreUndefined?: boolean
+): number {
+ let totalLength = 4 + 1;
+
+ if (Array.isArray(object)) {
+ for (let i = 0; i < object.length; i++) {
+ totalLength += calculateElement(
+ i.toString(),
+ object[i],
+ serializeFunctions,
+ true,
+ ignoreUndefined
+ );
+ }
+ } else {
+ // If we have toBSON defined, override the current object
+
+ if (typeof object?.toBSON === 'function') {
+ object = object.toBSON();
+ }
+
+ // Calculate size
+ for (const key of Object.keys(object)) {
+ totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined);
+ }
+ }
+
+ return totalLength;
+}
+
+/** @internal */
+function calculateElement(
+ name: string,
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ value: any,
+ serializeFunctions = false,
+ isArray = false,
+ ignoreUndefined = false
+) {
+ // If we have toBSON defined, override the current object
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+
+ switch (typeof value) {
+ case 'string':
+ return 1 + ByteUtils.utf8ByteLength(name) + 1 + 4 + ByteUtils.utf8ByteLength(value) + 1;
+ case 'number':
+ if (
+ Math.floor(value) === value &&
+ value >= constants.JS_INT_MIN &&
+ value <= constants.JS_INT_MAX
+ ) {
+ if (value >= constants.BSON_INT32_MIN && value <= constants.BSON_INT32_MAX) {
+ // 32 bit
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (4 + 1);
+ } else {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ } else {
+ // 64 bit
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ }
+ case 'undefined':
+ if (isArray || !ignoreUndefined)
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ return 0;
+ case 'boolean':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 1);
+ case 'object':
+ if (
+ value != null &&
+ typeof value._bsontype === 'string' &&
+ value[constants.BSON_VERSION_SYMBOL] !== constants.BSON_MAJOR_VERSION
+ ) {
+ throw new BSONVersionError();
+ } else if (value == null || value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
+ } else if (value._bsontype === 'ObjectId') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (12 + 1);
+ } else if (value instanceof Date || isDate(value)) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ } else if (
+ ArrayBuffer.isView(value) ||
+ value instanceof ArrayBuffer ||
+ isAnyArrayBuffer(value)
+ ) {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 4 + 1) + value.byteLength
+ );
+ } else if (
+ value._bsontype === 'Long' ||
+ value._bsontype === 'Double' ||
+ value._bsontype === 'Timestamp'
+ ) {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ } else if (value._bsontype === 'Decimal128') {
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (16 + 1);
+ } else if (value._bsontype === 'Code') {
+ // Calculate size depending on the availability of a scope
+ if (value.scope != null && Object.keys(value.scope).length > 0) {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1 +
+ internalCalculateObjectSize(value.scope, serializeFunctions, ignoreUndefined)
+ );
+ } else {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.code.toString()) +
+ 1
+ );
+ }
+ } else if (value._bsontype === 'Binary') {
+ const binary: Binary = value;
+ // Check what kind of subtype we have
+ if (binary.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ (binary.position + 1 + 4 + 1 + 4)
+ );
+ } else {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (binary.position + 1 + 4 + 1)
+ );
+ }
+ } else if (value._bsontype === 'Symbol') {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ ByteUtils.utf8ByteLength(value.value) +
+ 4 +
+ 1 +
+ 1
+ );
+ } else if (value._bsontype === 'DBRef') {
+ // Set up correct object for serialization
+ const ordered_values = Object.assign(
+ {
+ $ref: value.collection,
+ $id: value.oid
+ },
+ value.fields
+ );
+
+ // Add db reference if it exists
+ if (value.db != null) {
+ ordered_values['$db'] = value.db;
+ }
+
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ internalCalculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined)
+ );
+ } else if (value instanceof RegExp || isRegExp(value)) {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.source) +
+ 1 +
+ (value.global ? 1 : 0) +
+ (value.ignoreCase ? 1 : 0) +
+ (value.multiline ? 1 : 0) +
+ 1
+ );
+ } else if (value._bsontype === 'BSONRegExp') {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.pattern) +
+ 1 +
+ ByteUtils.utf8ByteLength(value.options) +
+ 1
+ );
+ } else {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ internalCalculateObjectSize(value, serializeFunctions, ignoreUndefined) +
+ 1
+ );
+ }
+ case 'function':
+ if (serializeFunctions) {
+ return (
+ (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
+ 1 +
+ 4 +
+ ByteUtils.utf8ByteLength(value.toString()) +
+ 1
+ );
+ }
+ return 0;
+ case 'bigint':
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
+ case 'symbol':
+ return 0;
+ default:
+ throw new BSONError(`Unrecognized JS type: ${typeof value}`);
+ }
+
+ return 0;
+}
diff --git a/node_modules/bson/src/parser/deserializer.ts b/node_modules/bson/src/parser/deserializer.ts
new file mode 100644
index 00000000..97bdd6bf
--- /dev/null
+++ b/node_modules/bson/src/parser/deserializer.ts
@@ -0,0 +1,627 @@
+import { Binary, UUID } from '../binary';
+import type { Document } from '../bson';
+import { Code } from '../code';
+import * as constants from '../constants';
+import { DBRef, type DBRefLike, isDBRefLike } from '../db_ref';
+import { Decimal128 } from '../decimal128';
+import { Double } from '../double';
+import { BSONError } from '../error';
+import { Int32 } from '../int_32';
+import { Long } from '../long';
+import { MaxKey } from '../max_key';
+import { MinKey } from '../min_key';
+import { ObjectId } from '../objectid';
+import { BSONRegExp } from '../regexp';
+import { BSONSymbol } from '../symbol';
+import { Timestamp } from '../timestamp';
+import { ByteUtils } from '../utils/byte_utils';
+import { NumberUtils } from '../utils/number_utils';
+
+/** @public */
+export interface DeserializeOptions {
+ /**
+ * when deserializing a Long return as a BigInt.
+ * @defaultValue `false`
+ */
+ useBigInt64?: boolean;
+ /**
+ * when deserializing a Long will fit it into a Number if it's smaller than 53 bits.
+ * @defaultValue `true`
+ */
+ promoteLongs?: boolean;
+ /**
+ * when deserializing a Binary will return it as a node.js Buffer instance.
+ * @defaultValue `false`
+ */
+ promoteBuffers?: boolean;
+ /**
+ * when deserializing will promote BSON values to their Node.js closest equivalent types.
+ * @defaultValue `true`
+ */
+ promoteValues?: boolean;
+ /**
+ * allow to specify if there what fields we wish to return as unserialized raw buffer.
+ * @defaultValue `null`
+ */
+ fieldsAsRaw?: Document;
+ /**
+ * return BSON regular expressions as BSONRegExp instances.
+ * @defaultValue `false`
+ */
+ bsonRegExp?: boolean;
+ /**
+ * allows the buffer to be larger than the parsed BSON object.
+ * @defaultValue `false`
+ */
+ allowObjectSmallerThanBufferSize?: boolean;
+ /**
+ * Offset into buffer to begin reading document from
+ * @defaultValue `0`
+ */
+ index?: number;
+
+ raw?: boolean;
+ /** Allows for opt-out utf-8 validation for all keys or
+ * specified keys. Must be all true or all false.
+ *
+ * @example
+ * ```js
+ * // disables validation on all keys
+ * validation: { utf8: false }
+ *
+ * // enables validation only on specified keys a, b, and c
+ * validation: { utf8: { a: true, b: true, c: true } }
+ *
+ * // disables validation only on specified keys a, b
+ * validation: { utf8: { a: false, b: false } }
+ * ```
+ */
+ validation?: { utf8: boolean | Record | Record };
+}
+
+// Internal long versions
+const JS_INT_MAX_LONG = Long.fromNumber(constants.JS_INT_MAX);
+const JS_INT_MIN_LONG = Long.fromNumber(constants.JS_INT_MIN);
+
+export function internalDeserialize(
+ buffer: Uint8Array,
+ options: DeserializeOptions,
+ isArray?: boolean
+): Document {
+ options = options == null ? {} : options;
+ const index = options && options.index ? options.index : 0;
+ // Read the document size
+ const size = NumberUtils.getInt32LE(buffer, index);
+
+ if (size < 5) {
+ throw new BSONError(`bson size must be >= 5, is ${size}`);
+ }
+
+ if (options.allowObjectSmallerThanBufferSize && buffer.length < size) {
+ throw new BSONError(`buffer length ${buffer.length} must be >= bson size ${size}`);
+ }
+
+ if (!options.allowObjectSmallerThanBufferSize && buffer.length !== size) {
+ throw new BSONError(`buffer length ${buffer.length} must === bson size ${size}`);
+ }
+
+ if (size + index > buffer.byteLength) {
+ throw new BSONError(
+ `(bson size ${size} + options.index ${index} must be <= buffer length ${buffer.byteLength})`
+ );
+ }
+
+ // Illegal end value
+ if (buffer[index + size - 1] !== 0) {
+ throw new BSONError(
+ "One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00"
+ );
+ }
+
+ // Start deserialization
+ return deserializeObject(buffer, index, options, isArray);
+}
+
+const allowedDBRefKeys = /^\$ref$|^\$id$|^\$db$/;
+
+function deserializeObject(
+ buffer: Uint8Array,
+ index: number,
+ options: DeserializeOptions,
+ isArray = false
+) {
+ const fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];
+
+ // Return raw bson buffer instead of parsing it
+ const raw = options['raw'] == null ? false : options['raw'];
+
+ // Return BSONRegExp objects instead of native regular expressions
+ const bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false;
+
+ // Controls the promotion of values vs wrapper classes
+ const promoteBuffers = options.promoteBuffers ?? false;
+ const promoteLongs = options.promoteLongs ?? true;
+ const promoteValues = options.promoteValues ?? true;
+ const useBigInt64 = options.useBigInt64 ?? false;
+
+ if (useBigInt64 && !promoteValues) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+
+ if (useBigInt64 && !promoteLongs) {
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
+ }
+
+ // Ensures default validation option if none given
+ const validation = options.validation == null ? { utf8: true } : options.validation;
+
+ // Shows if global utf-8 validation is enabled or disabled
+ let globalUTFValidation = true;
+ // Reflects utf-8 validation setting regardless of global or specific key validation
+ let validationSetting: boolean;
+ // Set of keys either to enable or disable validation on
+ let utf8KeysSet;
+
+ // Check for boolean uniformity and empty validation option
+ const utf8ValidatedKeys = validation.utf8;
+ if (typeof utf8ValidatedKeys === 'boolean') {
+ validationSetting = utf8ValidatedKeys;
+ } else {
+ globalUTFValidation = false;
+ const utf8ValidationValues = Object.keys(utf8ValidatedKeys).map(function (key) {
+ return utf8ValidatedKeys[key];
+ });
+ if (utf8ValidationValues.length === 0) {
+ throw new BSONError('UTF-8 validation setting cannot be empty');
+ }
+ if (typeof utf8ValidationValues[0] !== 'boolean') {
+ throw new BSONError('Invalid UTF-8 validation option, must specify boolean values');
+ }
+ validationSetting = utf8ValidationValues[0];
+ // Ensures boolean uniformity in utf-8 validation (all true or all false)
+ if (!utf8ValidationValues.every(item => item === validationSetting)) {
+ throw new BSONError('Invalid UTF-8 validation option - keys must be all true or all false');
+ }
+ }
+
+ // Add keys to set that will either be validated or not based on validationSetting
+ if (!globalUTFValidation) {
+ utf8KeysSet = new Set();
+
+ for (const key of Object.keys(utf8ValidatedKeys)) {
+ utf8KeysSet.add(key);
+ }
+ }
+
+ // Set the start index
+ const startIndex = index;
+
+ // Validate that we have at least 4 bytes of buffer
+ if (buffer.length < 5) throw new BSONError('corrupt bson message < 5 bytes long');
+
+ // Read the document size
+ const size = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+
+ // Ensure buffer is valid size
+ if (size < 5 || size > buffer.length) throw new BSONError('corrupt bson message');
+
+ // Create holding object
+ const object: Document = isArray ? [] : {};
+ // Used for arrays to skip having to perform utf8 decoding
+ let arrayIndex = 0;
+ const done = false;
+
+ let isPossibleDBRef = isArray ? false : null;
+
+ // While we have more left data left keep parsing
+ while (!done) {
+ // Read the type
+ const elementType = buffer[index++];
+
+ // If we get a zero it's the last byte, exit
+ if (elementType === 0) break;
+
+ // Get the start search index
+ let i = index;
+ // Locate the end of the c string
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+
+ // If are at the end of the buffer there is a problem with the document
+ if (i >= buffer.byteLength) throw new BSONError('Bad BSON Document: illegal CString');
+
+ // Represents the key
+ const name = isArray ? arrayIndex++ : ByteUtils.toUTF8(buffer, index, i, false);
+
+ // shouldValidateKey is true if the key should be validated, false otherwise
+ let shouldValidateKey = true;
+ if (globalUTFValidation || utf8KeysSet?.has(name)) {
+ shouldValidateKey = validationSetting;
+ } else {
+ shouldValidateKey = !validationSetting;
+ }
+
+ if (isPossibleDBRef !== false && (name as string)[0] === '$') {
+ isPossibleDBRef = allowedDBRefKeys.test(name as string);
+ }
+ let value;
+
+ index = i + 1;
+
+ if (elementType === constants.BSON_DATA_STRING) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (
+ stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0
+ ) {
+ throw new BSONError('bad string length in bson');
+ }
+ value = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ index = index + stringSize;
+ } else if (elementType === constants.BSON_DATA_OID) {
+ const oid = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++) oid[i] = buffer[index + i];
+ value = new ObjectId(oid);
+ index = index + 12;
+ } else if (elementType === constants.BSON_DATA_INT && promoteValues === false) {
+ value = new Int32(NumberUtils.getInt32LE(buffer, index));
+ index += 4;
+ } else if (elementType === constants.BSON_DATA_INT) {
+ value = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ } else if (elementType === constants.BSON_DATA_NUMBER) {
+ value = NumberUtils.getFloat64LE(buffer, index);
+ index += 8;
+ if (promoteValues === false) value = new Double(value);
+ } else if (elementType === constants.BSON_DATA_DATE) {
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+
+ value = new Date(new Long(lowBits, highBits).toNumber());
+ } else if (elementType === constants.BSON_DATA_BOOLEAN) {
+ if (buffer[index] !== 0 && buffer[index] !== 1)
+ throw new BSONError('illegal boolean type value');
+ value = buffer[index++] === 1;
+ } else if (elementType === constants.BSON_DATA_OBJECT) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+
+ if (objectSize <= 0 || objectSize > buffer.length - index)
+ throw new BSONError('bad embedded document length in bson');
+
+ // We have a raw value
+ if (raw) {
+ value = buffer.subarray(index, index + objectSize);
+ } else {
+ let objectOptions = options;
+ if (!globalUTFValidation) {
+ objectOptions = { ...options, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, objectOptions, false);
+ }
+
+ index = index + objectSize;
+ } else if (elementType === constants.BSON_DATA_ARRAY) {
+ const _index = index;
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ let arrayOptions: DeserializeOptions = options;
+
+ // Stop index
+ const stopIndex = index + objectSize;
+
+ // All elements of array to be returned as raw bson
+ if (fieldsAsRaw && fieldsAsRaw[name]) {
+ arrayOptions = { ...options, raw: true };
+ }
+
+ if (!globalUTFValidation) {
+ arrayOptions = { ...arrayOptions, validation: { utf8: shouldValidateKey } };
+ }
+ value = deserializeObject(buffer, _index, arrayOptions, true);
+ index = index + objectSize;
+
+ if (buffer[index - 1] !== 0) throw new BSONError('invalid array terminator byte');
+ if (index !== stopIndex) throw new BSONError('corrupted array bson');
+ } else if (elementType === constants.BSON_DATA_UNDEFINED) {
+ value = undefined;
+ } else if (elementType === constants.BSON_DATA_NULL) {
+ value = null;
+ } else if (elementType === constants.BSON_DATA_LONG) {
+ if (useBigInt64) {
+ value = NumberUtils.getBigInt64LE(buffer, index);
+ index += 8;
+ } else {
+ // Unpack the low and high bits
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
+ index += 8;
+
+ const long = new Long(lowBits, highBits);
+ // Promote the long if possible
+ if (promoteLongs && promoteValues === true) {
+ value =
+ long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG)
+ ? long.toNumber()
+ : long;
+ } else {
+ value = long;
+ }
+ }
+ } else if (elementType === constants.BSON_DATA_DECIMAL128) {
+ // Buffer to contain the decimal bytes
+ const bytes = ByteUtils.allocateUnsafe(16);
+ // Copy the next 16 bytes into the bytes buffer
+ for (let i = 0; i < 16; i++) bytes[i] = buffer[index + i];
+ // Update index
+ index = index + 16;
+ // Assign the new Decimal128 value
+ value = new Decimal128(bytes);
+ } else if (elementType === constants.BSON_DATA_BINARY) {
+ let binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ const totalBinarySize = binarySize;
+ const subType = buffer[index++];
+
+ // Did we have a negative binary size, throw
+ if (binarySize < 0) throw new BSONError('Negative binary type element size found');
+
+ // Is the length longer than the document
+ if (binarySize > buffer.byteLength)
+ throw new BSONError('Binary type size larger than document size');
+
+ // If we have subtype 2 skip the 4 bytes for the size
+ if (subType === Binary.SUBTYPE_BYTE_ARRAY) {
+ binarySize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (binarySize < 0)
+ throw new BSONError('Negative binary type element size found for subtype 0x02');
+ if (binarySize > totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too long binary size');
+ if (binarySize < totalBinarySize - 4)
+ throw new BSONError('Binary type with subtype 0x02 contains too short binary size');
+ }
+
+ if (promoteBuffers && promoteValues) {
+ value = ByteUtils.toLocalBufferType(buffer.subarray(index, index + binarySize));
+ } else {
+ value = new Binary(buffer.subarray(index, index + binarySize), subType);
+ if (subType === constants.BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
+ value = value.toUUID();
+ }
+ }
+
+ // Update the index
+ index = index + binarySize;
+ } else if (elementType === constants.BSON_DATA_REGEXP && bsonRegExp === false) {
+ // Get the start search index
+ i = index;
+ // Locate the end of the c string
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ // If are at the end of the buffer there is a problem with the document
+ if (i >= buffer.length) throw new BSONError('Bad BSON Document: illegal CString');
+ // Return the C string
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ // Create the regexp
+ index = i + 1;
+
+ // Get the start search index
+ i = index;
+ // Locate the end of the c string
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ // If are at the end of the buffer there is a problem with the document
+ if (i >= buffer.length) throw new BSONError('Bad BSON Document: illegal CString');
+ // Return the C string
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+
+ // For each option add the corresponding one for javascript
+ const optionsArray = new Array(regExpOptions.length);
+
+ // Parse options
+ for (i = 0; i < regExpOptions.length; i++) {
+ switch (regExpOptions[i]) {
+ case 'm':
+ optionsArray[i] = 'm';
+ break;
+ case 's':
+ optionsArray[i] = 'g';
+ break;
+ case 'i':
+ optionsArray[i] = 'i';
+ break;
+ }
+ }
+
+ value = new RegExp(source, optionsArray.join(''));
+ } else if (elementType === constants.BSON_DATA_REGEXP && bsonRegExp === true) {
+ // Get the start search index
+ i = index;
+ // Locate the end of the c string
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ // If are at the end of the buffer there is a problem with the document
+ if (i >= buffer.length) throw new BSONError('Bad BSON Document: illegal CString');
+ // Return the C string
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+
+ // Get the start search index
+ i = index;
+ // Locate the end of the c string
+ while (buffer[i] !== 0x00 && i < buffer.length) {
+ i++;
+ }
+ // If are at the end of the buffer there is a problem with the document
+ if (i >= buffer.length) throw new BSONError('Bad BSON Document: illegal CString');
+ // Return the C string
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
+ index = i + 1;
+
+ // Set the object
+ value = new BSONRegExp(source, regExpOptions);
+ } else if (elementType === constants.BSON_DATA_SYMBOL) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (
+ stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0
+ ) {
+ throw new BSONError('bad string length in bson');
+ }
+ const symbol = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ value = promoteValues ? symbol : new BSONSymbol(symbol);
+ index = index + stringSize;
+ } else if (elementType === constants.BSON_DATA_TIMESTAMP) {
+ value = new Timestamp({
+ i: NumberUtils.getUint32LE(buffer, index),
+ t: NumberUtils.getUint32LE(buffer, index + 4)
+ });
+ index += 8;
+ } else if (elementType === constants.BSON_DATA_MIN_KEY) {
+ value = new MinKey();
+ } else if (elementType === constants.BSON_DATA_MAX_KEY) {
+ value = new MaxKey();
+ } else if (elementType === constants.BSON_DATA_CODE) {
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ if (
+ stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0
+ ) {
+ throw new BSONError('bad string length in bson');
+ }
+ const functionString = ByteUtils.toUTF8(
+ buffer,
+ index,
+ index + stringSize - 1,
+ shouldValidateKey
+ );
+
+ value = new Code(functionString);
+
+ // Update parse index position
+ index = index + stringSize;
+ } else if (elementType === constants.BSON_DATA_CODE_W_SCOPE) {
+ const totalSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+
+ // Element cannot be shorter than totalSize + stringSize + documentSize + terminator
+ if (totalSize < 4 + 4 + 4 + 1) {
+ throw new BSONError('code_w_scope total size shorter minimum expected length');
+ }
+
+ // Get the code string size
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ // Check if we have a valid string
+ if (
+ stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0
+ ) {
+ throw new BSONError('bad string length in bson');
+ }
+
+ // Javascript function
+ const functionString = ByteUtils.toUTF8(
+ buffer,
+ index,
+ index + stringSize - 1,
+ shouldValidateKey
+ );
+ // Update parse index position
+ index = index + stringSize;
+ // Parse the element
+ const _index = index;
+ // Decode the size of the object document
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
+ // Decode the scope object
+ const scopeObject = deserializeObject(buffer, _index, options, false);
+ // Adjust the index
+ index = index + objectSize;
+
+ // Check if field length is too short
+ if (totalSize < 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too short, truncating scope');
+ }
+
+ // Check if totalSize field is too long
+ if (totalSize > 4 + 4 + objectSize + stringSize) {
+ throw new BSONError('code_w_scope total size is too long, clips outer document');
+ }
+
+ value = new Code(functionString, scopeObject);
+ } else if (elementType === constants.BSON_DATA_DBPOINTER) {
+ // Get the code string size
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
+ index += 4;
+ // Check if we have a valid string
+ if (
+ stringSize <= 0 ||
+ stringSize > buffer.length - index ||
+ buffer[index + stringSize - 1] !== 0
+ )
+ throw new BSONError('bad string length in bson');
+ // Namespace
+ const namespace = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
+ // Update parse index position
+ index = index + stringSize;
+
+ // Read the oid
+ const oidBuffer = ByteUtils.allocateUnsafe(12);
+ for (let i = 0; i < 12; i++) oidBuffer[i] = buffer[index + i];
+ const oid = new ObjectId(oidBuffer);
+
+ // Update the index
+ index = index + 12;
+
+ // Upgrade to DBRef type
+ value = new DBRef(namespace, oid);
+ } else {
+ throw new BSONError(
+ `Detected unknown BSON type ${elementType.toString(16)} for fieldname "${name}"`
+ );
+ }
+ if (name === '__proto__') {
+ Object.defineProperty(object, name, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ } else {
+ object[name] = value;
+ }
+ }
+
+ // Check if the deserialization was against a valid array/object
+ if (size !== index - startIndex) {
+ if (isArray) throw new BSONError('corrupt array bson');
+ throw new BSONError('corrupt object bson');
+ }
+
+ // if we did not find "$ref", "$id", "$db", or found an extraneous $key, don't make a DBRef
+ if (!isPossibleDBRef) return object;
+
+ if (isDBRefLike(object)) {
+ const copy = Object.assign({}, object) as Partial;
+ delete copy.$ref;
+ delete copy.$id;
+ delete copy.$db;
+ return new DBRef(object.$ref, object.$id, object.$db, copy);
+ }
+
+ return object;
+}
diff --git a/node_modules/bson/src/parser/on_demand/index.ts b/node_modules/bson/src/parser/on_demand/index.ts
new file mode 100644
index 00000000..f099c115
--- /dev/null
+++ b/node_modules/bson/src/parser/on_demand/index.ts
@@ -0,0 +1,32 @@
+import { ByteUtils } from '../../utils/byte_utils';
+import { NumberUtils } from '../../utils/number_utils';
+import { type BSONElement, parseToElements } from './parse_to_elements';
+/**
+ * @experimental
+ * @public
+ *
+ * A new set of BSON APIs that are currently experimental and not intended for production use.
+ */
+export type OnDemand = {
+ parseToElements: (this: void, bytes: Uint8Array, startOffset?: number) => Iterable;
+ // Types
+ BSONElement: BSONElement;
+
+ // Utils
+ ByteUtils: ByteUtils;
+ NumberUtils: NumberUtils;
+};
+
+/**
+ * @experimental
+ * @public
+ */
+const onDemand: OnDemand = Object.create(null);
+
+onDemand.parseToElements = parseToElements;
+onDemand.ByteUtils = ByteUtils;
+onDemand.NumberUtils = NumberUtils;
+
+Object.freeze(onDemand);
+
+export { onDemand };
diff --git a/node_modules/bson/src/parser/on_demand/parse_to_elements.ts b/node_modules/bson/src/parser/on_demand/parse_to_elements.ts
new file mode 100644
index 00000000..cc5366aa
--- /dev/null
+++ b/node_modules/bson/src/parser/on_demand/parse_to_elements.ts
@@ -0,0 +1,190 @@
+import { BSONOffsetError } from '../../error';
+import { NumberUtils } from '../../utils/number_utils';
+
+/**
+ * @internal
+ *
+ * @remarks
+ * - This enum is const so the code we produce will inline the numbers
+ * - `minKey` is set to 255 so unsigned comparisons succeed
+ * - Modify with caution, double check the bundle contains literals
+ */
+const BSONElementType = {
+ double: 1,
+ string: 2,
+ object: 3,
+ array: 4,
+ binData: 5,
+ undefined: 6,
+ objectId: 7,
+ bool: 8,
+ date: 9,
+ null: 10,
+ regex: 11,
+ dbPointer: 12,
+ javascript: 13,
+ symbol: 14,
+ javascriptWithScope: 15,
+ int: 16,
+ timestamp: 17,
+ long: 18,
+ decimal: 19,
+ minKey: 255,
+ maxKey: 127
+} as const;
+
+type BSONElementType = (typeof BSONElementType)[keyof typeof BSONElementType];
+
+/**
+ * @public
+ * @experimental
+ */
+export type BSONElement = [
+ type: number,
+ nameOffset: number,
+ nameLength: number,
+ offset: number,
+ length: number
+];
+
+function getSize(source: Uint8Array, offset: number) {
+ try {
+ return NumberUtils.getNonnegativeInt32LE(source, offset);
+ } catch (cause) {
+ throw new BSONOffsetError('BSON size cannot be negative', offset, { cause });
+ }
+}
+
+/**
+ * Searches for null terminator of a BSON element's value (Never the document null terminator)
+ * **Does not** bounds check since this should **ONLY** be used within parseToElements which has asserted that `bytes` ends with a `0x00`.
+ * So this will at most iterate to the document's terminator and error if that is the offset reached.
+ */
+function findNull(bytes: Uint8Array, offset: number): number {
+ let nullTerminatorOffset = offset;
+
+ for (; bytes[nullTerminatorOffset] !== 0x00; nullTerminatorOffset++);
+
+ if (nullTerminatorOffset === bytes.length - 1) {
+ // We reached the null terminator of the document, not a value's
+ throw new BSONOffsetError('Null terminator not found', offset);
+ }
+
+ return nullTerminatorOffset;
+}
+
+/**
+ * @public
+ * @experimental
+ */
+export function parseToElements(
+ bytes: Uint8Array,
+ startOffset: number | null = 0
+): Iterable {
+ startOffset ??= 0;
+
+ if (bytes.length < 5) {
+ throw new BSONOffsetError(
+ `Input must be at least 5 bytes, got ${bytes.length} bytes`,
+ startOffset
+ );
+ }
+
+ const documentSize = getSize(bytes, startOffset);
+
+ if (documentSize > bytes.length - startOffset) {
+ throw new BSONOffsetError(
+ `Parsed documentSize (${documentSize} bytes) does not match input length (${bytes.length} bytes)`,
+ startOffset
+ );
+ }
+
+ if (bytes[startOffset + documentSize - 1] !== 0x00) {
+ throw new BSONOffsetError('BSON documents must end in 0x00', startOffset + documentSize);
+ }
+
+ const elements: BSONElement[] = [];
+ let offset = startOffset + 4;
+
+ while (offset <= documentSize + startOffset) {
+ const type = bytes[offset];
+ offset += 1;
+
+ if (type === 0) {
+ if (offset - startOffset !== documentSize) {
+ throw new BSONOffsetError(`Invalid 0x00 type byte`, offset);
+ }
+ break;
+ }
+
+ const nameOffset = offset;
+ const nameLength = findNull(bytes, offset) - nameOffset;
+ offset += nameLength + 1;
+
+ let length: number;
+
+ if (
+ type === BSONElementType.double ||
+ type === BSONElementType.long ||
+ type === BSONElementType.date ||
+ type === BSONElementType.timestamp
+ ) {
+ length = 8;
+ } else if (type === BSONElementType.int) {
+ length = 4;
+ } else if (type === BSONElementType.objectId) {
+ length = 12;
+ } else if (type === BSONElementType.decimal) {
+ length = 16;
+ } else if (type === BSONElementType.bool) {
+ length = 1;
+ } else if (
+ type === BSONElementType.null ||
+ type === BSONElementType.undefined ||
+ type === BSONElementType.maxKey ||
+ type === BSONElementType.minKey
+ ) {
+ length = 0;
+ }
+ // Needs a size calculation
+ else if (type === BSONElementType.regex) {
+ length = findNull(bytes, findNull(bytes, offset) + 1) + 1 - offset;
+ } else if (
+ type === BSONElementType.object ||
+ type === BSONElementType.array ||
+ type === BSONElementType.javascriptWithScope
+ ) {
+ length = getSize(bytes, offset);
+ } else if (
+ type === BSONElementType.string ||
+ type === BSONElementType.binData ||
+ type === BSONElementType.dbPointer ||
+ type === BSONElementType.javascript ||
+ type === BSONElementType.symbol
+ ) {
+ length = getSize(bytes, offset) + 4;
+ if (type === BSONElementType.binData) {
+ // binary subtype
+ length += 1;
+ }
+ if (type === BSONElementType.dbPointer) {
+ // dbPointer's objectId
+ length += 12;
+ }
+ } else {
+ throw new BSONOffsetError(
+ `Invalid 0x${type.toString(16).padStart(2, '0')} type byte`,
+ offset
+ );
+ }
+
+ if (length > documentSize) {
+ throw new BSONOffsetError('value reports length larger than document', offset);
+ }
+
+ elements.push([type, nameOffset, nameLength, offset, length]);
+ offset += length;
+ }
+
+ return elements;
+}
diff --git a/node_modules/bson/src/parser/serializer.ts b/node_modules/bson/src/parser/serializer.ts
new file mode 100644
index 00000000..d76bd842
--- /dev/null
+++ b/node_modules/bson/src/parser/serializer.ts
@@ -0,0 +1,954 @@
+import { Binary, validateBinaryVector } from '../binary';
+import type { BSONSymbol, DBRef, Document, MaxKey } from '../bson';
+import type { Code } from '../code';
+import * as constants from '../constants';
+import type { DBRefLike } from '../db_ref';
+import type { Decimal128 } from '../decimal128';
+import type { Double } from '../double';
+import { BSONError, BSONVersionError } from '../error';
+import type { Int32 } from '../int_32';
+import { Long } from '../long';
+import type { MinKey } from '../min_key';
+import type { ObjectId } from '../objectid';
+import type { BSONRegExp } from '../regexp';
+import { ByteUtils } from '../utils/byte_utils';
+import { NumberUtils } from '../utils/number_utils';
+import { isAnyArrayBuffer, isDate, isMap, isRegExp, isUint8Array } from './utils';
+
+/** @public */
+export interface SerializeOptions {
+ /**
+ * the serializer will check if keys are valid.
+ * @defaultValue `false`
+ */
+ checkKeys?: boolean;
+ /**
+ * serialize the javascript functions
+ * @defaultValue `false`
+ */
+ serializeFunctions?: boolean;
+ /**
+ * serialize will not emit undefined fields
+ * note that the driver sets this to `false`
+ * @defaultValue `true`
+ */
+ ignoreUndefined?: boolean;
+ /** @internal Resize internal buffer */
+ minInternalBufferSize?: number;
+ /**
+ * the index in the buffer where we wish to start serializing into
+ * @defaultValue `0`
+ */
+ index?: number;
+}
+
+const regexp = /\x00/; // eslint-disable-line no-control-regex
+const ignoreKeys = new Set(['$db', '$ref', '$id', '$clusterTime']);
+
+/*
+ * isArray indicates if we are writing to a BSON array (type 0x04)
+ * which forces the "key" which really an array index as a string to be written as ascii
+ * This will catch any errors in index as a string generation
+ */
+
+function serializeString(buffer: Uint8Array, key: string, value: string, index: number) {
+ // Encode String type
+ buffer[index++] = constants.BSON_DATA_STRING;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes + 1;
+ buffer[index - 1] = 0;
+ // Write the string
+ const size = ByteUtils.encodeUTF8Into(buffer, value, index + 4);
+ // Write the size of the string to buffer
+ NumberUtils.setInt32LE(buffer, index, size + 1);
+ // Update index
+ index = index + 4 + size;
+ // Write zero
+ buffer[index++] = 0;
+ return index;
+}
+
+function serializeNumber(buffer: Uint8Array, key: string, value: number, index: number) {
+ const isNegativeZero = Object.is(value, -0);
+
+ const type =
+ !isNegativeZero &&
+ Number.isSafeInteger(value) &&
+ value <= constants.BSON_INT32_MAX &&
+ value >= constants.BSON_INT32_MIN
+ ? constants.BSON_DATA_INT
+ : constants.BSON_DATA_NUMBER;
+
+ buffer[index++] = type;
+
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0x00;
+
+ if (type === constants.BSON_DATA_INT) {
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ } else {
+ index += NumberUtils.setFloat64LE(buffer, index, value);
+ }
+
+ return index;
+}
+
+function serializeBigInt(buffer: Uint8Array, key: string, value: bigint, index: number) {
+ buffer[index++] = constants.BSON_DATA_LONG;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index += numberOfWrittenBytes;
+ buffer[index++] = 0;
+
+ index += NumberUtils.setBigInt64LE(buffer, index, value);
+
+ return index;
+}
+
+function serializeNull(buffer: Uint8Array, key: string, _: unknown, index: number) {
+ // Set long type
+ buffer[index++] = constants.BSON_DATA_NULL;
+
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+
+function serializeBoolean(buffer: Uint8Array, key: string, value: boolean, index: number) {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_BOOLEAN;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ // Encode the boolean value
+ buffer[index++] = value ? 1 : 0;
+ return index;
+}
+
+function serializeDate(buffer: Uint8Array, key: string, value: Date, index: number) {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_DATE;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+
+ // Write the date
+ const dateInMilis = Long.fromNumber(value.getTime());
+ const lowBits = dateInMilis.getLowBits();
+ const highBits = dateInMilis.getHighBits();
+ // Encode low bits
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ // Encode high bits
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+
+function serializeRegExp(buffer: Uint8Array, key: string, value: RegExp, index: number) {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_REGEXP;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ if (value.source && value.source.match(regexp) != null) {
+ throw new BSONError('value ' + value.source + ' must not contain null bytes');
+ }
+ // Adjust the index
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.source, index);
+ // Write zero
+ buffer[index++] = 0x00;
+ // Write the parameters
+ if (value.ignoreCase) buffer[index++] = 0x69; // i
+ if (value.global) buffer[index++] = 0x73; // s
+ if (value.multiline) buffer[index++] = 0x6d; // m
+
+ // Add ending zero
+ buffer[index++] = 0x00;
+ return index;
+}
+
+function serializeBSONRegExp(buffer: Uint8Array, key: string, value: BSONRegExp, index: number) {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_REGEXP;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+
+ // Check the pattern for 0 bytes
+ if (value.pattern.match(regexp) != null) {
+ // The BSON spec doesn't allow keys with null bytes because keys are
+ // null-terminated.
+ throw new BSONError('pattern ' + value.pattern + ' must not contain null bytes');
+ }
+
+ // Adjust the index
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.pattern, index);
+ // Write zero
+ buffer[index++] = 0x00;
+ // Write the options
+ const sortedOptions = value.options.split('').sort().join('');
+ index = index + ByteUtils.encodeUTF8Into(buffer, sortedOptions, index);
+ // Add ending zero
+ buffer[index++] = 0x00;
+ return index;
+}
+
+function serializeMinMax(buffer: Uint8Array, key: string, value: MinKey | MaxKey, index: number) {
+ // Write the type of either min or max key
+ if (value === null) {
+ buffer[index++] = constants.BSON_DATA_NULL;
+ } else if (value._bsontype === 'MinKey') {
+ buffer[index++] = constants.BSON_DATA_MIN_KEY;
+ } else {
+ buffer[index++] = constants.BSON_DATA_MAX_KEY;
+ }
+
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ return index;
+}
+
+function serializeObjectId(buffer: Uint8Array, key: string, value: ObjectId, index: number) {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_OID;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+
+ index += value.serializeInto(buffer, index);
+
+ // Adjust index
+ return index;
+}
+
+function serializeBuffer(buffer: Uint8Array, key: string, value: Uint8Array, index: number) {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_BINARY;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ // Get size of the buffer (current write point)
+ const size = value.length;
+ // Write the size of the string to buffer
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ // Write the default subtype
+ buffer[index++] = constants.BSON_BINARY_SUBTYPE_DEFAULT;
+ // Copy the content form the binary field to the buffer
+ if (size <= 16) {
+ for (let i = 0; i < size; i++) buffer[index + i] = value[i];
+ } else {
+ buffer.set(value, index);
+ }
+ // Adjust the index
+ index = index + size;
+ return index;
+}
+
+function serializeObject(
+ buffer: Uint8Array,
+ key: string,
+ value: Document,
+ index: number,
+ checkKeys: boolean,
+ depth: number,
+ serializeFunctions: boolean,
+ ignoreUndefined: boolean,
+ path: Set
+) {
+ if (path.has(value)) {
+ throw new BSONError('Cannot convert circular structure to BSON');
+ }
+
+ path.add(value);
+
+ // Write the type
+ buffer[index++] = Array.isArray(value) ? constants.BSON_DATA_ARRAY : constants.BSON_DATA_OBJECT;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ const endIndex = serializeInto(
+ buffer,
+ value,
+ checkKeys,
+ index,
+ depth + 1,
+ serializeFunctions,
+ ignoreUndefined,
+ path
+ );
+
+ path.delete(value);
+
+ return endIndex;
+}
+
+function serializeDecimal128(buffer: Uint8Array, key: string, value: Decimal128, index: number) {
+ buffer[index++] = constants.BSON_DATA_DECIMAL128;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ // Write the data from the value
+ for (let i = 0; i < 16; i++) buffer[index + i] = value.bytes[i];
+ return index + 16;
+}
+
+function serializeLong(buffer: Uint8Array, key: string, value: Long, index: number) {
+ // Write the type
+ buffer[index++] =
+ value._bsontype === 'Long' ? constants.BSON_DATA_LONG : constants.BSON_DATA_TIMESTAMP;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ // Write the date
+ const lowBits = value.getLowBits();
+ const highBits = value.getHighBits();
+ // Encode low bits
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
+ // Encode high bits
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
+ return index;
+}
+
+function serializeInt32(buffer: Uint8Array, key: string, value: Int32 | number, index: number) {
+ value = value.valueOf();
+ // Set int type 32 bits or less
+ buffer[index++] = constants.BSON_DATA_INT;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ // Write the int value
+ index += NumberUtils.setInt32LE(buffer, index, value);
+ return index;
+}
+
+function serializeDouble(buffer: Uint8Array, key: string, value: Double, index: number) {
+ // Encode as double
+ buffer[index++] = constants.BSON_DATA_NUMBER;
+
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+
+ // Write float
+ index += NumberUtils.setFloat64LE(buffer, index, value.value);
+
+ return index;
+}
+
+function serializeFunction(buffer: Uint8Array, key: string, value: Function, index: number) {
+ buffer[index++] = constants.BSON_DATA_CODE;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ // Function string
+ const functionString = value.toString();
+
+ // Write the string
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ // Write the size of the string to buffer
+ NumberUtils.setInt32LE(buffer, index, size);
+ // Update index
+ index = index + 4 + size - 1;
+ // Write zero
+ buffer[index++] = 0;
+ return index;
+}
+
+function serializeCode(
+ buffer: Uint8Array,
+ key: string,
+ value: Code,
+ index: number,
+ checkKeys = false,
+ depth = 0,
+ serializeFunctions = false,
+ ignoreUndefined = true,
+ path: Set
+) {
+ if (value.scope && typeof value.scope === 'object') {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_CODE_W_SCOPE;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+
+ // Starting index
+ let startIndex = index;
+
+ // Serialize the function
+ // Get the function string
+ const functionString = value.code;
+ // Index adjustment
+ index = index + 4;
+ // Write string into buffer
+ const codeSize = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ // Write the size of the string to buffer
+ NumberUtils.setInt32LE(buffer, index, codeSize);
+ // Write end 0
+ buffer[index + 4 + codeSize - 1] = 0;
+ // Write the
+ index = index + codeSize + 4;
+
+ // Serialize the scope value
+ const endIndex = serializeInto(
+ buffer,
+ value.scope,
+ checkKeys,
+ index,
+ depth + 1,
+ serializeFunctions,
+ ignoreUndefined,
+ path
+ );
+ index = endIndex - 1;
+
+ // Writ the total
+ const totalSize = endIndex - startIndex;
+
+ // Write the total size of the object
+ startIndex += NumberUtils.setInt32LE(buffer, startIndex, totalSize);
+ // Write trailing zero
+ buffer[index++] = 0;
+ } else {
+ buffer[index++] = constants.BSON_DATA_CODE;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ // Function string
+ const functionString = value.code.toString();
+ // Write the string
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
+ // Write the size of the string to buffer
+ NumberUtils.setInt32LE(buffer, index, size);
+ // Update index
+ index = index + 4 + size - 1;
+ // Write zero
+ buffer[index++] = 0;
+ }
+
+ return index;
+}
+
+function serializeBinary(buffer: Uint8Array, key: string, value: Binary, index: number) {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_BINARY;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ // Extract the buffer
+ const data = value.buffer;
+ // Calculate size
+ let size = value.position;
+ // Add the deprecated 02 type 4 bytes of size to total
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) size = size + 4;
+ // Write the size of the string to buffer
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ // Write the subtype to the buffer
+ buffer[index++] = value.sub_type;
+
+ // If we have binary type 2 the 4 first bytes are the size
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
+ size = size - 4;
+ index += NumberUtils.setInt32LE(buffer, index, size);
+ }
+
+ if (value.sub_type === Binary.SUBTYPE_VECTOR) {
+ validateBinaryVector(value);
+ }
+
+ if (size <= 16) {
+ for (let i = 0; i < size; i++) buffer[index + i] = data[i];
+ } else {
+ buffer.set(data, index);
+ }
+ // Adjust the index
+ index = index + value.position;
+ return index;
+}
+
+function serializeSymbol(buffer: Uint8Array, key: string, value: BSONSymbol, index: number) {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_SYMBOL;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+ // Write the string
+ const size = ByteUtils.encodeUTF8Into(buffer, value.value, index + 4) + 1;
+ // Write the size of the string to buffer
+ NumberUtils.setInt32LE(buffer, index, size);
+ // Update index
+ index = index + 4 + size - 1;
+ // Write zero
+ buffer[index++] = 0;
+ return index;
+}
+
+function serializeDBRef(
+ buffer: Uint8Array,
+ key: string,
+ value: DBRef,
+ index: number,
+ depth: number,
+ serializeFunctions: boolean,
+ path: Set
+) {
+ // Write the type
+ buffer[index++] = constants.BSON_DATA_OBJECT;
+ // Number of written bytes
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
+
+ // Encode the name
+ index = index + numberOfWrittenBytes;
+ buffer[index++] = 0;
+
+ let startIndex = index;
+ let output: DBRefLike = {
+ $ref: value.collection || value.namespace, // "namespace" was what library 1.x called "collection"
+ $id: value.oid
+ };
+
+ if (value.db != null) {
+ output.$db = value.db;
+ }
+
+ output = Object.assign(output, value.fields);
+ const endIndex = serializeInto(
+ buffer,
+ output,
+ false,
+ index,
+ depth + 1,
+ serializeFunctions,
+ true,
+ path
+ );
+
+ // Calculate object size
+ const size = endIndex - startIndex;
+ // Write the size
+ startIndex += NumberUtils.setInt32LE(buffer, index, size);
+ // Set index
+ return endIndex;
+}
+
+export function serializeInto(
+ buffer: Uint8Array,
+ object: Document,
+ checkKeys: boolean,
+ startingIndex: number,
+ depth: number,
+ serializeFunctions: boolean,
+ ignoreUndefined: boolean,
+ path: Set | null
+): number {
+ if (path == null) {
+ // We are at the root input
+ if (object == null) {
+ // ONLY the root should turn into an empty document
+ // BSON Empty document has a size of 5 (LE)
+ buffer[0] = 0x05;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+ // All documents end with null terminator
+ buffer[4] = 0x00;
+ return 5;
+ }
+
+ if (Array.isArray(object)) {
+ throw new BSONError('serialize does not support an array as the root input');
+ }
+ if (typeof object !== 'object') {
+ throw new BSONError('serialize does not support non-object as the root input');
+ } else if ('_bsontype' in object && typeof object._bsontype === 'string') {
+ throw new BSONError(`BSON types cannot be serialized as a document`);
+ } else if (
+ isDate(object) ||
+ isRegExp(object) ||
+ isUint8Array(object) ||
+ isAnyArrayBuffer(object)
+ ) {
+ throw new BSONError(`date, regexp, typedarray, and arraybuffer cannot be BSON documents`);
+ }
+
+ path = new Set();
+ }
+
+ // Push the object to the path
+ path.add(object);
+
+ // Start place to serialize into
+ let index = startingIndex + 4;
+
+ // Special case isArray
+ if (Array.isArray(object)) {
+ // Get object keys
+ for (let i = 0; i < object.length; i++) {
+ const key = `${i}`;
+ let value = object[i];
+
+ // Is there an override value
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+
+ // Check the type of the value
+ const type = typeof value;
+
+ if (value === undefined) {
+ index = serializeNull(buffer, key, value, index);
+ } else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ } else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ } else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ } else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ } else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ } else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ } else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ } else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ } else {
+ index = serializeObject(
+ buffer,
+ key,
+ value,
+ index,
+ checkKeys,
+ depth,
+ serializeFunctions,
+ ignoreUndefined,
+ path
+ );
+ }
+ } else if (type === 'object') {
+ if (value[constants.BSON_VERSION_SYMBOL] !== constants.BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ } else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ } else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ } else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ } else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ } else if (value._bsontype === 'Code') {
+ index = serializeCode(
+ buffer,
+ key,
+ value,
+ index,
+ checkKeys,
+ depth,
+ serializeFunctions,
+ ignoreUndefined,
+ path
+ );
+ } else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ } else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ } else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ } else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ } else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ } else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ } else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ } else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ } else if (object instanceof Map || isMap(object)) {
+ const iterator = object.entries();
+ let done = false;
+
+ while (!done) {
+ // Unpack the next entry
+ const entry = iterator.next();
+ done = !!entry.done;
+ // Are we done, then skip and terminate
+ if (done) continue;
+
+ // Get the entry values
+ const key = entry.value ? entry.value[0] : undefined;
+ let value = entry.value ? entry.value[1] : undefined;
+
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+
+ // Check the type of the value
+ const type = typeof value;
+
+ // Check the key and throw error if it's illegal
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ // The BSON spec doesn't allow keys with null bytes because keys are
+ // null-terminated.
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ } else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+
+ if (value === undefined) {
+ if (ignoreUndefined === false) index = serializeNull(buffer, key, value, index);
+ } else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ } else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ } else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ } else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ } else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ } else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ } else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ } else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ } else {
+ index = serializeObject(
+ buffer,
+ key,
+ value,
+ index,
+ checkKeys,
+ depth,
+ serializeFunctions,
+ ignoreUndefined,
+ path
+ );
+ }
+ } else if (type === 'object') {
+ if (value[constants.BSON_VERSION_SYMBOL] !== constants.BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ } else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ } else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ } else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ } else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ } else if (value._bsontype === 'Code') {
+ index = serializeCode(
+ buffer,
+ key,
+ value,
+ index,
+ checkKeys,
+ depth,
+ serializeFunctions,
+ ignoreUndefined,
+ path
+ );
+ } else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ } else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ } else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ } else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ } else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ } else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ } else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ } else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ } else {
+ if (typeof object?.toBSON === 'function') {
+ // Provided a custom serialization method
+ object = object.toBSON();
+ if (object != null && typeof object !== 'object') {
+ throw new BSONError('toBSON function did not return an object');
+ }
+ }
+
+ // Iterate over all the keys
+ for (const key of Object.keys(object)) {
+ let value = object[key];
+ // Is there an override value
+ if (typeof value?.toBSON === 'function') {
+ value = value.toBSON();
+ }
+
+ // Check the type of the value
+ const type = typeof value;
+
+ // Check the key and throw error if it's illegal
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
+ if (key.match(regexp) != null) {
+ // The BSON spec doesn't allow keys with null bytes because keys are
+ // null-terminated.
+ throw new BSONError('key ' + key + ' must not contain null bytes');
+ }
+
+ if (checkKeys) {
+ if ('$' === key[0]) {
+ throw new BSONError('key ' + key + " must not start with '$'");
+ } else if (key.includes('.')) {
+ throw new BSONError('key ' + key + " must not contain '.'");
+ }
+ }
+ }
+
+ if (value === undefined) {
+ if (ignoreUndefined === false) index = serializeNull(buffer, key, value, index);
+ } else if (value === null) {
+ index = serializeNull(buffer, key, value, index);
+ } else if (type === 'string') {
+ index = serializeString(buffer, key, value, index);
+ } else if (type === 'number') {
+ index = serializeNumber(buffer, key, value, index);
+ } else if (type === 'bigint') {
+ index = serializeBigInt(buffer, key, value, index);
+ } else if (type === 'boolean') {
+ index = serializeBoolean(buffer, key, value, index);
+ } else if (type === 'object' && value._bsontype == null) {
+ if (value instanceof Date || isDate(value)) {
+ index = serializeDate(buffer, key, value, index);
+ } else if (value instanceof Uint8Array || isUint8Array(value)) {
+ index = serializeBuffer(buffer, key, value, index);
+ } else if (value instanceof RegExp || isRegExp(value)) {
+ index = serializeRegExp(buffer, key, value, index);
+ } else {
+ index = serializeObject(
+ buffer,
+ key,
+ value,
+ index,
+ checkKeys,
+ depth,
+ serializeFunctions,
+ ignoreUndefined,
+ path
+ );
+ }
+ } else if (type === 'object') {
+ if (value[constants.BSON_VERSION_SYMBOL] !== constants.BSON_MAJOR_VERSION) {
+ throw new BSONVersionError();
+ } else if (value._bsontype === 'ObjectId') {
+ index = serializeObjectId(buffer, key, value, index);
+ } else if (value._bsontype === 'Decimal128') {
+ index = serializeDecimal128(buffer, key, value, index);
+ } else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
+ index = serializeLong(buffer, key, value, index);
+ } else if (value._bsontype === 'Double') {
+ index = serializeDouble(buffer, key, value, index);
+ } else if (value._bsontype === 'Code') {
+ index = serializeCode(
+ buffer,
+ key,
+ value,
+ index,
+ checkKeys,
+ depth,
+ serializeFunctions,
+ ignoreUndefined,
+ path
+ );
+ } else if (value._bsontype === 'Binary') {
+ index = serializeBinary(buffer, key, value, index);
+ } else if (value._bsontype === 'BSONSymbol') {
+ index = serializeSymbol(buffer, key, value, index);
+ } else if (value._bsontype === 'DBRef') {
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
+ } else if (value._bsontype === 'BSONRegExp') {
+ index = serializeBSONRegExp(buffer, key, value, index);
+ } else if (value._bsontype === 'Int32') {
+ index = serializeInt32(buffer, key, value, index);
+ } else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
+ index = serializeMinMax(buffer, key, value, index);
+ } else if (typeof value._bsontype !== 'undefined') {
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
+ }
+ } else if (type === 'function' && serializeFunctions) {
+ index = serializeFunction(buffer, key, value, index);
+ }
+ }
+ }
+
+ // Remove the path
+ path.delete(object);
+
+ // Final padding byte for object
+ buffer[index++] = 0x00;
+
+ // Final size
+ const size = index - startingIndex;
+ // Write the size of the object
+ startingIndex += NumberUtils.setInt32LE(buffer, startingIndex, size);
+ return index;
+}
diff --git a/node_modules/bson/src/parser/utils.ts b/node_modules/bson/src/parser/utils.ts
new file mode 100644
index 00000000..2e383991
--- /dev/null
+++ b/node_modules/bson/src/parser/utils.ts
@@ -0,0 +1,69 @@
+const TypedArrayPrototypeGetSymbolToStringTag = (() => {
+ // Type check system lovingly referenced from:
+ // https://github.com/nodejs/node/blob/7450332339ed40481f470df2a3014e2ec355d8d8/lib/internal/util/types.js#L13-L15
+ // eslint-disable-next-line @typescript-eslint/unbound-method -- the intention is to call this method with a bound value
+ const g = Object.getOwnPropertyDescriptor(
+ Object.getPrototypeOf(Uint8Array.prototype),
+ Symbol.toStringTag
+ )!.get!;
+
+ return (value: unknown) => g.call(value);
+})();
+
+export function isUint8Array(value: unknown): value is Uint8Array {
+ return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array';
+}
+
+export function isAnyArrayBuffer(value: unknown): value is ArrayBuffer {
+ return (
+ typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ (value[Symbol.toStringTag] === 'ArrayBuffer' ||
+ value[Symbol.toStringTag] === 'SharedArrayBuffer')
+ );
+}
+
+export function isRegExp(regexp: unknown): regexp is RegExp {
+ return regexp instanceof RegExp || Object.prototype.toString.call(regexp) === '[object RegExp]';
+}
+
+export function isMap(value: unknown): value is Map {
+ return (
+ typeof value === 'object' &&
+ value != null &&
+ Symbol.toStringTag in value &&
+ value[Symbol.toStringTag] === 'Map'
+ );
+}
+
+export function isDate(date: unknown): date is Date {
+ return date instanceof Date || Object.prototype.toString.call(date) === '[object Date]';
+}
+
+export type InspectFn = (x: unknown, options?: unknown) => string;
+export function defaultInspect(x: unknown, _options?: unknown): string {
+ return JSON.stringify(x, (k: string, v: unknown) => {
+ if (typeof v === 'bigint') {
+ return { $numberLong: `${v}` };
+ } else if (isMap(v)) {
+ return Object.fromEntries(v);
+ }
+ return v;
+ });
+}
+
+/** @internal */
+type StylizeFunction = (x: string, style: string) => string;
+/** @internal */
+export function getStylizeFunction(options?: unknown): StylizeFunction | undefined {
+ const stylizeExists =
+ options != null &&
+ typeof options === 'object' &&
+ 'stylize' in options &&
+ typeof options.stylize === 'function';
+
+ if (stylizeExists) {
+ return options.stylize as StylizeFunction;
+ }
+}
diff --git a/node_modules/bson/src/regexp.ts b/node_modules/bson/src/regexp.ts
new file mode 100644
index 00000000..e401a290
--- /dev/null
+++ b/node_modules/bson/src/regexp.ts
@@ -0,0 +1,114 @@
+import { BSONValue } from './bson_value';
+import { BSONError } from './error';
+import type { EJSONOptions } from './extended_json';
+import { type InspectFn, defaultInspect, getStylizeFunction } from './parser/utils';
+
+function alphabetize(str: string): string {
+ return str.split('').sort().join('');
+}
+
+/** @public */
+export interface BSONRegExpExtendedLegacy {
+ $regex: string | BSONRegExp;
+ $options: string;
+}
+
+/** @public */
+export interface BSONRegExpExtended {
+ $regularExpression: {
+ pattern: string;
+ options: string;
+ };
+}
+
+/**
+ * A class representation of the BSON RegExp type.
+ * @public
+ * @category BSONType
+ */
+export class BSONRegExp extends BSONValue {
+ get _bsontype(): 'BSONRegExp' {
+ return 'BSONRegExp';
+ }
+
+ pattern!: string;
+ options!: string;
+ /**
+ * @param pattern - The regular expression pattern to match
+ * @param options - The regular expression options
+ */
+ constructor(pattern: string, options?: string) {
+ super();
+ this.pattern = pattern;
+ this.options = alphabetize(options ?? '');
+
+ if (this.pattern.indexOf('\x00') !== -1) {
+ throw new BSONError(
+ `BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}`
+ );
+ }
+ if (this.options.indexOf('\x00') !== -1) {
+ throw new BSONError(
+ `BSON Regex options cannot contain null bytes, found: ${JSON.stringify(this.options)}`
+ );
+ }
+
+ // Validate options
+ for (let i = 0; i < this.options.length; i++) {
+ if (
+ !(
+ this.options[i] === 'i' ||
+ this.options[i] === 'm' ||
+ this.options[i] === 'x' ||
+ this.options[i] === 'l' ||
+ this.options[i] === 's' ||
+ this.options[i] === 'u'
+ )
+ ) {
+ throw new BSONError(`The regular expression option [${this.options[i]}] is not supported`);
+ }
+ }
+ }
+
+ static parseOptions(options?: string): string {
+ return options ? options.split('').sort().join('') : '';
+ }
+
+ /** @internal */
+ toExtendedJSON(options?: EJSONOptions): BSONRegExpExtendedLegacy | BSONRegExpExtended {
+ options = options || {};
+ if (options.legacy) {
+ return { $regex: this.pattern, $options: this.options };
+ }
+ return { $regularExpression: { pattern: this.pattern, options: this.options } };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(doc: BSONRegExpExtendedLegacy | BSONRegExpExtended): BSONRegExp {
+ if ('$regex' in doc) {
+ if (typeof doc.$regex !== 'string') {
+ // This is for $regex query operators that have extended json values.
+ if (doc.$regex._bsontype === 'BSONRegExp') {
+ return doc as unknown as BSONRegExp;
+ }
+ } else {
+ return new BSONRegExp(doc.$regex, BSONRegExp.parseOptions(doc.$options));
+ }
+ }
+ if ('$regularExpression' in doc) {
+ return new BSONRegExp(
+ doc.$regularExpression.pattern,
+ BSONRegExp.parseOptions(doc.$regularExpression.options)
+ );
+ }
+ throw new BSONError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(doc)}`);
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ const stylize = getStylizeFunction(options) ?? (v => v);
+ inspect ??= defaultInspect;
+ const pattern = stylize(inspect(this.pattern), 'regexp');
+ const flags = stylize(inspect(this.options), 'regexp');
+ return `new BSONRegExp(${pattern}, ${flags})`;
+ }
+}
diff --git a/node_modules/bson/src/symbol.ts b/node_modules/bson/src/symbol.ts
new file mode 100644
index 00000000..6835ab95
--- /dev/null
+++ b/node_modules/bson/src/symbol.ts
@@ -0,0 +1,55 @@
+import { BSONValue } from './bson_value';
+import { type InspectFn, defaultInspect } from './parser/utils';
+
+/** @public */
+export interface BSONSymbolExtended {
+ $symbol: string;
+}
+
+/**
+ * A class representation of the BSON Symbol type.
+ * @public
+ * @category BSONType
+ */
+export class BSONSymbol extends BSONValue {
+ get _bsontype(): 'BSONSymbol' {
+ return 'BSONSymbol';
+ }
+
+ value!: string;
+ /**
+ * @param value - the string representing the symbol.
+ */
+ constructor(value: string) {
+ super();
+ this.value = value;
+ }
+
+ /** Access the wrapped string value. */
+ valueOf(): string {
+ return this.value;
+ }
+
+ toString(): string {
+ return this.value;
+ }
+
+ toJSON(): string {
+ return this.value;
+ }
+
+ /** @internal */
+ toExtendedJSON(): BSONSymbolExtended {
+ return { $symbol: this.value };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(doc: BSONSymbolExtended): BSONSymbol {
+ return new BSONSymbol(doc.$symbol);
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ return `new BSONSymbol(${inspect(this.value, options)})`;
+ }
+}
diff --git a/node_modules/bson/src/timestamp.ts b/node_modules/bson/src/timestamp.ts
new file mode 100644
index 00000000..8e169a83
--- /dev/null
+++ b/node_modules/bson/src/timestamp.ts
@@ -0,0 +1,176 @@
+import { bsonType } from './bson_value';
+import { BSONError } from './error';
+import type { Int32 } from './int_32';
+import { Long } from './long';
+import { type InspectFn, defaultInspect } from './parser/utils';
+
+/** @public */
+export type TimestampOverrides =
+ | '_bsontype'
+ | 'toExtendedJSON'
+ | 'fromExtendedJSON'
+ | 'inspect'
+ | typeof bsonType;
+/** @public */
+export type LongWithoutOverrides = new (
+ low: unknown,
+ high?: number | boolean,
+ unsigned?: boolean
+) => {
+ [P in Exclude]: Long[P];
+};
+/** @public */
+export const LongWithoutOverridesClass: LongWithoutOverrides =
+ Long as unknown as LongWithoutOverrides;
+
+/** @public */
+export interface TimestampExtended {
+ $timestamp: {
+ t: number;
+ i: number;
+ };
+}
+
+/**
+ * @public
+ * @category BSONType
+ *
+ * A special type for _internal_ MongoDB use and is **not** associated with the regular Date type.
+ */
+export class Timestamp extends LongWithoutOverridesClass {
+ get _bsontype(): 'Timestamp' {
+ return 'Timestamp';
+ }
+ get [bsonType](): 'Timestamp' {
+ return 'Timestamp';
+ }
+
+ static readonly MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
+
+ /**
+ * An incrementing ordinal for operations within a given second.
+ */
+ get i(): number {
+ return this.low >>> 0;
+ }
+
+ /**
+ * A `time_t` value measuring seconds since the Unix epoch
+ */
+ get t(): number {
+ return this.high >>> 0;
+ }
+
+ /**
+ * @param int - A 64-bit bigint representing the Timestamp.
+ */
+ constructor(int: bigint);
+ /**
+ * @param long - A 64-bit Long representing the Timestamp.
+ */
+ constructor(long: Long);
+ /**
+ * @param value - A pair of two values indicating timestamp and increment.
+ */
+ constructor(value: { t: number; i: number });
+ constructor(low?: bigint | Long | { t: number | Int32; i: number | Int32 }) {
+ if (low == null) {
+ super(0, 0, true);
+ } else if (typeof low === 'bigint') {
+ super(low, true);
+ } else if (Long.isLong(low)) {
+ super(low.low, low.high, true);
+ } else if (typeof low === 'object' && 't' in low && 'i' in low) {
+ if (typeof low.t !== 'number' && (typeof low.t !== 'object' || low.t._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide t as a number');
+ }
+ if (typeof low.i !== 'number' && (typeof low.i !== 'object' || low.i._bsontype !== 'Int32')) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide i as a number');
+ }
+ const t = Number(low.t);
+ const i = Number(low.i);
+ if (t < 0 || Number.isNaN(t)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive t');
+ }
+ if (i < 0 || Number.isNaN(i)) {
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive i');
+ }
+ if (t > 0xffff_ffff) {
+ throw new BSONError(
+ 'Timestamp constructed from { t, i } must provide t equal or less than uint32 max'
+ );
+ }
+ if (i > 0xffff_ffff) {
+ throw new BSONError(
+ 'Timestamp constructed from { t, i } must provide i equal or less than uint32 max'
+ );
+ }
+
+ super(i, t, true);
+ } else {
+ throw new BSONError(
+ 'A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }'
+ );
+ }
+ }
+
+ toJSON(): { $timestamp: string } {
+ return {
+ $timestamp: this.toString()
+ };
+ }
+
+ /** Returns a Timestamp represented by the given (32-bit) integer value. */
+ static fromInt(value: number): Timestamp {
+ return new Timestamp(Long.fromInt(value, true));
+ }
+
+ /** Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned. */
+ static fromNumber(value: number): Timestamp {
+ return new Timestamp(Long.fromNumber(value, true));
+ }
+
+ /**
+ * Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits.
+ *
+ * @param lowBits - the low 32-bits.
+ * @param highBits - the high 32-bits.
+ */
+ static fromBits(lowBits: number, highBits: number): Timestamp {
+ return new Timestamp({ i: lowBits, t: highBits });
+ }
+
+ /**
+ * Returns a Timestamp from the given string, optionally using the given radix.
+ *
+ * @param str - the textual representation of the Timestamp.
+ * @param optRadix - the radix in which the text is written.
+ */
+ static fromString(str: string, optRadix: number): Timestamp {
+ return new Timestamp(Long.fromString(str, true, optRadix));
+ }
+
+ /** @internal */
+ toExtendedJSON(): TimestampExtended {
+ return { $timestamp: { t: this.t, i: this.i } };
+ }
+
+ /** @internal */
+ static fromExtendedJSON(doc: TimestampExtended): Timestamp {
+ // The Long check is necessary because extended JSON has different behavior given the size of the input number
+ const i = Long.isLong(doc.$timestamp.i)
+ ? doc.$timestamp.i.getLowBitsUnsigned() // Need to fetch the least significant 32 bits
+ : doc.$timestamp.i;
+ const t = Long.isLong(doc.$timestamp.t)
+ ? doc.$timestamp.t.getLowBitsUnsigned() // Need to fetch the least significant 32 bits
+ : doc.$timestamp.t;
+ return new Timestamp({ t, i });
+ }
+
+ inspect(depth?: number, options?: unknown, inspect?: InspectFn): string {
+ inspect ??= defaultInspect;
+ const t = inspect(this.t, options);
+ const i = inspect(this.i, options);
+ return `new Timestamp({ t: ${t}, i: ${i} })`;
+ }
+}
diff --git a/node_modules/bson/src/utils/byte_utils.ts b/node_modules/bson/src/utils/byte_utils.ts
new file mode 100644
index 00000000..376258bf
--- /dev/null
+++ b/node_modules/bson/src/utils/byte_utils.ts
@@ -0,0 +1,80 @@
+import { nodeJsByteUtils } from './node_byte_utils';
+import { webByteUtils } from './web_byte_utils';
+
+/**
+ * @public
+ * @experimental
+ *
+ * A collection of functions that help work with data in a Uint8Array.
+ * ByteUtils is configured at load time to use Node.js or Web based APIs for the internal implementations.
+ */
+export type ByteUtils = {
+ /** Checks if the given value is a Uint8Array. */
+ isUint8Array: (value: unknown) => value is Uint8Array;
+ /** Transforms the input to an instance of Buffer if running on node, otherwise Uint8Array */
+ toLocalBufferType: (buffer: Uint8Array | ArrayBufferView | ArrayBuffer) => Uint8Array;
+ /** Create empty space of size */
+ allocate: (size: number) => Uint8Array;
+ /** Create empty space of size, use pooled memory when available */
+ allocateUnsafe: (size: number) => Uint8Array;
+ /** Compare 2 Uint8Arrays lexicographically */
+ compare: (buffer1: Uint8Array, buffer2: Uint8Array) => -1 | 0 | 1;
+ /** Concatenating all the Uint8Arrays in new Uint8Array. */
+ concat: (list: Uint8Array[]) => Uint8Array;
+ /** Copy bytes from source Uint8Array to target Uint8Array */
+ copy: (
+ source: Uint8Array,
+ target: Uint8Array,
+ targetStart?: number,
+ sourceStart?: number,
+ sourceEnd?: number
+ ) => number;
+ /** Check if two Uint8Arrays are deep equal */
+ equals: (a: Uint8Array, b: Uint8Array) => boolean;
+ /** Create a Uint8Array from an array of numbers */
+ fromNumberArray: (array: number[]) => Uint8Array;
+ /** Create a Uint8Array from a base64 string */
+ fromBase64: (base64: string) => Uint8Array;
+ /** Create a Uint8Array from a UTF8 string */
+ fromUTF8: (utf8: string) => Uint8Array;
+ /** Create a base64 string from bytes */
+ toBase64: (buffer: Uint8Array) => string;
+ /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
+ fromISO88591: (codePoints: string) => Uint8Array;
+ /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
+ toISO88591: (buffer: Uint8Array) => string;
+ /** Create a Uint8Array from a hex string */
+ fromHex: (hex: string) => Uint8Array;
+ /** Create a lowercase hex string from bytes */
+ toHex: (buffer: Uint8Array) => string;
+ /** Create a string from utf8 code units, fatal=true will throw an error if UTF-8 bytes are invalid, fatal=false will insert replacement characters */
+ toUTF8: (buffer: Uint8Array, start: number, end: number, fatal: boolean) => string;
+ /** Get the utf8 code unit count from a string if it were to be transformed to utf8 */
+ utf8ByteLength: (input: string) => number;
+ /** Encode UTF8 bytes generated from `source` string into `destination` at byteOffset. Returns the number of bytes encoded. */
+ encodeUTF8Into: (destination: Uint8Array, source: string, byteOffset: number) => number;
+ /** Generate a Uint8Array filled with random bytes with byteLength */
+ randomBytes: (byteLength: number) => Uint8Array;
+ /** Interprets `buffer` as an array of 32-bit values and swaps the byte order in-place. */
+ swap32: (buffer: Uint8Array) => Uint8Array;
+};
+
+declare const Buffer: { new (): unknown; prototype?: { _isBuffer?: boolean } } | undefined;
+
+/**
+ * Check that a global Buffer exists that is a function and
+ * does not have a '_isBuffer' property defined on the prototype
+ * (this is to prevent using the npm buffer)
+ */
+const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true;
+
+/**
+ * This is the only ByteUtils that should be used across the rest of the BSON library.
+ *
+ * The type annotation is important here, it asserts that each of the platform specific
+ * utils implementations are compatible with the common one.
+ *
+ * @public
+ * @experimental
+ */
+export const ByteUtils: ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
diff --git a/node_modules/bson/src/utils/latin.ts b/node_modules/bson/src/utils/latin.ts
new file mode 100644
index 00000000..5dd5c91f
--- /dev/null
+++ b/node_modules/bson/src/utils/latin.ts
@@ -0,0 +1,104 @@
+/**
+ * This function is an optimization for small basic latin strings.
+ * @internal
+ * @remarks
+ * ### Important characteristics:
+ * - If the uint8array or distance between start and end is 0 this function returns an empty string
+ * - If the byteLength of the string is 1, 2, or 3 we invoke String.fromCharCode and manually offset into the buffer
+ * - If the byteLength of the string is less than or equal to 20 an array of bytes is built and `String.fromCharCode.apply` is called with the result
+ * - If any byte exceeds 128 this function returns null
+ *
+ * @param uint8array - A sequence of bytes that may contain basic latin characters
+ * @param start - The start index from which to search the uint8array
+ * @param end - The index to stop searching the uint8array
+ * @returns string if all bytes are within the basic latin range, otherwise null
+ */
+export function tryReadBasicLatin(
+ uint8array: Uint8Array,
+ start: number,
+ end: number
+): string | null {
+ if (uint8array.length === 0) {
+ return '';
+ }
+
+ const stringByteLength = end - start;
+ if (stringByteLength === 0) {
+ return '';
+ }
+
+ if (stringByteLength > 20) {
+ return null;
+ }
+
+ if (stringByteLength === 1 && uint8array[start] < 128) {
+ return String.fromCharCode(uint8array[start]);
+ }
+
+ if (stringByteLength === 2 && uint8array[start] < 128 && uint8array[start + 1] < 128) {
+ return String.fromCharCode(uint8array[start]) + String.fromCharCode(uint8array[start + 1]);
+ }
+
+ if (
+ stringByteLength === 3 &&
+ uint8array[start] < 128 &&
+ uint8array[start + 1] < 128 &&
+ uint8array[start + 2] < 128
+ ) {
+ return (
+ String.fromCharCode(uint8array[start]) +
+ String.fromCharCode(uint8array[start + 1]) +
+ String.fromCharCode(uint8array[start + 2])
+ );
+ }
+
+ const latinBytes = [];
+ for (let i = start; i < end; i++) {
+ const byte = uint8array[i];
+ if (byte > 127) {
+ return null;
+ }
+ latinBytes.push(byte);
+ }
+
+ return String.fromCharCode(...latinBytes);
+}
+
+/**
+ * This function is an optimization for writing small basic latin strings.
+ * @internal
+ * @remarks
+ * ### Important characteristics:
+ * - If the string length is 0 return 0, do not perform any work
+ * - If a string is longer than 25 code units return null
+ * - If any code unit exceeds 128 this function returns null
+ *
+ * @param destination - The uint8array to serialize the string to
+ * @param source - The string to turn into UTF-8 bytes if it fits in the basic latin range
+ * @param offset - The position in the destination to begin writing bytes to
+ * @returns the number of bytes written to destination if all code units are below 128, otherwise null
+ */
+export function tryWriteBasicLatin(
+ destination: Uint8Array,
+ source: string,
+ offset: number
+): number | null {
+ if (source.length === 0) return 0;
+
+ if (source.length > 25) return null;
+
+ if (destination.length - offset < source.length) return null;
+
+ for (
+ let charOffset = 0, destinationOffset = offset;
+ charOffset < source.length;
+ charOffset++, destinationOffset++
+ ) {
+ const char = source.charCodeAt(charOffset);
+ if (char > 127) return null;
+
+ destination[destinationOffset] = char;
+ }
+
+ return source.length;
+}
diff --git a/node_modules/bson/src/utils/node_byte_utils.ts b/node_modules/bson/src/utils/node_byte_utils.ts
new file mode 100644
index 00000000..eaad4080
--- /dev/null
+++ b/node_modules/bson/src/utils/node_byte_utils.ts
@@ -0,0 +1,193 @@
+import { BSONError } from '../error';
+import { parseUtf8 } from '../parse_utf8';
+import { tryReadBasicLatin, tryWriteBasicLatin } from './latin';
+import { isUint8Array } from '../parser/utils';
+
+type NodeJsEncoding = 'base64' | 'hex' | 'utf8' | 'binary';
+type NodeJsBuffer = ArrayBufferView &
+ Uint8Array & {
+ write(string: string, offset: number, length: undefined, encoding: 'utf8'): number;
+ copy(target: Uint8Array, targetStart: number, sourceStart: number, sourceEnd: number): number;
+ toString: (this: Uint8Array, encoding: NodeJsEncoding, start?: number, end?: number) => string;
+ equals: (this: Uint8Array, other: Uint8Array) => boolean;
+ swap32: (this: NodeJsBuffer) => NodeJsBuffer;
+ compare: (this: Uint8Array, other: Uint8Array) => -1 | 0 | 1;
+ };
+type NodeJsBufferConstructor = Omit & {
+ alloc: (size: number) => NodeJsBuffer;
+ allocUnsafe: (size: number) => NodeJsBuffer;
+ from(array: number[]): NodeJsBuffer;
+ from(array: Uint8Array): NodeJsBuffer;
+ from(array: ArrayBuffer): NodeJsBuffer;
+ from(array: ArrayBufferLike, byteOffset: number, byteLength: number): NodeJsBuffer;
+ from(base64: string, encoding: NodeJsEncoding): NodeJsBuffer;
+ byteLength(input: string, encoding: 'utf8'): number;
+ isBuffer(value: unknown): value is NodeJsBuffer;
+ concat(list: Uint8Array[]): NodeJsBuffer;
+};
+
+// This can be nullish, but we gate the nodejs functions on being exported whether or not this exists
+// Node.js global
+declare const Buffer: NodeJsBufferConstructor;
+
+/** @internal */
+function nodejsMathRandomBytes(byteLength: number): NodeJsBuffer {
+ return nodeJsByteUtils.fromNumberArray(
+ Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256))
+ );
+}
+
+/** @internal */
+function nodejsSecureRandomBytes(byteLength: number): NodeJsBuffer {
+ // @ts-expect-error: crypto.getRandomValues cannot actually be null here
+ return crypto.getRandomValues(nodeJsByteUtils.allocate(byteLength));
+}
+
+const nodejsRandomBytes = (() => {
+ const { crypto } = globalThis as {
+ crypto?: { getRandomValues?: (space: Uint8Array) => Uint8Array };
+ };
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return nodejsSecureRandomBytes;
+ } else {
+ return nodejsMathRandomBytes;
+ }
+})();
+
+/**
+ * @public
+ * @experimental
+ */
+export const nodeJsByteUtils = {
+ isUint8Array: isUint8Array,
+
+ toLocalBufferType(potentialBuffer: Uint8Array | NodeJsBuffer | ArrayBuffer): NodeJsBuffer {
+ if (Buffer.isBuffer(potentialBuffer)) {
+ return potentialBuffer;
+ }
+
+ if (ArrayBuffer.isView(potentialBuffer)) {
+ return Buffer.from(
+ potentialBuffer.buffer,
+ potentialBuffer.byteOffset,
+ potentialBuffer.byteLength
+ );
+ }
+
+ const stringTag =
+ potentialBuffer?.[Symbol.toStringTag] ?? Object.prototype.toString.call(potentialBuffer);
+ if (
+ stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]'
+ ) {
+ return Buffer.from(potentialBuffer);
+ }
+
+ throw new BSONError(`Cannot create Buffer from the passed potentialBuffer.`);
+ },
+
+ allocate(size: number): NodeJsBuffer {
+ return Buffer.alloc(size);
+ },
+
+ allocateUnsafe(size: number): NodeJsBuffer {
+ return Buffer.allocUnsafe(size);
+ },
+
+ compare(a: Uint8Array, b: Uint8Array) {
+ return nodeJsByteUtils.toLocalBufferType(a).compare(b);
+ },
+
+ concat(list: Uint8Array[]): NodeJsBuffer {
+ return Buffer.concat(list);
+ },
+
+ copy(
+ source: Uint8Array,
+ target: Uint8Array,
+ targetStart?: number,
+ sourceStart?: number,
+ sourceEnd?: number
+ ): number {
+ return nodeJsByteUtils
+ .toLocalBufferType(source)
+ .copy(target, targetStart ?? 0, sourceStart ?? 0, sourceEnd ?? source.length);
+ },
+
+ equals(a: Uint8Array, b: Uint8Array): boolean {
+ return nodeJsByteUtils.toLocalBufferType(a).equals(b);
+ },
+
+ fromNumberArray(array: number[]): NodeJsBuffer {
+ return Buffer.from(array);
+ },
+
+ fromBase64(base64: string): NodeJsBuffer {
+ return Buffer.from(base64, 'base64');
+ },
+
+ fromUTF8(utf8: string): NodeJsBuffer {
+ return Buffer.from(utf8, 'utf8');
+ },
+
+ toBase64(buffer: Uint8Array): string {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('base64');
+ },
+
+ /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
+ fromISO88591(codePoints: string): NodeJsBuffer {
+ return Buffer.from(codePoints, 'binary');
+ },
+
+ /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
+ toISO88591(buffer: Uint8Array): string {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('binary');
+ },
+
+ fromHex(hex: string): NodeJsBuffer {
+ return Buffer.from(hex, 'hex');
+ },
+
+ toHex(buffer: Uint8Array): string {
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('hex');
+ },
+
+ toUTF8(buffer: Uint8Array, start: number, end: number, fatal: boolean): string {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(buffer, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+
+ const string = nodeJsByteUtils.toLocalBufferType(buffer).toString('utf8', start, end);
+ if (fatal) {
+ for (let i = 0; i < string.length; i++) {
+ if (string.charCodeAt(i) === 0xfffd) {
+ parseUtf8(buffer, start, end, true);
+ break;
+ }
+ }
+ }
+ return string;
+ },
+
+ utf8ByteLength(input: string): number {
+ return Buffer.byteLength(input, 'utf8');
+ },
+
+ encodeUTF8Into(buffer: Uint8Array, source: string, byteOffset: number): number {
+ const latinBytesWritten = tryWriteBasicLatin(buffer, source, byteOffset);
+ if (latinBytesWritten != null) {
+ return latinBytesWritten;
+ }
+
+ return nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8');
+ },
+
+ randomBytes: nodejsRandomBytes,
+
+ swap32(buffer: Uint8Array): NodeJsBuffer {
+ return nodeJsByteUtils.toLocalBufferType(buffer).swap32();
+ }
+};
diff --git a/node_modules/bson/src/utils/number_utils.ts b/node_modules/bson/src/utils/number_utils.ts
new file mode 100644
index 00000000..6e96a97f
--- /dev/null
+++ b/node_modules/bson/src/utils/number_utils.ts
@@ -0,0 +1,204 @@
+const FLOAT = new Float64Array(1);
+const FLOAT_BYTES = new Uint8Array(FLOAT.buffer, 0, 8);
+
+FLOAT[0] = -1;
+// Little endian [0, 0, 0, 0, 0, 0, 240, 191]
+// Big endian [191, 240, 0, 0, 0, 0, 0, 0]
+const isBigEndian = FLOAT_BYTES[7] === 0;
+
+/**
+ * @experimental
+ * @public
+ *
+ * A collection of functions that get or set various numeric types and bit widths from a Uint8Array.
+ */
+export type NumberUtils = {
+ /** Is true if the current system is big endian. */
+ isBigEndian: boolean;
+ /**
+ * Parses a signed int32 at offset. Throws a `RangeError` if value is negative.
+ */
+ getNonnegativeInt32LE: (source: Uint8Array, offset: number) => number;
+ getInt32LE: (source: Uint8Array, offset: number) => number;
+ getUint32LE: (source: Uint8Array, offset: number) => number;
+ getUint32BE: (source: Uint8Array, offset: number) => number;
+ getBigInt64LE: (source: Uint8Array, offset: number) => bigint;
+ getFloat64LE: (source: Uint8Array, offset: number) => number;
+ setInt32BE: (destination: Uint8Array, offset: number, value: number) => 4;
+ setInt32LE: (destination: Uint8Array, offset: number, value: number) => 4;
+ setBigInt64LE: (destination: Uint8Array, offset: number, value: bigint) => 8;
+ setFloat64LE: (destination: Uint8Array, offset: number, value: number) => 8;
+};
+
+/**
+ * Number parsing and serializing utilities.
+ *
+ * @experimental
+ * @public
+ */
+export const NumberUtils: NumberUtils = {
+ isBigEndian,
+
+ getNonnegativeInt32LE(source: Uint8Array, offset: number): number {
+ if (source[offset + 3] > 127) {
+ throw new RangeError(`Size cannot be negative at offset: ${offset}`);
+ }
+ return (
+ source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24)
+ );
+ },
+
+ /** Reads a little-endian 32-bit integer from source */
+ getInt32LE(source: Uint8Array, offset: number): number {
+ return (
+ source[offset] |
+ (source[offset + 1] << 8) |
+ (source[offset + 2] << 16) |
+ (source[offset + 3] << 24)
+ );
+ },
+
+ /** Reads a little-endian 32-bit unsigned integer from source */
+ getUint32LE(source: Uint8Array, offset: number): number {
+ return (
+ source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216
+ );
+ },
+
+ /** Reads a big-endian 32-bit integer from source */
+ getUint32BE(source: Uint8Array, offset: number): number {
+ return (
+ source[offset + 3] +
+ source[offset + 2] * 256 +
+ source[offset + 1] * 65536 +
+ source[offset] * 16777216
+ );
+ },
+
+ /** Reads a little-endian 64-bit integer from source */
+ getBigInt64LE(source: Uint8Array, offset: number): bigint {
+ const hi = BigInt(
+ source[offset + 4] +
+ source[offset + 5] * 256 +
+ source[offset + 6] * 65536 +
+ (source[offset + 7] << 24)
+ ); // Overflow
+
+ const lo = BigInt(
+ source[offset] +
+ source[offset + 1] * 256 +
+ source[offset + 2] * 65536 +
+ source[offset + 3] * 16777216
+ );
+
+ return (hi << 32n) + lo;
+ },
+
+ /** Reads a little-endian 64-bit float from source */
+ getFloat64LE: isBigEndian
+ ? (source: Uint8Array, offset: number) => {
+ FLOAT_BYTES[7] = source[offset];
+ FLOAT_BYTES[6] = source[offset + 1];
+ FLOAT_BYTES[5] = source[offset + 2];
+ FLOAT_BYTES[4] = source[offset + 3];
+ FLOAT_BYTES[3] = source[offset + 4];
+ FLOAT_BYTES[2] = source[offset + 5];
+ FLOAT_BYTES[1] = source[offset + 6];
+ FLOAT_BYTES[0] = source[offset + 7];
+ return FLOAT[0];
+ }
+ : (source: Uint8Array, offset: number) => {
+ FLOAT_BYTES[0] = source[offset];
+ FLOAT_BYTES[1] = source[offset + 1];
+ FLOAT_BYTES[2] = source[offset + 2];
+ FLOAT_BYTES[3] = source[offset + 3];
+ FLOAT_BYTES[4] = source[offset + 4];
+ FLOAT_BYTES[5] = source[offset + 5];
+ FLOAT_BYTES[6] = source[offset + 6];
+ FLOAT_BYTES[7] = source[offset + 7];
+ return FLOAT[0];
+ },
+
+ /** Writes a big-endian 32-bit integer to destination, can be signed or unsigned */
+ setInt32BE(destination: Uint8Array, offset: number, value: number): 4 {
+ destination[offset + 3] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset] = value;
+ return 4;
+ },
+
+ /** Writes a little-endian 32-bit integer to destination, can be signed or unsigned */
+ setInt32LE(destination: Uint8Array, offset: number, value: number): 4 {
+ destination[offset] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 3] = value;
+ return 4;
+ },
+
+ /** Write a little-endian 64-bit integer to source */
+ setBigInt64LE(destination: Uint8Array, offset: number, value: bigint): 8 {
+ const mask32bits = 0xffff_ffffn;
+
+ /** lower 32 bits */
+ let lo = Number(value & mask32bits);
+ destination[offset] = lo;
+ lo >>= 8;
+ destination[offset + 1] = lo;
+ lo >>= 8;
+ destination[offset + 2] = lo;
+ lo >>= 8;
+ destination[offset + 3] = lo;
+
+ let hi = Number((value >> 32n) & mask32bits);
+ destination[offset + 4] = hi;
+ hi >>= 8;
+ destination[offset + 5] = hi;
+ hi >>= 8;
+ destination[offset + 6] = hi;
+ hi >>= 8;
+ destination[offset + 7] = hi;
+
+ return 8;
+ },
+
+ /** Writes a little-endian 64-bit float to destination */
+ setFloat64LE: isBigEndian
+ ? (destination: Uint8Array, offset: number, value: number) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[7];
+ destination[offset + 1] = FLOAT_BYTES[6];
+ destination[offset + 2] = FLOAT_BYTES[5];
+ destination[offset + 3] = FLOAT_BYTES[4];
+ destination[offset + 4] = FLOAT_BYTES[3];
+ destination[offset + 5] = FLOAT_BYTES[2];
+ destination[offset + 6] = FLOAT_BYTES[1];
+ destination[offset + 7] = FLOAT_BYTES[0];
+ return 8;
+ }
+ : (destination: Uint8Array, offset: number, value: number) => {
+ FLOAT[0] = value;
+ destination[offset] = FLOAT_BYTES[0];
+ destination[offset + 1] = FLOAT_BYTES[1];
+ destination[offset + 2] = FLOAT_BYTES[2];
+ destination[offset + 3] = FLOAT_BYTES[3];
+ destination[offset + 4] = FLOAT_BYTES[4];
+ destination[offset + 5] = FLOAT_BYTES[5];
+ destination[offset + 6] = FLOAT_BYTES[6];
+ destination[offset + 7] = FLOAT_BYTES[7];
+ return 8;
+ }
+};
diff --git a/node_modules/bson/src/utils/string_utils.ts b/node_modules/bson/src/utils/string_utils.ts
new file mode 100644
index 00000000..1ffb118e
--- /dev/null
+++ b/node_modules/bson/src/utils/string_utils.ts
@@ -0,0 +1,44 @@
+/**
+ * @internal
+ * Removes leading zeros and explicit plus from textual representation of a number.
+ */
+export function removeLeadingZerosAndExplicitPlus(str: string): string {
+ if (str === '') {
+ return str;
+ }
+
+ let startIndex = 0;
+
+ const isNegative = str[startIndex] === '-';
+ const isExplicitlyPositive = str[startIndex] === '+';
+
+ if (isExplicitlyPositive || isNegative) {
+ startIndex += 1;
+ }
+
+ let foundInsignificantZero = false;
+
+ for (; startIndex < str.length && str[startIndex] === '0'; ++startIndex) {
+ foundInsignificantZero = true;
+ }
+
+ if (!foundInsignificantZero) {
+ return isExplicitlyPositive ? str.slice(1) : str;
+ }
+
+ return `${isNegative ? '-' : ''}${str.length === startIndex ? '0' : str.slice(startIndex)}`;
+}
+
+/**
+ * @internal
+ * Returns false for an string that contains invalid characters for its radix, else returns the original string.
+ * @param str - The textual representation of the Long
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
+ */
+export function validateStringCharacters(str: string, radix?: number): false | string {
+ radix = radix ?? 10;
+ const validCharacters = '0123456789abcdefghijklmnopqrstuvwxyz'.slice(0, radix);
+ // regex is case insensitive and checks that each character within the string is one of the validCharacters
+ const regex = new RegExp(`[^-+${validCharacters}]`, 'i');
+ return regex.test(str) ? false : str;
+}
diff --git a/node_modules/bson/src/utils/web_byte_utils.ts b/node_modules/bson/src/utils/web_byte_utils.ts
new file mode 100644
index 00000000..608b88cf
--- /dev/null
+++ b/node_modules/bson/src/utils/web_byte_utils.ts
@@ -0,0 +1,304 @@
+import { BSONError } from '../error';
+import { tryReadBasicLatin } from './latin';
+import { parseUtf8 } from '../parse_utf8';
+import { isUint8Array } from '../parser/utils';
+
+type TextDecoder = {
+ readonly encoding: string;
+ readonly fatal: boolean;
+ readonly ignoreBOM: boolean;
+ decode(input?: Uint8Array): string;
+};
+type TextDecoderConstructor = {
+ new (label: 'utf8', options: { fatal: boolean; ignoreBOM?: boolean }): TextDecoder;
+};
+
+type TextEncoder = {
+ readonly encoding: string;
+ encode(input?: string): Uint8Array;
+};
+type TextEncoderConstructor = {
+ new (): TextEncoder;
+};
+
+// Web global
+declare const TextDecoder: TextDecoderConstructor;
+declare const TextEncoder: TextEncoderConstructor;
+declare const atob: (base64: string) => string;
+declare const btoa: (binary: string) => string;
+
+type ArrayBufferViewWithTag = ArrayBufferView & {
+ [Symbol.toStringTag]?: string;
+};
+
+function isReactNative() {
+ const { navigator } = globalThis as { navigator?: { product?: string } };
+ return typeof navigator === 'object' && navigator.product === 'ReactNative';
+}
+
+/** @internal */
+export function webMathRandomBytes(byteLength: number) {
+ if (byteLength < 0) {
+ throw new RangeError(`The argument 'byteLength' is invalid. Received ${byteLength}`);
+ }
+ return webByteUtils.fromNumberArray(
+ Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256))
+ );
+}
+
+/** @internal */
+const webRandomBytes: (byteLength: number) => Uint8Array = (() => {
+ const { crypto } = globalThis as {
+ crypto?: { getRandomValues?: (space: Uint8Array) => Uint8Array };
+ };
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
+ return (byteLength: number) => {
+ // @ts-expect-error: crypto.getRandomValues cannot actually be null here
+ // You cannot separate getRandomValues from crypto (need to have this === crypto)
+ return crypto.getRandomValues(webByteUtils.allocate(byteLength));
+ };
+ } else {
+ if (isReactNative()) {
+ const { console } = globalThis as { console?: { warn?: (message: string) => void } };
+ console?.warn?.(
+ 'BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.'
+ );
+ }
+ return webMathRandomBytes;
+ }
+})();
+
+const HEX_DIGIT = /(\d|[a-f])/i;
+
+/**
+ * @public
+ * @experimental
+ */
+export const webByteUtils = {
+ isUint8Array: isUint8Array,
+
+ toLocalBufferType(
+ potentialUint8array: Uint8Array | ArrayBufferViewWithTag | ArrayBuffer
+ ): Uint8Array {
+ const stringTag =
+ potentialUint8array?.[Symbol.toStringTag] ??
+ Object.prototype.toString.call(potentialUint8array);
+
+ if (stringTag === 'Uint8Array') {
+ return potentialUint8array as Uint8Array;
+ }
+
+ if (ArrayBuffer.isView(potentialUint8array)) {
+ return new Uint8Array(
+ potentialUint8array.buffer.slice(
+ potentialUint8array.byteOffset,
+ potentialUint8array.byteOffset + potentialUint8array.byteLength
+ )
+ );
+ }
+
+ if (
+ stringTag === 'ArrayBuffer' ||
+ stringTag === 'SharedArrayBuffer' ||
+ stringTag === '[object ArrayBuffer]' ||
+ stringTag === '[object SharedArrayBuffer]'
+ ) {
+ return new Uint8Array(potentialUint8array);
+ }
+
+ throw new BSONError(`Cannot make a Uint8Array from passed potentialBuffer.`);
+ },
+
+ allocate(size: number): Uint8Array {
+ if (typeof size !== 'number') {
+ throw new TypeError(`The "size" argument must be of type number. Received ${String(size)}`);
+ }
+ return new Uint8Array(size);
+ },
+
+ allocateUnsafe(size: number): Uint8Array {
+ return webByteUtils.allocate(size);
+ },
+
+ compare(uint8Array: Uint8Array, otherUint8Array: Uint8Array): -1 | 0 | 1 {
+ if (uint8Array === otherUint8Array) return 0;
+
+ const len = Math.min(uint8Array.length, otherUint8Array.length);
+
+ for (let i = 0; i < len; i++) {
+ if (uint8Array[i] < otherUint8Array[i]) return -1;
+ if (uint8Array[i] > otherUint8Array[i]) return 1;
+ }
+
+ if (uint8Array.length < otherUint8Array.length) return -1;
+ if (uint8Array.length > otherUint8Array.length) return 1;
+
+ return 0;
+ },
+
+ concat(uint8Arrays: Uint8Array[]): Uint8Array {
+ if (uint8Arrays.length === 0) return webByteUtils.allocate(0);
+
+ let totalLength = 0;
+ for (const uint8Array of uint8Arrays) {
+ totalLength += uint8Array.length;
+ }
+
+ const result = webByteUtils.allocate(totalLength);
+ let offset = 0;
+
+ for (const uint8Array of uint8Arrays) {
+ result.set(uint8Array, offset);
+ offset += uint8Array.length;
+ }
+
+ return result;
+ },
+
+ copy(
+ source: Uint8Array,
+ target: Uint8Array,
+ targetStart?: number,
+ sourceStart?: number,
+ sourceEnd?: number
+ ): number {
+ // validate and standardize passed-in sourceEnd
+ if (sourceEnd !== undefined && sourceEnd < 0) {
+ throw new RangeError(
+ `The value of "sourceEnd" is out of range. It must be >= 0. Received ${sourceEnd}`
+ );
+ }
+ sourceEnd = sourceEnd ?? source.length;
+
+ // validate and standardize passed-in sourceStart
+ if (sourceStart !== undefined && (sourceStart < 0 || sourceStart > sourceEnd)) {
+ throw new RangeError(
+ `The value of "sourceStart" is out of range. It must be >= 0 and <= ${sourceEnd}. Received ${sourceStart}`
+ );
+ }
+ sourceStart = sourceStart ?? 0;
+
+ // validate and standardize passed-in targetStart
+ if (targetStart !== undefined && targetStart < 0) {
+ throw new RangeError(
+ `The value of "targetStart" is out of range. It must be >= 0. Received ${targetStart}`
+ );
+ }
+ targetStart = targetStart ?? 0;
+
+ // figure out how many bytes we can copy
+ const srcSlice = source.subarray(sourceStart, sourceEnd);
+ const maxLen = Math.min(srcSlice.length, target.length - targetStart);
+ if (maxLen <= 0) {
+ return 0;
+ }
+
+ // perform the copy
+ target.set(srcSlice.subarray(0, maxLen), targetStart);
+ return maxLen;
+ },
+
+ equals(uint8Array: Uint8Array, otherUint8Array: Uint8Array): boolean {
+ if (uint8Array.byteLength !== otherUint8Array.byteLength) {
+ return false;
+ }
+ for (let i = 0; i < uint8Array.byteLength; i++) {
+ if (uint8Array[i] !== otherUint8Array[i]) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ fromNumberArray(array: number[]): Uint8Array {
+ return Uint8Array.from(array);
+ },
+
+ fromBase64(base64: string): Uint8Array {
+ return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
+ },
+
+ fromUTF8(utf8: string): Uint8Array {
+ return new TextEncoder().encode(utf8);
+ },
+
+ toBase64(uint8array: Uint8Array): string {
+ return btoa(webByteUtils.toISO88591(uint8array));
+ },
+
+ /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
+ fromISO88591(codePoints: string): Uint8Array {
+ return Uint8Array.from(codePoints, c => c.charCodeAt(0) & 0xff);
+ },
+
+ /** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
+ toISO88591(uint8array: Uint8Array): string {
+ return Array.from(Uint16Array.from(uint8array), b => String.fromCharCode(b)).join('');
+ },
+
+ fromHex(hex: string): Uint8Array {
+ const evenLengthHex = hex.length % 2 === 0 ? hex : hex.slice(0, hex.length - 1);
+ const buffer = [];
+
+ for (let i = 0; i < evenLengthHex.length; i += 2) {
+ const firstDigit = evenLengthHex[i];
+ const secondDigit = evenLengthHex[i + 1];
+
+ if (!HEX_DIGIT.test(firstDigit)) {
+ break;
+ }
+ if (!HEX_DIGIT.test(secondDigit)) {
+ break;
+ }
+
+ const hexDigit = Number.parseInt(`${firstDigit}${secondDigit}`, 16);
+ buffer.push(hexDigit);
+ }
+
+ return Uint8Array.from(buffer);
+ },
+
+ toHex(uint8array: Uint8Array): string {
+ return Array.from(uint8array, byte => byte.toString(16).padStart(2, '0')).join('');
+ },
+
+ toUTF8(uint8array: Uint8Array, start: number, end: number, fatal: boolean): string {
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(uint8array, start, end) : null;
+ if (basicLatin != null) {
+ return basicLatin;
+ }
+
+ return parseUtf8(uint8array, start, end, fatal);
+ },
+
+ utf8ByteLength(input: string): number {
+ return new TextEncoder().encode(input).byteLength;
+ },
+
+ encodeUTF8Into(uint8array: Uint8Array, source: string, byteOffset: number): number {
+ const bytes = new TextEncoder().encode(source);
+ uint8array.set(bytes, byteOffset);
+ return bytes.byteLength;
+ },
+
+ randomBytes: webRandomBytes,
+
+ swap32(buffer: Uint8Array): Uint8Array {
+ if (buffer.length % 4 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 32-bits');
+ }
+
+ for (let i = 0; i < buffer.length; i += 4) {
+ const byte0 = buffer[i];
+ const byte1 = buffer[i + 1];
+ const byte2 = buffer[i + 2];
+ const byte3 = buffer[i + 3];
+ buffer[i] = byte3;
+ buffer[i + 1] = byte2;
+ buffer[i + 2] = byte1;
+ buffer[i + 3] = byte0;
+ }
+
+ return buffer;
+ }
+};
diff --git a/node_modules/cors/LICENSE b/node_modules/cors/LICENSE
new file mode 100644
index 00000000..fd10c843
--- /dev/null
+++ b/node_modules/cors/LICENSE
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2013 Troy Goode
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/cors/README.md b/node_modules/cors/README.md
new file mode 100644
index 00000000..3d206e5b
--- /dev/null
+++ b/node_modules/cors/README.md
@@ -0,0 +1,277 @@
+# cors
+
+[![NPM Version][npm-image]][npm-url]
+[![NPM Downloads][downloads-image]][downloads-url]
+[![Build Status][github-actions-ci-image]][github-actions-ci-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
+
+CORS is a [Node.js](https://nodejs.org/en/) middleware for [Express](https://expressjs.com/)/[Connect](https://github.com/senchalabs/connect) that sets [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS) response headers. These headers tell browsers which origins can read responses from your server.
+
+> [!IMPORTANT]
+> **How CORS Works:** This package sets response headers—it doesn't block requests. CORS is enforced by browsers: they check the headers and decide if JavaScript can read the response. Non-browser clients (curl, Postman, other servers) ignore CORS entirely. See the [MDN CORS guide](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS) for details.
+
+* [Installation](#installation)
+* [Usage](#usage)
+ * [Simple Usage](#simple-usage-enable-all-cors-requests)
+ * [Enable CORS for a Single Route](#enable-cors-for-a-single-route)
+ * [Configuring CORS](#configuring-cors)
+ * [Configuring CORS w/ Dynamic Origin](#configuring-cors-w-dynamic-origin)
+ * [Enabling CORS Pre-Flight](#enabling-cors-pre-flight)
+ * [Customizing CORS Settings Dynamically per Request](#customizing-cors-settings-dynamically-per-request)
+* [Configuration Options](#configuration-options)
+* [Common Misconceptions](#common-misconceptions)
+* [License](#license)
+* [Original Author](#original-author)
+
+## Installation
+
+This is a [Node.js](https://nodejs.org/en/) module available through the
+[npm registry](https://www.npmjs.com/). Installation is done using the
+[`npm install` command](https://docs.npmjs.com/downloading-and-installing-packages-locally):
+
+```sh
+$ npm install cors
+```
+
+## Usage
+
+### Simple Usage (Enable *All* CORS Requests)
+
+```javascript
+var express = require('express')
+var cors = require('cors')
+var app = express()
+
+// Adds headers: Access-Control-Allow-Origin: *
+app.use(cors())
+
+app.get('/products/:id', function (req, res, next) {
+ res.json({msg: 'Hello'})
+})
+
+app.listen(80, function () {
+ console.log('web server listening on port 80')
+})
+```
+
+### Enable CORS for a Single Route
+
+```javascript
+var express = require('express')
+var cors = require('cors')
+var app = express()
+
+// Adds headers: Access-Control-Allow-Origin: *
+app.get('/products/:id', cors(), function (req, res, next) {
+ res.json({msg: 'Hello'})
+})
+
+app.listen(80, function () {
+ console.log('web server listening on port 80')
+})
+```
+
+### Configuring CORS
+
+See the [configuration options](#configuration-options) for details.
+
+```javascript
+var express = require('express')
+var cors = require('cors')
+var app = express()
+
+var corsOptions = {
+ origin: 'http://example.com',
+ optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
+}
+
+// Adds headers: Access-Control-Allow-Origin: http://example.com, Vary: Origin
+app.get('/products/:id', cors(corsOptions), function (req, res, next) {
+ res.json({msg: 'Hello'})
+})
+
+app.listen(80, function () {
+ console.log('web server listening on port 80')
+})
+```
+
+### Configuring CORS w/ Dynamic Origin
+
+This module supports validating the origin dynamically using a function provided
+to the `origin` option. This function will be passed a string that is the origin
+(or `undefined` if the request has no origin), and a `callback` with the signature
+`callback(error, origin)`.
+
+The `origin` argument to the callback can be any value allowed for the `origin`
+option of the middleware, except a function. See the
+[configuration options](#configuration-options) section for more information on all
+the possible value types.
+
+This function is designed to allow the dynamic loading of allowed origin(s) from
+a backing datasource, like a database.
+
+```javascript
+var express = require('express')
+var cors = require('cors')
+var app = express()
+
+var corsOptions = {
+ origin: function (origin, callback) {
+ // db.loadOrigins is an example call to load
+ // a list of origins from a backing database
+ db.loadOrigins(function (error, origins) {
+ callback(error, origins)
+ })
+ }
+}
+
+// Adds headers: Access-Control-Allow-Origin: , Vary: Origin
+app.get('/products/:id', cors(corsOptions), function (req, res, next) {
+ res.json({msg: 'Hello'})
+})
+
+app.listen(80, function () {
+ console.log('web server listening on port 80')
+})
+```
+
+### Enabling CORS Pre-Flight
+
+Certain CORS requests are considered 'complex' and require an initial
+`OPTIONS` request (called the "pre-flight request"). An example of a
+'complex' CORS request is one that uses an HTTP verb other than
+GET/HEAD/POST (such as DELETE) or that uses custom headers. To enable
+pre-flighting, you must add a new OPTIONS handler for the route you want
+to support:
+
+```javascript
+var express = require('express')
+var cors = require('cors')
+var app = express()
+
+app.options('/products/:id', cors()) // preflight for DELETE
+app.del('/products/:id', cors(), function (req, res, next) {
+ res.json({msg: 'Hello'})
+})
+
+app.listen(80, function () {
+ console.log('web server listening on port 80')
+})
+```
+
+You can also enable pre-flight across-the-board like so:
+
+```javascript
+app.options('*', cors()) // include before other routes
+```
+
+NOTE: When using this middleware as an application level middleware (for
+example, `app.use(cors())`), pre-flight requests are already handled for all
+routes.
+
+### Customizing CORS Settings Dynamically per Request
+
+For APIs that require different CORS configurations for specific routes or requests, you can dynamically generate CORS options based on the incoming request. The `cors` middleware allows you to achieve this by passing a function instead of static options. This function is called for each incoming request and must use the callback pattern to return the appropriate CORS options.
+
+The function accepts:
+1. **`req`**:
+ - The incoming request object.
+
+2. **`callback(error, corsOptions)`**:
+ - A function used to return the computed CORS options.
+ - **Arguments**:
+ - **`error`**: Pass `null` if there’s no error, or an error object to indicate a failure.
+ - **`corsOptions`**: An object specifying the CORS policy for the current request.
+
+Here’s an example that handles both public routes and restricted, credential-sensitive routes:
+
+```javascript
+var dynamicCorsOptions = function(req, callback) {
+ var corsOptions;
+ if (req.path.startsWith('/auth/connect/')) {
+ // Access-Control-Allow-Origin: http://mydomain.com, Access-Control-Allow-Credentials: true, Vary: Origin
+ corsOptions = {
+ origin: 'http://mydomain.com',
+ credentials: true
+ };
+ } else {
+ // Access-Control-Allow-Origin: *
+ corsOptions = { origin: '*' };
+ }
+ callback(null, corsOptions);
+};
+
+app.use(cors(dynamicCorsOptions));
+
+app.get('/auth/connect/twitter', function (req, res) {
+ res.send('Hello');
+});
+
+app.get('/public', function (req, res) {
+ res.send('Hello');
+});
+
+app.listen(80, function () {
+ console.log('web server listening on port 80')
+})
+```
+
+## Configuration Options
+
+* `origin`: Configures the **Access-Control-Allow-Origin** CORS header. Possible values:
+ - `Boolean` - set `origin` to `true` to reflect the [request origin](https://datatracker.ietf.org/doc/html/draft-abarth-origin-09), as defined by `req.header('Origin')`, or set it to `false` to disable CORS.
+ - `String` - set `origin` to a specific origin. For example, if you set it to
+ - `"http://example.com"` only requests from "http://example.com" will be allowed.
+ - `"*"` for all domains to be allowed.
+ - `RegExp` - set `origin` to a regular expression pattern which will be used to test the request origin. If it's a match, the request origin will be reflected. For example the pattern `/example\.com$/` will reflect any request that is coming from an origin ending with "example.com".
+ - `Array` - set `origin` to an array of valid origins. Each origin can be a `String` or a `RegExp`. For example `["http://example1.com", /\.example2\.com$/]` will accept any request from "http://example1.com" or from a subdomain of "example2.com".
+ - `Function` - set `origin` to a function implementing some custom logic. The function takes the request origin as the first parameter and a callback (called as `callback(err, origin)`, where `origin` is a non-function value of the `origin` option) as the second.
+* `methods`: Configures the **Access-Control-Allow-Methods** CORS header. Expects a comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: `['GET', 'PUT', 'POST']`).
+* `allowedHeaders`: Configures the **Access-Control-Allow-Headers** CORS header. Expects a comma-delimited string (ex: 'Content-Type,Authorization') or an array (ex: `['Content-Type', 'Authorization']`). If not specified, defaults to reflecting the headers specified in the request's **Access-Control-Request-Headers** header.
+* `exposedHeaders`: Configures the **Access-Control-Expose-Headers** CORS header. Expects a comma-delimited string (ex: 'Content-Range,X-Content-Range') or an array (ex: `['Content-Range', 'X-Content-Range']`). If not specified, no custom headers are exposed.
+* `credentials`: Configures the **Access-Control-Allow-Credentials** CORS header. Set to `true` to pass the header, otherwise it is omitted.
+* `maxAge`: Configures the **Access-Control-Max-Age** CORS header. Set to an integer to pass the header, otherwise it is omitted.
+* `preflightContinue`: Pass the CORS preflight response to the next handler.
+* `optionsSuccessStatus`: Provides a status code to use for successful `OPTIONS` requests, since some legacy browsers (IE11, various SmartTVs) choke on `204`.
+
+The default configuration is the equivalent of:
+
+```json
+{
+ "origin": "*",
+ "methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
+ "preflightContinue": false,
+ "optionsSuccessStatus": 204
+}
+```
+
+## Common Misconceptions
+
+### "CORS blocks requests from disallowed origins"
+
+**No.** Your server receives and processes every request. CORS headers tell the browser whether JavaScript can read the response—not whether the request is allowed.
+
+### "CORS protects my API from unauthorized access"
+
+**No.** CORS is not access control. Any HTTP client (curl, Postman, another server) can call your API regardless of CORS settings. Use authentication and authorization to protect your API.
+
+### "Setting `origin: 'http://example.com'` means only that domain can access my server"
+
+**No.** It means browsers will only let JavaScript from that origin read responses. The server still responds to all requests.
+
+## License
+
+[MIT License](http://www.opensource.org/licenses/mit-license.php)
+
+## Original Author
+
+[Troy Goode](https://github.com/TroyGoode) ([troygoode@gmail.com](mailto:troygoode@gmail.com))
+
+[coveralls-image]: https://img.shields.io/coveralls/expressjs/cors/master.svg
+[coveralls-url]: https://coveralls.io/r/expressjs/cors?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/cors.svg
+[downloads-url]: https://npmjs.com/package/cors
+[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/expressjs/cors/ci.yml?branch=master&label=ci
+[github-actions-ci-url]: https://github.com/expressjs/cors?query=workflow%3Aci
+[npm-image]: https://img.shields.io/npm/v/cors.svg
+[npm-url]: https://npmjs.com/package/cors
diff --git a/node_modules/cors/lib/index.js b/node_modules/cors/lib/index.js
new file mode 100644
index 00000000..ad899cae
--- /dev/null
+++ b/node_modules/cors/lib/index.js
@@ -0,0 +1,238 @@
+(function () {
+
+ 'use strict';
+
+ var assign = require('object-assign');
+ var vary = require('vary');
+
+ var defaults = {
+ origin: '*',
+ methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
+ preflightContinue: false,
+ optionsSuccessStatus: 204
+ };
+
+ function isString(s) {
+ return typeof s === 'string' || s instanceof String;
+ }
+
+ function isOriginAllowed(origin, allowedOrigin) {
+ if (Array.isArray(allowedOrigin)) {
+ for (var i = 0; i < allowedOrigin.length; ++i) {
+ if (isOriginAllowed(origin, allowedOrigin[i])) {
+ return true;
+ }
+ }
+ return false;
+ } else if (isString(allowedOrigin)) {
+ return origin === allowedOrigin;
+ } else if (allowedOrigin instanceof RegExp) {
+ return allowedOrigin.test(origin);
+ } else {
+ return !!allowedOrigin;
+ }
+ }
+
+ function configureOrigin(options, req) {
+ var requestOrigin = req.headers.origin,
+ headers = [],
+ isAllowed;
+
+ if (!options.origin || options.origin === '*') {
+ // allow any origin
+ headers.push([{
+ key: 'Access-Control-Allow-Origin',
+ value: '*'
+ }]);
+ } else if (isString(options.origin)) {
+ // fixed origin
+ headers.push([{
+ key: 'Access-Control-Allow-Origin',
+ value: options.origin
+ }]);
+ headers.push([{
+ key: 'Vary',
+ value: 'Origin'
+ }]);
+ } else {
+ isAllowed = isOriginAllowed(requestOrigin, options.origin);
+ // reflect origin
+ headers.push([{
+ key: 'Access-Control-Allow-Origin',
+ value: isAllowed ? requestOrigin : false
+ }]);
+ headers.push([{
+ key: 'Vary',
+ value: 'Origin'
+ }]);
+ }
+
+ return headers;
+ }
+
+ function configureMethods(options) {
+ var methods = options.methods;
+ if (methods.join) {
+ methods = options.methods.join(','); // .methods is an array, so turn it into a string
+ }
+ return {
+ key: 'Access-Control-Allow-Methods',
+ value: methods
+ };
+ }
+
+ function configureCredentials(options) {
+ if (options.credentials === true) {
+ return {
+ key: 'Access-Control-Allow-Credentials',
+ value: 'true'
+ };
+ }
+ return null;
+ }
+
+ function configureAllowedHeaders(options, req) {
+ var allowedHeaders = options.allowedHeaders || options.headers;
+ var headers = [];
+
+ if (!allowedHeaders) {
+ allowedHeaders = req.headers['access-control-request-headers']; // .headers wasn't specified, so reflect the request headers
+ headers.push([{
+ key: 'Vary',
+ value: 'Access-Control-Request-Headers'
+ }]);
+ } else if (allowedHeaders.join) {
+ allowedHeaders = allowedHeaders.join(','); // .headers is an array, so turn it into a string
+ }
+ if (allowedHeaders && allowedHeaders.length) {
+ headers.push([{
+ key: 'Access-Control-Allow-Headers',
+ value: allowedHeaders
+ }]);
+ }
+
+ return headers;
+ }
+
+ function configureExposedHeaders(options) {
+ var headers = options.exposedHeaders;
+ if (!headers) {
+ return null;
+ } else if (headers.join) {
+ headers = headers.join(','); // .headers is an array, so turn it into a string
+ }
+ if (headers && headers.length) {
+ return {
+ key: 'Access-Control-Expose-Headers',
+ value: headers
+ };
+ }
+ return null;
+ }
+
+ function configureMaxAge(options) {
+ var maxAge = (typeof options.maxAge === 'number' || options.maxAge) && options.maxAge.toString()
+ if (maxAge && maxAge.length) {
+ return {
+ key: 'Access-Control-Max-Age',
+ value: maxAge
+ };
+ }
+ return null;
+ }
+
+ function applyHeaders(headers, res) {
+ for (var i = 0, n = headers.length; i < n; i++) {
+ var header = headers[i];
+ if (header) {
+ if (Array.isArray(header)) {
+ applyHeaders(header, res);
+ } else if (header.key === 'Vary' && header.value) {
+ vary(res, header.value);
+ } else if (header.value) {
+ res.setHeader(header.key, header.value);
+ }
+ }
+ }
+ }
+
+ function cors(options, req, res, next) {
+ var headers = [],
+ method = req.method && req.method.toUpperCase && req.method.toUpperCase();
+
+ if (method === 'OPTIONS') {
+ // preflight
+ headers.push(configureOrigin(options, req));
+ headers.push(configureCredentials(options))
+ headers.push(configureMethods(options))
+ headers.push(configureAllowedHeaders(options, req));
+ headers.push(configureMaxAge(options))
+ headers.push(configureExposedHeaders(options))
+ applyHeaders(headers, res);
+
+ if (options.preflightContinue) {
+ next();
+ } else {
+ // Safari (and potentially other browsers) need content-length 0,
+ // for 204 or they just hang waiting for a body
+ res.statusCode = options.optionsSuccessStatus;
+ res.setHeader('Content-Length', '0');
+ res.end();
+ }
+ } else {
+ // actual response
+ headers.push(configureOrigin(options, req));
+ headers.push(configureCredentials(options))
+ headers.push(configureExposedHeaders(options))
+ applyHeaders(headers, res);
+ next();
+ }
+ }
+
+ function middlewareWrapper(o) {
+ // if options are static (either via defaults or custom options passed in), wrap in a function
+ var optionsCallback = null;
+ if (typeof o === 'function') {
+ optionsCallback = o;
+ } else {
+ optionsCallback = function (req, cb) {
+ cb(null, o);
+ };
+ }
+
+ return function corsMiddleware(req, res, next) {
+ optionsCallback(req, function (err, options) {
+ if (err) {
+ next(err);
+ } else {
+ var corsOptions = assign({}, defaults, options);
+ var originCallback = null;
+ if (corsOptions.origin && typeof corsOptions.origin === 'function') {
+ originCallback = corsOptions.origin;
+ } else if (corsOptions.origin) {
+ originCallback = function (origin, cb) {
+ cb(null, corsOptions.origin);
+ };
+ }
+
+ if (originCallback) {
+ originCallback(req.headers.origin, function (err2, origin) {
+ if (err2 || !origin) {
+ next(err2);
+ } else {
+ corsOptions.origin = origin;
+ cors(corsOptions, req, res, next);
+ }
+ });
+ } else {
+ next();
+ }
+ }
+ });
+ };
+ }
+
+ // can pass either an options hash, an options delegate, or nothing
+ module.exports = middlewareWrapper;
+
+}());
diff --git a/node_modules/cors/package.json b/node_modules/cors/package.json
new file mode 100644
index 00000000..e90bac83
--- /dev/null
+++ b/node_modules/cors/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "cors",
+ "description": "Node.js CORS middleware",
+ "version": "2.8.6",
+ "author": "Troy Goode (https://github.com/troygoode/)",
+ "license": "MIT",
+ "keywords": [
+ "cors",
+ "express",
+ "connect",
+ "middleware"
+ ],
+ "repository": "expressjs/cors",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ },
+ "main": "./lib/index.js",
+ "dependencies": {
+ "object-assign": "^4",
+ "vary": "^1"
+ },
+ "devDependencies": {
+ "after": "0.8.2",
+ "eslint": "7.30.0",
+ "express": "4.21.2",
+ "mocha": "9.2.2",
+ "nyc": "15.1.0",
+ "supertest": "6.1.3"
+ },
+ "files": [
+ "lib/index.js"
+ ],
+ "engines": {
+ "node": ">= 0.10"
+ },
+ "scripts": {
+ "test": "npm run lint && npm run test-ci",
+ "test-ci": "nyc --reporter=lcov --reporter=text mocha --require test/support/env",
+ "lint": "eslint lib test"
+ }
+}
diff --git a/node_modules/kareem/CHANGELOG.md b/node_modules/kareem/CHANGELOG.md
new file mode 100644
index 00000000..ae368ecb
--- /dev/null
+++ b/node_modules/kareem/CHANGELOG.md
@@ -0,0 +1,845 @@
+# Changelog
+
+
+## 3.3.0 (2026-04-14)
+
+* perf: avoid cloning args on every pre/post #45
+
+
+## 3.2.0 (2026-01-29)
+
+* feat(exec): add filter option to execPreSync and execPostSync #44
+
+
+## 3.1.0 (2026-01-12)
+
+* feat(exec): add filter option to allow executing hooks based on a filter function #43
+
+
+## 3.0.0 (2025-11-18)
+
+* BREAKING CHANGE: make execPre async and drop callback support #39
+* BREAKING CHANGE: require Node 18
+* feat: overwriteArguments support #42
+
+
+## 2.6.0 (2024-03-04)
+
+* feat: add TypeScript types
+
+
+## 2.5.1 (2023-01-06)
+
+* fix: avoid passing final callback to pre hook, because calling the callback can mess up hook execution #36 Automattic/mongoose#12836
+
+
+## 2.5.0 (2022-12-01)
+
+* feat: add errorHandler option to `post()` #34
+
+
+## 2.4.0 (2022-06-13)
+
+* feat: add `overwriteResult()` and `skipWrappedFunction()` for more advanced control flow
+
+
+## 2.3.4 (2022-02-10)
+
+* perf: various performance improvements #27 #24 #23 #22 #21 #20
+
+
+## 2.3.3 (2021-12-26)
+
+* fix: handle sync errors in `wrap()`
+
+
+## 2.3.2 (2020-12-08)
+
+* fix: handle sync errors in pre hooks if there are multiple hooks
+
+
+## 2.3.0 (2018-09-24)
+
+* chore(release): 2.2.3 ([c8f2695](https://github.com/vkarpov15/kareem/commit/c8f2695))
+* chore(release): 2.2.4 ([a377a4f](https://github.com/vkarpov15/kareem/commit/a377a4f))
+* chore(release): 2.2.5 ([5a495e3](https://github.com/vkarpov15/kareem/commit/5a495e3))
+* fix(filter): copy async pres correctly with `filter()` ([1b1ed8a](https://github.com/vkarpov15/kareem/commit/1b1ed8a)), closes [Automattic/mongoose#3054](https://github.com/Automattic/mongoose/issues/3054)
+* feat: add filter() function ([1f641f4](https://github.com/vkarpov15/kareem/commit/1f641f4))
+* feat: support storing options on pre and post hooks ([59220b9](https://github.com/vkarpov15/kareem/commit/59220b9))
+
+
+
+
+## 2.2.3 (2018-09-10)
+
+* chore: release 2.2.3 ([af653a3](https://github.com/vkarpov15/kareem/commit/af653a3))
+
+
+
+
+## 2.2.2 (2018-09-10)
+
+* chore: release 2.2.2 ([3f0144d](https://github.com/vkarpov15/kareem/commit/3f0144d))
+* fix: allow merge() to not clone ([e628d65](https://github.com/vkarpov15/kareem/commit/e628d65))
+
+
+
+
+## 2.2.1 (2018-06-05)
+
+* chore: release 2.2.1 ([4625a64](https://github.com/vkarpov15/kareem/commit/4625a64))
+* chore: remove lockfile from git ([7f3e4e6](https://github.com/vkarpov15/kareem/commit/7f3e4e6))
+* fix: handle numAsync correctly when merging ([fef8e7e](https://github.com/vkarpov15/kareem/commit/fef8e7e))
+* test: repro issue with not copying numAsync ([952d9db](https://github.com/vkarpov15/kareem/commit/952d9db))
+
+
+
+
+## 2.2.0 (2018-06-05)
+
+* chore: release 2.2.0 ([ff9ad03](https://github.com/vkarpov15/kareem/commit/ff9ad03))
+* fix: use maps instead of objects for _pres and _posts so `toString()` doesn't get reported as having ([55df303](https://github.com/vkarpov15/kareem/commit/55df303)), closes [Automattic/mongoose#6538](https://github.com/Automattic/mongoose/issues/6538)
+
+
+
+
+## 2.1.0 (2018-05-16)
+
+* chore: release 2.1.0 ([ba5f1bc](https://github.com/vkarpov15/kareem/commit/ba5f1bc))
+* feat: add option to check wrapped function return value for promises ([c9d7dd1](https://github.com/vkarpov15/kareem/commit/c9d7dd1))
+* refactor: use const in wrap() ([0fc21f9](https://github.com/vkarpov15/kareem/commit/0fc21f9))
+
+
+
+
+## 2.0.7 (2018-04-28)
+
+* chore: release 2.0.7 ([0bf91e6](https://github.com/vkarpov15/kareem/commit/0bf91e6))
+* feat: add `hasHooks()` ([225f18d](https://github.com/vkarpov15/kareem/commit/225f18d)), closes [Automattic/mongoose#6385](https://github.com/Automattic/mongoose/issues/6385)
+
+
+
+
+## 2.0.6 (2018-03-22)
+
+* chore: release 2.0.6 ([f3d406b](https://github.com/vkarpov15/kareem/commit/f3d406b))
+* fix(wrap): ensure fast path still wraps function in `nextTick()` for chaining ([7000494](https://github.com/vkarpov15/kareem/commit/7000494)), closes [Automattic/mongoose#6250](https://github.com/Automattic/mongoose/issues/6250) [dsanel/mongoose-delete#36](https://github.com/dsanel/mongoose-delete/issues/36)
+
+
+
+
+## 2.0.5 (2018-02-22)
+
+* chore: release 2.0.5 ([3286612](https://github.com/vkarpov15/kareem/commit/3286612))
+* perf(createWrapper): don't create wrapper if there are no hooks ([5afc5b9](https://github.com/vkarpov15/kareem/commit/5afc5b9)), closes [Automattic/mongoose#6126](https://github.com/Automattic/mongoose/issues/6126)
+
+
+
+
+## 2.0.4 (2018-02-08)
+
+* chore: release 2.0.4 ([2ab0293](https://github.com/vkarpov15/kareem/commit/2ab0293))
+
+
+
+
+## 2.0.3 (2018-02-01)
+
+* chore: release 2.0.3 ([3c1abe5](https://github.com/vkarpov15/kareem/commit/3c1abe5))
+* fix: use process.nextTick() re: Automattic/mongoose#6074 ([e5bfe33](https://github.com/vkarpov15/kareem/commit/e5bfe33)), closes [Automattic/mongoose#6074](https://github.com/Automattic/mongoose/issues/6074)
+
+
+
+
+## 2.0.2 (2018-01-24)
+
+* chore: fix license ([a9d755c](https://github.com/vkarpov15/kareem/commit/a9d755c)), closes [#10](https://github.com/vkarpov15/kareem/issues/10)
+* chore: release 2.0.2 ([fe87ab6](https://github.com/vkarpov15/kareem/commit/fe87ab6))
+
+
+
+
+## 2.0.1 (2018-01-09)
+
+* chore: release 2.0.1 with lockfile bump ([09c44fb](https://github.com/vkarpov15/kareem/commit/09c44fb))
+
+
+
+
+## 2.0.0 (2018-01-09)
+
+* chore: bump marked re: security ([cc564a9](https://github.com/vkarpov15/kareem/commit/cc564a9))
+* chore: release 2.0.0 ([f511d1c](https://github.com/vkarpov15/kareem/commit/f511d1c))
+
+
+
+
+## 2.0.0-rc5 (2017-12-23)
+
+* chore: fix build on node 4+5 ([6dac5a4](https://github.com/vkarpov15/kareem/commit/6dac5a4))
+* chore: fix built on node 4 + 5 again ([434ef0a](https://github.com/vkarpov15/kareem/commit/434ef0a))
+* chore: release 2.0.0-rc5 ([25a32ee](https://github.com/vkarpov15/kareem/commit/25a32ee))
+
+
+
+
+## 2.0.0-rc4 (2017-12-22)
+
+* chore: release 2.0.0-rc4 ([49fc083](https://github.com/vkarpov15/kareem/commit/49fc083))
+* BREAKING CHANGE: deduplicate when merging hooks re: Automattic/mongoose#2945 ([d458573](https://github.com/vkarpov15/kareem/commit/d458573)), closes [Automattic/mongoose#2945](https://github.com/Automattic/mongoose/issues/2945)
+
+
+
+
+## 2.0.0-rc3 (2017-12-22)
+
+* chore: release 2.0.0-rc3 ([adaaa00](https://github.com/vkarpov15/kareem/commit/adaaa00))
+* feat: support returning promises from middleware functions ([05b4480](https://github.com/vkarpov15/kareem/commit/05b4480)), closes [Automattic/mongoose#3779](https://github.com/Automattic/mongoose/issues/3779)
+
+
+
+
+## 2.0.0-rc2 (2017-12-21)
+
+* chore: release 2.0.0-rc2 ([76325fa](https://github.com/vkarpov15/kareem/commit/76325fa))
+* fix: ensure next() and done() run in next tick ([6c20684](https://github.com/vkarpov15/kareem/commit/6c20684))
+
+
+
+
+## 2.0.0-rc1 (2017-12-21)
+
+* chore: improve test coverage re: Automattic/mongoose#3232 ([7b45cf0](https://github.com/vkarpov15/kareem/commit/7b45cf0)), closes [Automattic/mongoose#3232](https://github.com/Automattic/mongoose/issues/3232)
+* chore: release 2.0.0-rc1 ([9b83f52](https://github.com/vkarpov15/kareem/commit/9b83f52))
+* BREAKING CHANGE: report sync exceptions as errors, only allow calling next() and done() once ([674adcc](https://github.com/vkarpov15/kareem/commit/674adcc)), closes [Automattic/mongoose#3483](https://github.com/Automattic/mongoose/issues/3483)
+
+
+
+
+## 2.0.0-rc0 (2017-12-17)
+
+* chore: release 2.0.0-rc0 ([16b44b5](https://github.com/vkarpov15/kareem/commit/16b44b5))
+* BREAKING CHANGE: drop support for node < 4 ([9cbb8c7](https://github.com/vkarpov15/kareem/commit/9cbb8c7))
+* BREAKING CHANGE: remove useLegacyPost and add several new features ([6dd8531](https://github.com/vkarpov15/kareem/commit/6dd8531)), closes [Automattic/mongoose#3232](https://github.com/Automattic/mongoose/issues/3232)
+
+
+
+
+## 1.5.0 (2017-07-20)
+
+* chore: release 1.5.0 ([9c491a0](https://github.com/vkarpov15/kareem/commit/9c491a0))
+* fix: improve post error handlers results ([9928dd5](https://github.com/vkarpov15/kareem/commit/9928dd5)), closes [Automattic/mongoose#5466](https://github.com/Automattic/mongoose/issues/5466)
+
+
+
+
+## 1.4.2 (2017-07-06)
+
+* chore: release 1.4.2 ([8d14ac5](https://github.com/vkarpov15/kareem/commit/8d14ac5))
+* fix: correct args re: Automattic/mongoose#5405 ([3f28ae6](https://github.com/vkarpov15/kareem/commit/3f28ae6)), closes [Automattic/mongoose#5405](https://github.com/Automattic/mongoose/issues/5405)
+
+
+
+
+## 1.4.1 (2017-04-25)
+
+* chore: release 1.4.1 ([5ecf0c2](https://github.com/vkarpov15/kareem/commit/5ecf0c2))
+* fix: handle numAsyncPres with clone() ([c72e857](https://github.com/vkarpov15/kareem/commit/c72e857)), closes [#8](https://github.com/vkarpov15/kareem/issues/8)
+* test: repro #8 ([9b4d6b2](https://github.com/vkarpov15/kareem/commit/9b4d6b2)), closes [#8](https://github.com/vkarpov15/kareem/issues/8)
+
+
+
+
+## 1.4.0 (2017-04-19)
+
+* chore: release 1.4.0 ([101c5f5](https://github.com/vkarpov15/kareem/commit/101c5f5))
+* feat: add merge() function ([285325e](https://github.com/vkarpov15/kareem/commit/285325e))
+
+
+
+
+## 1.3.0 (2017-03-26)
+
+* chore: release 1.3.0 ([f3a9e50](https://github.com/vkarpov15/kareem/commit/f3a9e50))
+* feat: pass function args to execPre ([4dd466d](https://github.com/vkarpov15/kareem/commit/4dd466d))
+
+
+
+
+## 1.2.1 (2017-02-03)
+
+* chore: release 1.2.1 ([d97081f](https://github.com/vkarpov15/kareem/commit/d97081f))
+* fix: filter out _kareemIgnored args for error handlers re: Automattic/mongoose#4925 ([ddc7aeb](https://github.com/vkarpov15/kareem/commit/ddc7aeb)), closes [Automattic/mongoose#4925](https://github.com/Automattic/mongoose/issues/4925)
+* fix: make error handlers handle errors in pre hooks ([af38033](https://github.com/vkarpov15/kareem/commit/af38033)), closes [Automattic/mongoose#4927](https://github.com/Automattic/mongoose/issues/4927)
+
+
+
+
+## 1.2.0 (2017-01-02)
+
+* chore: release 1.2.0 ([033225c](https://github.com/vkarpov15/kareem/commit/033225c))
+* chore: upgrade deps ([f9e9a09](https://github.com/vkarpov15/kareem/commit/f9e9a09))
+* feat: add _kareemIgnore re: Automattic/mongoose#4836 ([7957771](https://github.com/vkarpov15/kareem/commit/7957771)), closes [Automattic/mongoose#4836](https://github.com/Automattic/mongoose/issues/4836)
+
+
+
+
+## 1.1.5 (2016-12-13)
+
+* chore: release 1.1.5 ([1a9f684](https://github.com/vkarpov15/kareem/commit/1a9f684))
+* fix: correct field name ([04a0e9d](https://github.com/vkarpov15/kareem/commit/04a0e9d))
+
+
+
+
+## 1.1.4 (2016-12-09)
+
+* chore: release 1.1.4 ([ece401c](https://github.com/vkarpov15/kareem/commit/ece401c))
+* chore: run tests on node 6 ([e0cb1cb](https://github.com/vkarpov15/kareem/commit/e0cb1cb))
+* fix: only copy own properties in clone() ([dfe28ce](https://github.com/vkarpov15/kareem/commit/dfe28ce)), closes [#7](https://github.com/vkarpov15/kareem/issues/7)
+
+
+
+
+## 1.1.3 (2016-06-27)
+
+* chore: release 1.1.3 ([87171c8](https://github.com/vkarpov15/kareem/commit/87171c8))
+* fix: couple more issues with arg processing ([c65f523](https://github.com/vkarpov15/kareem/commit/c65f523))
+
+
+
+
+## 1.1.2 (2016-06-27)
+
+* chore: release 1.1.2 ([8e102b6](https://github.com/vkarpov15/kareem/commit/8e102b6))
+* fix: add early return ([4feda4e](https://github.com/vkarpov15/kareem/commit/4feda4e))
+
+
+
+
+## 1.1.1 (2016-06-27)
+
+* chore: release 1.1.1 ([8bb3050](https://github.com/vkarpov15/kareem/commit/8bb3050))
+* fix: skip error handlers if no error ([0eb3a44](https://github.com/vkarpov15/kareem/commit/0eb3a44))
+
+
+
+
+## 1.1.0 (2016-05-11)
+
+* chore: release 1.1.0 ([85332d9](https://github.com/vkarpov15/kareem/commit/85332d9))
+* chore: test on node 4 and node 5 ([1faefa1](https://github.com/vkarpov15/kareem/commit/1faefa1))
+* 100% coverage again ([c9aee4e](https://github.com/vkarpov15/kareem/commit/c9aee4e))
+* add support for error post hooks ([d378113](https://github.com/vkarpov15/kareem/commit/d378113))
+* basic setup for sync hooks #4 ([55aa081](https://github.com/vkarpov15/kareem/commit/55aa081)), closes [#4](https://github.com/vkarpov15/kareem/issues/4)
+* proof of concept for error handlers ([e4a07d9](https://github.com/vkarpov15/kareem/commit/e4a07d9))
+* refactor out handleWrapError helper ([b19af38](https://github.com/vkarpov15/kareem/commit/b19af38))
+
+
+
+
+## 1.0.1 (2015-05-10)
+
+* Fix #1 ([de60dc6](https://github.com/vkarpov15/kareem/commit/de60dc6)), closes [#1](https://github.com/vkarpov15/kareem/issues/1)
+* release 1.0.1 ([6971088](https://github.com/vkarpov15/kareem/commit/6971088))
+* Run tests on iojs in travis ([adcd201](https://github.com/vkarpov15/kareem/commit/adcd201))
+* support legacy post hook behavior in wrap() ([23fa74c](https://github.com/vkarpov15/kareem/commit/23fa74c))
+* Use node 0.12 in travis ([834689d](https://github.com/vkarpov15/kareem/commit/834689d))
+
+
+
+
+## 1.0.0 (2015-01-28)
+
+* Tag 1.0.0 ([4c5a35a](https://github.com/vkarpov15/kareem/commit/4c5a35a))
+
+
+
+
+## 0.0.8 (2015-01-27)
+
+* Add clone function ([688bba7](https://github.com/vkarpov15/kareem/commit/688bba7))
+* Add jscs for style checking ([5c93149](https://github.com/vkarpov15/kareem/commit/5c93149))
+* Bump 0.0.8 ([03c0d2f](https://github.com/vkarpov15/kareem/commit/03c0d2f))
+* Fix jscs config, add gulp rules ([9989abf](https://github.com/vkarpov15/kareem/commit/9989abf))
+* fix Makefile typo ([1f7e61a](https://github.com/vkarpov15/kareem/commit/1f7e61a))
+
+
+
+
+## 0.0.7 (2015-01-04)
+
+* Bump 0.0.7 ([98ef173](https://github.com/vkarpov15/kareem/commit/98ef173))
+* fix LearnBoost/mongoose#2553 - use null instead of undefined for err ([9157b48](https://github.com/vkarpov15/kareem/commit/9157b48)), closes [LearnBoost/mongoose#2553](https://github.com/LearnBoost/mongoose/issues/2553)
+* Regenerate docs ([2331cdf](https://github.com/vkarpov15/kareem/commit/2331cdf))
+
+
+
+
+## 0.0.6 (2015-01-01)
+
+* Update docs and bump 0.0.6 ([92c12a7](https://github.com/vkarpov15/kareem/commit/92c12a7))
+
+
+
+
+## 0.0.5 (2015-01-01)
+
+* Add coverage rule to Makefile ([825a91c](https://github.com/vkarpov15/kareem/commit/825a91c))
+* Add coveralls to README ([fb52369](https://github.com/vkarpov15/kareem/commit/fb52369))
+* Add coveralls to travis ([93f6f15](https://github.com/vkarpov15/kareem/commit/93f6f15))
+* Add createWrapper() function ([ea77741](https://github.com/vkarpov15/kareem/commit/ea77741))
+* Add istanbul code coverage ([6eceeef](https://github.com/vkarpov15/kareem/commit/6eceeef))
+* Add some more comments for examples ([c5b0c6f](https://github.com/vkarpov15/kareem/commit/c5b0c6f))
+* Add travis ([e6dcb06](https://github.com/vkarpov15/kareem/commit/e6dcb06))
+* Add travis badge to docs ([ad8c9b3](https://github.com/vkarpov15/kareem/commit/ad8c9b3))
+* Add wrap() tests, 100% coverage ([6945be4](https://github.com/vkarpov15/kareem/commit/6945be4))
+* Better test coverage for execPost ([d9ad539](https://github.com/vkarpov15/kareem/commit/d9ad539))
+* Bump 0.0.5 ([69875b1](https://github.com/vkarpov15/kareem/commit/69875b1))
+* Docs fix ([15b7098](https://github.com/vkarpov15/kareem/commit/15b7098))
+* Fix silly mistake in docs generation ([50373eb](https://github.com/vkarpov15/kareem/commit/50373eb))
+* Fix typo in readme ([fec4925](https://github.com/vkarpov15/kareem/commit/fec4925))
+* Linkify travis badge ([92b25fe](https://github.com/vkarpov15/kareem/commit/92b25fe))
+* Make travis run coverage ([747157b](https://github.com/vkarpov15/kareem/commit/747157b))
+* Move travis status badge ([d52e89b](https://github.com/vkarpov15/kareem/commit/d52e89b))
+* Quick fix for coverage ([50bbddb](https://github.com/vkarpov15/kareem/commit/50bbddb))
+* Typo fix ([adea794](https://github.com/vkarpov15/kareem/commit/adea794))
+
+
+
+
+## 0.0.4 (2014-12-13)
+
+* Bump 0.0.4, run docs generation ([51a15fe](https://github.com/vkarpov15/kareem/commit/51a15fe))
+* Use correct post parameters in wrap() ([9bb5da3](https://github.com/vkarpov15/kareem/commit/9bb5da3))
+
+
+
+
+## 0.0.3 (2014-12-12)
+
+* Add npm test script, fix small bug with args not getting passed through post ([49e3e68](https://github.com/vkarpov15/kareem/commit/49e3e68))
+* Bump 0.0.3 ([65621d8](https://github.com/vkarpov15/kareem/commit/65621d8))
+* Update readme ([901388b](https://github.com/vkarpov15/kareem/commit/901388b))
+
+
+
+
+## 0.0.2 (2014-12-12)
+
+* Add github repo and bump 0.0.2 ([59db8be](https://github.com/vkarpov15/kareem/commit/59db8be))
+
+
+
+
+## 0.0.1 (2014-12-12)
+
+* Add basic docs ([ad29ea4](https://github.com/vkarpov15/kareem/commit/ad29ea4))
+* Add pre hooks ([2ffc356](https://github.com/vkarpov15/kareem/commit/2ffc356))
+* Add wrap function ([68c540c](https://github.com/vkarpov15/kareem/commit/68c540c))
+* Bump to version 0.0.1 ([a4bfd68](https://github.com/vkarpov15/kareem/commit/a4bfd68))
+* Initial commit ([4002458](https://github.com/vkarpov15/kareem/commit/4002458))
+* Initial deposit ([98fc489](https://github.com/vkarpov15/kareem/commit/98fc489))
+* Post hooks ([395b67c](https://github.com/vkarpov15/kareem/commit/395b67c))
+* Some basic setup work ([82df75e](https://github.com/vkarpov15/kareem/commit/82df75e))
+* Support sync pre hooks ([1cc1b9f](https://github.com/vkarpov15/kareem/commit/1cc1b9f))
+* Update package.json description ([978da18](https://github.com/vkarpov15/kareem/commit/978da18))
+
+
+
+
+## 2.2.5 (2018-09-24)
+
+
+
+
+
+## 2.2.4 (2018-09-24)
+
+
+
+
+
+## 2.2.3 (2018-09-24)
+
+* fix(filter): copy async pres correctly with `filter()` ([1b1ed8a](https://github.com/vkarpov15/kareem/commit/1b1ed8a)), closes [Automattic/mongoose#3054](https://github.com/Automattic/mongoose/issues/3054)
+* feat: add filter() function ([1f641f4](https://github.com/vkarpov15/kareem/commit/1f641f4))
+* feat: support storing options on pre and post hooks ([59220b9](https://github.com/vkarpov15/kareem/commit/59220b9))
+
+
+
+
+## 2.2.3 (2018-09-10)
+
+* chore: release 2.2.3 ([af653a3](https://github.com/vkarpov15/kareem/commit/af653a3))
+
+
+
+
+## 2.2.2 (2018-09-10)
+
+* chore: release 2.2.2 ([3f0144d](https://github.com/vkarpov15/kareem/commit/3f0144d))
+* fix: allow merge() to not clone ([e628d65](https://github.com/vkarpov15/kareem/commit/e628d65))
+
+
+
+
+## 2.2.1 (2018-06-05)
+
+* chore: release 2.2.1 ([4625a64](https://github.com/vkarpov15/kareem/commit/4625a64))
+* chore: remove lockfile from git ([7f3e4e6](https://github.com/vkarpov15/kareem/commit/7f3e4e6))
+* fix: handle numAsync correctly when merging ([fef8e7e](https://github.com/vkarpov15/kareem/commit/fef8e7e))
+* test: repro issue with not copying numAsync ([952d9db](https://github.com/vkarpov15/kareem/commit/952d9db))
+
+
+
+
+## 2.2.0 (2018-06-05)
+
+* chore: release 2.2.0 ([ff9ad03](https://github.com/vkarpov15/kareem/commit/ff9ad03))
+* fix: use maps instead of objects for _pres and _posts so `toString()` doesn't get reported as having ([55df303](https://github.com/vkarpov15/kareem/commit/55df303)), closes [Automattic/mongoose#6538](https://github.com/Automattic/mongoose/issues/6538)
+
+
+
+
+## 2.1.0 (2018-05-16)
+
+* chore: release 2.1.0 ([ba5f1bc](https://github.com/vkarpov15/kareem/commit/ba5f1bc))
+* feat: add option to check wrapped function return value for promises ([c9d7dd1](https://github.com/vkarpov15/kareem/commit/c9d7dd1))
+* refactor: use const in wrap() ([0fc21f9](https://github.com/vkarpov15/kareem/commit/0fc21f9))
+
+
+
+
+## 2.0.7 (2018-04-28)
+
+* chore: release 2.0.7 ([0bf91e6](https://github.com/vkarpov15/kareem/commit/0bf91e6))
+* feat: add `hasHooks()` ([225f18d](https://github.com/vkarpov15/kareem/commit/225f18d)), closes [Automattic/mongoose#6385](https://github.com/Automattic/mongoose/issues/6385)
+
+
+
+
+## 2.0.6 (2018-03-22)
+
+* chore: release 2.0.6 ([f3d406b](https://github.com/vkarpov15/kareem/commit/f3d406b))
+* fix(wrap): ensure fast path still wraps function in `nextTick()` for chaining ([7000494](https://github.com/vkarpov15/kareem/commit/7000494)), closes [Automattic/mongoose#6250](https://github.com/Automattic/mongoose/issues/6250) [dsanel/mongoose-delete#36](https://github.com/dsanel/mongoose-delete/issues/36)
+
+
+
+
+## 2.0.5 (2018-02-22)
+
+* chore: release 2.0.5 ([3286612](https://github.com/vkarpov15/kareem/commit/3286612))
+* perf(createWrapper): don't create wrapper if there are no hooks ([5afc5b9](https://github.com/vkarpov15/kareem/commit/5afc5b9)), closes [Automattic/mongoose#6126](https://github.com/Automattic/mongoose/issues/6126)
+
+
+
+
+## 2.0.4 (2018-02-08)
+
+* chore: release 2.0.4 ([2ab0293](https://github.com/vkarpov15/kareem/commit/2ab0293))
+
+
+
+
+## 2.0.3 (2018-02-01)
+
+* chore: release 2.0.3 ([3c1abe5](https://github.com/vkarpov15/kareem/commit/3c1abe5))
+* fix: use process.nextTick() re: Automattic/mongoose#6074 ([e5bfe33](https://github.com/vkarpov15/kareem/commit/e5bfe33)), closes [Automattic/mongoose#6074](https://github.com/Automattic/mongoose/issues/6074)
+
+
+
+
+## 2.0.2 (2018-01-24)
+
+* chore: fix license ([a9d755c](https://github.com/vkarpov15/kareem/commit/a9d755c)), closes [#10](https://github.com/vkarpov15/kareem/issues/10)
+* chore: release 2.0.2 ([fe87ab6](https://github.com/vkarpov15/kareem/commit/fe87ab6))
+
+
+
+
+## 2.0.1 (2018-01-09)
+
+* chore: release 2.0.1 with lockfile bump ([09c44fb](https://github.com/vkarpov15/kareem/commit/09c44fb))
+
+
+
+
+## 2.0.0 (2018-01-09)
+
+* chore: bump marked re: security ([cc564a9](https://github.com/vkarpov15/kareem/commit/cc564a9))
+* chore: release 2.0.0 ([f511d1c](https://github.com/vkarpov15/kareem/commit/f511d1c))
+
+
+
+
+## 2.0.0-rc5 (2017-12-23)
+
+* chore: fix build on node 4+5 ([6dac5a4](https://github.com/vkarpov15/kareem/commit/6dac5a4))
+* chore: fix built on node 4 + 5 again ([434ef0a](https://github.com/vkarpov15/kareem/commit/434ef0a))
+* chore: release 2.0.0-rc5 ([25a32ee](https://github.com/vkarpov15/kareem/commit/25a32ee))
+
+
+
+
+## 2.0.0-rc4 (2017-12-22)
+
+* chore: release 2.0.0-rc4 ([49fc083](https://github.com/vkarpov15/kareem/commit/49fc083))
+* BREAKING CHANGE: deduplicate when merging hooks re: Automattic/mongoose#2945 ([d458573](https://github.com/vkarpov15/kareem/commit/d458573)), closes [Automattic/mongoose#2945](https://github.com/Automattic/mongoose/issues/2945)
+
+
+
+
+## 2.0.0-rc3 (2017-12-22)
+
+* chore: release 2.0.0-rc3 ([adaaa00](https://github.com/vkarpov15/kareem/commit/adaaa00))
+* feat: support returning promises from middleware functions ([05b4480](https://github.com/vkarpov15/kareem/commit/05b4480)), closes [Automattic/mongoose#3779](https://github.com/Automattic/mongoose/issues/3779)
+
+
+
+
+## 2.0.0-rc2 (2017-12-21)
+
+* chore: release 2.0.0-rc2 ([76325fa](https://github.com/vkarpov15/kareem/commit/76325fa))
+* fix: ensure next() and done() run in next tick ([6c20684](https://github.com/vkarpov15/kareem/commit/6c20684))
+
+
+
+
+## 2.0.0-rc1 (2017-12-21)
+
+* chore: improve test coverage re: Automattic/mongoose#3232 ([7b45cf0](https://github.com/vkarpov15/kareem/commit/7b45cf0)), closes [Automattic/mongoose#3232](https://github.com/Automattic/mongoose/issues/3232)
+* chore: release 2.0.0-rc1 ([9b83f52](https://github.com/vkarpov15/kareem/commit/9b83f52))
+* BREAKING CHANGE: report sync exceptions as errors, only allow calling next() and done() once ([674adcc](https://github.com/vkarpov15/kareem/commit/674adcc)), closes [Automattic/mongoose#3483](https://github.com/Automattic/mongoose/issues/3483)
+
+
+
+
+## 2.0.0-rc0 (2017-12-17)
+
+* chore: release 2.0.0-rc0 ([16b44b5](https://github.com/vkarpov15/kareem/commit/16b44b5))
+* BREAKING CHANGE: drop support for node < 4 ([9cbb8c7](https://github.com/vkarpov15/kareem/commit/9cbb8c7))
+* BREAKING CHANGE: remove useLegacyPost and add several new features ([6dd8531](https://github.com/vkarpov15/kareem/commit/6dd8531)), closes [Automattic/mongoose#3232](https://github.com/Automattic/mongoose/issues/3232)
+
+
+
+
+## 1.5.0 (2017-07-20)
+
+* chore: release 1.5.0 ([9c491a0](https://github.com/vkarpov15/kareem/commit/9c491a0))
+* fix: improve post error handlers results ([9928dd5](https://github.com/vkarpov15/kareem/commit/9928dd5)), closes [Automattic/mongoose#5466](https://github.com/Automattic/mongoose/issues/5466)
+
+
+
+
+## 1.4.2 (2017-07-06)
+
+* chore: release 1.4.2 ([8d14ac5](https://github.com/vkarpov15/kareem/commit/8d14ac5))
+* fix: correct args re: Automattic/mongoose#5405 ([3f28ae6](https://github.com/vkarpov15/kareem/commit/3f28ae6)), closes [Automattic/mongoose#5405](https://github.com/Automattic/mongoose/issues/5405)
+
+
+
+
+## 1.4.1 (2017-04-25)
+
+* chore: release 1.4.1 ([5ecf0c2](https://github.com/vkarpov15/kareem/commit/5ecf0c2))
+* fix: handle numAsyncPres with clone() ([c72e857](https://github.com/vkarpov15/kareem/commit/c72e857)), closes [#8](https://github.com/vkarpov15/kareem/issues/8)
+* test: repro #8 ([9b4d6b2](https://github.com/vkarpov15/kareem/commit/9b4d6b2)), closes [#8](https://github.com/vkarpov15/kareem/issues/8)
+
+
+
+
+## 1.4.0 (2017-04-19)
+
+* chore: release 1.4.0 ([101c5f5](https://github.com/vkarpov15/kareem/commit/101c5f5))
+* feat: add merge() function ([285325e](https://github.com/vkarpov15/kareem/commit/285325e))
+
+
+
+
+## 1.3.0 (2017-03-26)
+
+* chore: release 1.3.0 ([f3a9e50](https://github.com/vkarpov15/kareem/commit/f3a9e50))
+* feat: pass function args to execPre ([4dd466d](https://github.com/vkarpov15/kareem/commit/4dd466d))
+
+
+
+
+## 1.2.1 (2017-02-03)
+
+* chore: release 1.2.1 ([d97081f](https://github.com/vkarpov15/kareem/commit/d97081f))
+* fix: filter out _kareemIgnored args for error handlers re: Automattic/mongoose#4925 ([ddc7aeb](https://github.com/vkarpov15/kareem/commit/ddc7aeb)), closes [Automattic/mongoose#4925](https://github.com/Automattic/mongoose/issues/4925)
+* fix: make error handlers handle errors in pre hooks ([af38033](https://github.com/vkarpov15/kareem/commit/af38033)), closes [Automattic/mongoose#4927](https://github.com/Automattic/mongoose/issues/4927)
+
+
+
+
+## 1.2.0 (2017-01-02)
+
+* chore: release 1.2.0 ([033225c](https://github.com/vkarpov15/kareem/commit/033225c))
+* chore: upgrade deps ([f9e9a09](https://github.com/vkarpov15/kareem/commit/f9e9a09))
+* feat: add _kareemIgnore re: Automattic/mongoose#4836 ([7957771](https://github.com/vkarpov15/kareem/commit/7957771)), closes [Automattic/mongoose#4836](https://github.com/Automattic/mongoose/issues/4836)
+
+
+
+
+## 1.1.5 (2016-12-13)
+
+* chore: release 1.1.5 ([1a9f684](https://github.com/vkarpov15/kareem/commit/1a9f684))
+* fix: correct field name ([04a0e9d](https://github.com/vkarpov15/kareem/commit/04a0e9d))
+
+
+
+
+## 1.1.4 (2016-12-09)
+
+* chore: release 1.1.4 ([ece401c](https://github.com/vkarpov15/kareem/commit/ece401c))
+* chore: run tests on node 6 ([e0cb1cb](https://github.com/vkarpov15/kareem/commit/e0cb1cb))
+* fix: only copy own properties in clone() ([dfe28ce](https://github.com/vkarpov15/kareem/commit/dfe28ce)), closes [#7](https://github.com/vkarpov15/kareem/issues/7)
+
+
+
+
+## 1.1.3 (2016-06-27)
+
+* chore: release 1.1.3 ([87171c8](https://github.com/vkarpov15/kareem/commit/87171c8))
+* fix: couple more issues with arg processing ([c65f523](https://github.com/vkarpov15/kareem/commit/c65f523))
+
+
+
+
+## 1.1.2 (2016-06-27)
+
+* chore: release 1.1.2 ([8e102b6](https://github.com/vkarpov15/kareem/commit/8e102b6))
+* fix: add early return ([4feda4e](https://github.com/vkarpov15/kareem/commit/4feda4e))
+
+
+
+
+## 1.1.1 (2016-06-27)
+
+* chore: release 1.1.1 ([8bb3050](https://github.com/vkarpov15/kareem/commit/8bb3050))
+* fix: skip error handlers if no error ([0eb3a44](https://github.com/vkarpov15/kareem/commit/0eb3a44))
+
+
+
+
+## 1.1.0 (2016-05-11)
+
+* chore: release 1.1.0 ([85332d9](https://github.com/vkarpov15/kareem/commit/85332d9))
+* chore: test on node 4 and node 5 ([1faefa1](https://github.com/vkarpov15/kareem/commit/1faefa1))
+* 100% coverage again ([c9aee4e](https://github.com/vkarpov15/kareem/commit/c9aee4e))
+* add support for error post hooks ([d378113](https://github.com/vkarpov15/kareem/commit/d378113))
+* basic setup for sync hooks #4 ([55aa081](https://github.com/vkarpov15/kareem/commit/55aa081)), closes [#4](https://github.com/vkarpov15/kareem/issues/4)
+* proof of concept for error handlers ([e4a07d9](https://github.com/vkarpov15/kareem/commit/e4a07d9))
+* refactor out handleWrapError helper ([b19af38](https://github.com/vkarpov15/kareem/commit/b19af38))
+
+
+
+
+## 1.0.1 (2015-05-10)
+
+* Fix #1 ([de60dc6](https://github.com/vkarpov15/kareem/commit/de60dc6)), closes [#1](https://github.com/vkarpov15/kareem/issues/1)
+* release 1.0.1 ([6971088](https://github.com/vkarpov15/kareem/commit/6971088))
+* Run tests on iojs in travis ([adcd201](https://github.com/vkarpov15/kareem/commit/adcd201))
+* support legacy post hook behavior in wrap() ([23fa74c](https://github.com/vkarpov15/kareem/commit/23fa74c))
+* Use node 0.12 in travis ([834689d](https://github.com/vkarpov15/kareem/commit/834689d))
+
+
+
+
+## 1.0.0 (2015-01-28)
+
+* Tag 1.0.0 ([4c5a35a](https://github.com/vkarpov15/kareem/commit/4c5a35a))
+
+
+
+
+## 0.0.8 (2015-01-27)
+
+* Add clone function ([688bba7](https://github.com/vkarpov15/kareem/commit/688bba7))
+* Add jscs for style checking ([5c93149](https://github.com/vkarpov15/kareem/commit/5c93149))
+* Bump 0.0.8 ([03c0d2f](https://github.com/vkarpov15/kareem/commit/03c0d2f))
+* Fix jscs config, add gulp rules ([9989abf](https://github.com/vkarpov15/kareem/commit/9989abf))
+* fix Makefile typo ([1f7e61a](https://github.com/vkarpov15/kareem/commit/1f7e61a))
+
+
+
+
+## 0.0.7 (2015-01-04)
+
+* Bump 0.0.7 ([98ef173](https://github.com/vkarpov15/kareem/commit/98ef173))
+* fix LearnBoost/mongoose#2553 - use null instead of undefined for err ([9157b48](https://github.com/vkarpov15/kareem/commit/9157b48)), closes [LearnBoost/mongoose#2553](https://github.com/LearnBoost/mongoose/issues/2553)
+* Regenerate docs ([2331cdf](https://github.com/vkarpov15/kareem/commit/2331cdf))
+
+
+
+
+## 0.0.6 (2015-01-01)
+
+* Update docs and bump 0.0.6 ([92c12a7](https://github.com/vkarpov15/kareem/commit/92c12a7))
+
+
+
+
+## 0.0.5 (2015-01-01)
+
+* Add coverage rule to Makefile ([825a91c](https://github.com/vkarpov15/kareem/commit/825a91c))
+* Add coveralls to README ([fb52369](https://github.com/vkarpov15/kareem/commit/fb52369))
+* Add coveralls to travis ([93f6f15](https://github.com/vkarpov15/kareem/commit/93f6f15))
+* Add createWrapper() function ([ea77741](https://github.com/vkarpov15/kareem/commit/ea77741))
+* Add istanbul code coverage ([6eceeef](https://github.com/vkarpov15/kareem/commit/6eceeef))
+* Add some more comments for examples ([c5b0c6f](https://github.com/vkarpov15/kareem/commit/c5b0c6f))
+* Add travis ([e6dcb06](https://github.com/vkarpov15/kareem/commit/e6dcb06))
+* Add travis badge to docs ([ad8c9b3](https://github.com/vkarpov15/kareem/commit/ad8c9b3))
+* Add wrap() tests, 100% coverage ([6945be4](https://github.com/vkarpov15/kareem/commit/6945be4))
+* Better test coverage for execPost ([d9ad539](https://github.com/vkarpov15/kareem/commit/d9ad539))
+* Bump 0.0.5 ([69875b1](https://github.com/vkarpov15/kareem/commit/69875b1))
+* Docs fix ([15b7098](https://github.com/vkarpov15/kareem/commit/15b7098))
+* Fix silly mistake in docs generation ([50373eb](https://github.com/vkarpov15/kareem/commit/50373eb))
+* Fix typo in readme ([fec4925](https://github.com/vkarpov15/kareem/commit/fec4925))
+* Linkify travis badge ([92b25fe](https://github.com/vkarpov15/kareem/commit/92b25fe))
+* Make travis run coverage ([747157b](https://github.com/vkarpov15/kareem/commit/747157b))
+* Move travis status badge ([d52e89b](https://github.com/vkarpov15/kareem/commit/d52e89b))
+* Quick fix for coverage ([50bbddb](https://github.com/vkarpov15/kareem/commit/50bbddb))
+* Typo fix ([adea794](https://github.com/vkarpov15/kareem/commit/adea794))
+
+
+
+
+## 0.0.4 (2014-12-13)
+
+* Bump 0.0.4, run docs generation ([51a15fe](https://github.com/vkarpov15/kareem/commit/51a15fe))
+* Use correct post parameters in wrap() ([9bb5da3](https://github.com/vkarpov15/kareem/commit/9bb5da3))
+
+
+
+
+## 0.0.3 (2014-12-12)
+
+* Add npm test script, fix small bug with args not getting passed through post ([49e3e68](https://github.com/vkarpov15/kareem/commit/49e3e68))
+* Bump 0.0.3 ([65621d8](https://github.com/vkarpov15/kareem/commit/65621d8))
+* Update readme ([901388b](https://github.com/vkarpov15/kareem/commit/901388b))
+
+
+
+
+## 0.0.2 (2014-12-12)
+
+* Add github repo and bump 0.0.2 ([59db8be](https://github.com/vkarpov15/kareem/commit/59db8be))
+
+
+
+
+## 0.0.1 (2014-12-12)
+
+* Add basic docs ([ad29ea4](https://github.com/vkarpov15/kareem/commit/ad29ea4))
+* Add pre hooks ([2ffc356](https://github.com/vkarpov15/kareem/commit/2ffc356))
+* Add wrap function ([68c540c](https://github.com/vkarpov15/kareem/commit/68c540c))
+* Bump to version 0.0.1 ([a4bfd68](https://github.com/vkarpov15/kareem/commit/a4bfd68))
+* Initial commit ([4002458](https://github.com/vkarpov15/kareem/commit/4002458))
+* Initial deposit ([98fc489](https://github.com/vkarpov15/kareem/commit/98fc489))
+* Post hooks ([395b67c](https://github.com/vkarpov15/kareem/commit/395b67c))
+* Some basic setup work ([82df75e](https://github.com/vkarpov15/kareem/commit/82df75e))
+* Support sync pre hooks ([1cc1b9f](https://github.com/vkarpov15/kareem/commit/1cc1b9f))
+* Update package.json description ([978da18](https://github.com/vkarpov15/kareem/commit/978da18))
diff --git a/node_modules/kareem/LICENSE b/node_modules/kareem/LICENSE
new file mode 100644
index 00000000..b0d46d3c
--- /dev/null
+++ b/node_modules/kareem/LICENSE
@@ -0,0 +1,202 @@
+Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2014-2022 mongoosejs
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/node_modules/kareem/README.md b/node_modules/kareem/README.md
new file mode 100644
index 00000000..92b01c9f
--- /dev/null
+++ b/node_modules/kareem/README.md
@@ -0,0 +1,385 @@
+# kareem
+
+ [](https://github.com/mongoosejs/kareem/actions/workflows/test.yml)
+
+
+Re-imagined take on the [hooks](http://npmjs.org/package/hooks) module, meant to offer additional flexibility in allowing you to execute hooks whenever necessary, as opposed to simply wrapping a single function.
+
+Named for the NBA's 2nd all-time leading scorer Kareem Abdul-Jabbar, known for his mastery of the [hook shot](http://en.wikipedia.org/wiki/Kareem_Abdul-Jabbar#Skyhook)
+
+
+
+
+
+# API
+
+## pre hooks
+
+Much like [hooks](https://npmjs.org/package/hooks), kareem lets you define
+pre and post hooks: pre hooks are called before a given function executes.
+Unlike hooks, kareem stores hooks and other internal state in a separate
+object, rather than relying on inheritance. Furthermore, kareem exposes
+an `execPre()` function that allows you to execute your pre hooks when
+appropriate, giving you more fine-grained control over your function hooks.
+
+### It runs without any hooks specified
+
+```javascript
+await hooks.execPre('cook', null);
+```
+
+### It runs basic serial pre hooks
+
+pre hook functions can return a promise that resolves when finished.
+
+```javascript
+let count = 0;
+
+hooks.pre('cook', function() {
+ ++count;
+ return Promise.resolve();
+});
+
+await hooks.execPre('cook', null);
+assert.equal(1, count);
+```
+
+### It can run multiple pre hooks
+
+```javascript
+let count1 = 0;
+let count2 = 0;
+
+hooks.pre('cook', function() {
+ ++count1;
+ return Promise.resolve();
+});
+
+hooks.pre('cook', function() {
+ ++count2;
+ return Promise.resolve();
+});
+
+await hooks.execPre('cook', null);
+assert.equal(1, count1);
+assert.equal(1, count2);
+```
+
+### It can run fully synchronous pre hooks
+
+If your pre hook function takes no parameters, its assumed to be
+fully synchronous.
+
+```javascript
+let count1 = 0;
+let count2 = 0;
+
+hooks.pre('cook', function() {
+ ++count1;
+});
+
+hooks.pre('cook', function() {
+ ++count2;
+});
+
+await hooks.execPre('cook', null);
+assert.equal(1, count1);
+assert.equal(1, count2);
+```
+
+### It properly attaches context to pre hooks
+
+Pre save hook functions are bound to the second parameter to `execPre()`
+
+```javascript
+hooks.pre('cook', function() {
+ this.bacon = 3;
+});
+
+hooks.pre('cook', function() {
+ this.eggs = 4;
+});
+
+const obj = { bacon: 0, eggs: 0 };
+
+// In the pre hooks, `this` will refer to `obj`
+await hooks.execPre('cook', obj);
+assert.equal(3, obj.bacon);
+assert.equal(4, obj.eggs);
+```
+
+### It supports returning a promise
+
+You can also return a promise from your pre hooks instead of calling
+`next()`. When the returned promise resolves, kareem will kick off the
+next middleware.
+
+```javascript
+hooks.pre('cook', function() {
+ return new Promise(resolve => {
+ setTimeout(() => {
+ this.bacon = 3;
+ resolve();
+ }, 100);
+ });
+});
+
+const obj = { bacon: 0 };
+
+await hooks.execPre('cook', obj);
+assert.equal(3, obj.bacon);
+```
+
+### It supports filtering which hooks to run
+
+You can pass a `filter` option to `execPre()` to select which hooks
+to run. The filter function receives each hook object and should return
+`true` to run the hook or `false` to skip it.
+
+```javascript
+const execed = [];
+
+const fn1 = function() { execed.push('first'); };
+fn1.skipMe = true;
+hooks.pre('cook', fn1);
+
+const fn2 = function() { execed.push('second'); };
+hooks.pre('cook', fn2);
+
+// Only runs fn2, skips fn1 because fn1.skipMe is true
+await hooks.execPre('cook', null, [], {
+ filter: hook => !hook.fn.skipMe
+});
+
+assert.deepStrictEqual(execed, ['second']);
+```
+
+## post hooks
+
+### It runs without any hooks specified
+
+```javascript
+const [eggs] = await hooks.execPost('cook', null, [1]);
+assert.equal(eggs, 1);
+```
+
+### It executes with parameters passed in
+
+```javascript
+hooks.post('cook', function(eggs, bacon, callback) {
+ assert.equal(eggs, 1);
+ assert.equal(bacon, 2);
+ callback();
+});
+
+const [eggs, bacon] = await hooks.execPost('cook', null, [1, 2]);
+assert.equal(eggs, 1);
+assert.equal(bacon, 2);
+```
+
+### It can use synchronous post hooks
+
+```javascript
+const execed = {};
+
+hooks.post('cook', function(eggs, bacon) {
+ execed.first = true;
+ assert.equal(eggs, 1);
+ assert.equal(bacon, 2);
+});
+
+hooks.post('cook', function(eggs, bacon, callback) {
+ execed.second = true;
+ assert.equal(eggs, 1);
+ assert.equal(bacon, 2);
+ callback();
+});
+
+const [eggs, bacon] = await hooks.execPost('cook', null, [1, 2]);
+assert.equal(Object.keys(execed).length, 2);
+assert.ok(execed.first);
+assert.ok(execed.second);
+assert.equal(eggs, 1);
+assert.equal(bacon, 2);
+```
+
+### It supports returning a promise
+
+You can also return a promise from your post hooks instead of calling
+`next()`. When the returned promise resolves, kareem will kick off the
+next middleware.
+
+```javascript
+hooks.post('cook', function() {
+ return new Promise(resolve => {
+ setTimeout(() => {
+ this.bacon = 3;
+ resolve();
+ }, 100);
+ });
+});
+
+const obj = { bacon: 0 };
+
+await hooks.execPost('cook', obj, [obj]);
+assert.equal(obj.bacon, 3);
+```
+
+### It supports filtering which hooks to run
+
+You can pass a `filter` option to `execPost()` to select which hooks
+to run. The filter function receives each hook object and should return
+`true` to run the hook or `false` to skip it.
+
+```javascript
+const execed = [];
+
+const fn1 = function() { execed.push('first'); };
+fn1.skipMe = true;
+hooks.post('cook', fn1);
+
+const fn2 = function() { execed.push('second'); };
+hooks.post('cook', fn2);
+
+// Only runs fn2, skips fn1 because fn1.skipMe is true
+await hooks.execPost('cook', null, [], {
+ filter: hook => !hook.fn.skipMe
+});
+
+assert.deepStrictEqual(execed, ['second']);
+```
+
+## wrap()
+
+### It wraps pre and post calls into one call
+
+```javascript
+hooks.pre('cook', function() {
+ return new Promise(resolve => {
+ this.bacon = 3;
+ setTimeout(() => {
+ resolve();
+ }, 5);
+ });
+});
+
+hooks.pre('cook', function() {
+ this.eggs = 4;
+ return Promise.resolve();
+});
+
+hooks.pre('cook', function() {
+ this.waffles = false;
+ return Promise.resolve();
+});
+
+hooks.post('cook', function(obj) {
+ obj.tofu = 'no';
+});
+
+const obj = { bacon: 0, eggs: 0 };
+
+const args = [obj];
+
+const result = await hooks.wrap(
+ 'cook',
+ function(o) {
+ assert.equal(obj.bacon, 3);
+ assert.equal(obj.eggs, 4);
+ assert.equal(obj.waffles, false);
+ assert.equal(obj.tofu, undefined);
+ return o;
+ },
+ obj,
+ args);
+
+assert.equal(obj.bacon, 3);
+assert.equal(obj.eggs, 4);
+assert.equal(obj.waffles, false);
+assert.equal(obj.tofu, 'no');
+assert.equal(result, obj);
+```
+
+## createWrapper()
+
+### It wraps wrap() into a callable function
+
+```javascript
+hooks.pre('cook', function() {
+ this.bacon = 3;
+ return Promise.resolve();
+});
+
+hooks.pre('cook', function() {
+ return new Promise(resolve => {
+ this.eggs = 4;
+ setTimeout(function() {
+ resolve();
+ }, 10);
+ });
+});
+
+hooks.pre('cook', function() {
+ this.waffles = false;
+ return Promise.resolve();
+});
+
+hooks.post('cook', function(obj) {
+ obj.tofu = 'no';
+});
+
+const obj = { bacon: 0, eggs: 0 };
+
+const cook = hooks.createWrapper(
+ 'cook',
+ function(o) {
+ assert.equal(3, obj.bacon);
+ assert.equal(4, obj.eggs);
+ assert.equal(false, obj.waffles);
+ assert.equal(undefined, obj.tofu);
+ return o;
+ },
+ obj);
+
+const result = await cook(obj);
+assert.equal(obj.bacon, 3);
+assert.equal(obj.eggs, 4);
+assert.equal(obj.waffles, false);
+assert.equal(obj.tofu, 'no');
+
+assert.equal(result, obj);
+```
+
+## clone()
+
+### It clones a Kareem object
+
+```javascript
+const k1 = new Kareem();
+k1.pre('cook', function() {});
+k1.post('cook', function() {});
+
+const k2 = k1.clone();
+assert.deepEqual(Array.from(k2._pres.keys()), ['cook']);
+assert.deepEqual(Array.from(k2._posts.keys()), ['cook']);
+```
+
+## merge()
+
+### It pulls hooks from another Kareem object
+
+```javascript
+const k1 = new Kareem();
+const test1 = function() {};
+k1.pre('cook', test1);
+k1.post('cook', function() {});
+
+const k2 = new Kareem();
+const test2 = function() {};
+k2.pre('cook', test2);
+const k3 = k2.merge(k1);
+assert.equal(k3._pres.get('cook').length, 2);
+assert.equal(k3._pres.get('cook')[0].fn, test2);
+assert.equal(k3._pres.get('cook')[1].fn, test1);
+assert.equal(k3._posts.get('cook').length, 1);
+```
diff --git a/node_modules/kareem/SECURITY.md b/node_modules/kareem/SECURITY.md
new file mode 100644
index 00000000..da9c516d
--- /dev/null
+++ b/node_modules/kareem/SECURITY.md
@@ -0,0 +1,5 @@
+## Security contact information
+
+To report a security vulnerability, please use the
+[Tidelift security contact](https://tidelift.com/security).
+Tidelift will coordinate the fix and disclosure.
diff --git a/node_modules/kareem/index.d.ts b/node_modules/kareem/index.d.ts
new file mode 100644
index 00000000..3688c1de
--- /dev/null
+++ b/node_modules/kareem/index.d.ts
@@ -0,0 +1,31 @@
+declare module "kareem" {
+ export default class Kareem {
+ static skipWrappedFunction(): SkipWrappedFunction;
+ static overwriteMiddlewareResult(): OverwriteMiddlewareResult;
+ static overwriteArguments(): OverwriteArguments;
+
+ pre(name: string | RegExp, fn: Function): this;
+ pre(name: string | RegExp, options: Record, fn: Function, error?: any, unshift?: boolean): this;
+ post(name: string | RegExp, fn: Function): this;
+ post(name: string | RegExp, options: Record, fn: Function, unshift?: boolean): this;
+
+ clone(): Kareem;
+ merge(other: Kareem, clone?: boolean): this;
+
+ createWrapper(name: string, fn: Function, context?: any, options?: Record): Function;
+ createWrapperSync(name: string, fn: Function): Function;
+ hasHooks(name: string): boolean;
+ filter(fn: Function): Kareem;
+
+ wrap(name: string, fn: Function, context: any, args: any[], options?: Record): Function;
+
+ execPostSync(name: string, context: any, args: any[]): any;
+ execPost(name: string, context: any, args: any[], options?: Record, callback?: Function): void;
+ execPreSync(name: string, context: any, args: any[]): any;
+ execPre(name: string, context: any, args: any[], callback?: Function): void;
+ }
+
+ class SkipWrappedFunction {}
+ class OverwriteMiddlewareResult {}
+ class OverwriteArguments {}
+}
diff --git a/node_modules/kareem/index.js b/node_modules/kareem/index.js
new file mode 100644
index 00000000..022164eb
--- /dev/null
+++ b/node_modules/kareem/index.js
@@ -0,0 +1,553 @@
+'use strict';
+
+/**
+ * Create a new instance
+ */
+function Kareem() {
+ this._pres = new Map();
+ this._posts = new Map();
+}
+
+Kareem.skipWrappedFunction = function skipWrappedFunction() {
+ if (!(this instanceof Kareem.skipWrappedFunction)) {
+ return new Kareem.skipWrappedFunction(...arguments);
+ }
+
+ this.args = [...arguments];
+};
+
+Kareem.overwriteResult = function overwriteResult() {
+ if (!(this instanceof Kareem.overwriteResult)) {
+ return new Kareem.overwriteResult(...arguments);
+ }
+
+ this.args = [...arguments];
+};
+
+Kareem.overwriteArguments = function overwriteArguments() {
+ if (!(this instanceof Kareem.overwriteArguments)) {
+ return new Kareem.overwriteArguments(...arguments);
+ }
+
+ this.args = [...arguments];
+};
+
+/**
+ * Execute all "pre" hooks for "name"
+ * @param {String} name The hook name to execute
+ * @param {*} context Overwrite the "this" for the hook
+ * @param {Array} args arguments passed to the pre hooks
+ * @param {Object} [options] Optional options
+ * @param {Function} [options.filter] Filter function to select which hooks to run
+ * @returns {Array} The potentially modified arguments
+ */
+Kareem.prototype.execPre = async function execPre(name, context, args, options) {
+ let pres = this._pres.get(name) || [];
+ if (options?.filter) {
+ pres = pres.filter(options.filter);
+ }
+ const numPres = pres.length;
+ let $args = args;
+ let skipWrappedFunction = null;
+
+ if (!numPres) {
+ return $args;
+ }
+
+ for (const pre of pres) {
+ try {
+ const maybePromiseLike = pre.fn.apply(context, $args);
+ if (isPromiseLike(maybePromiseLike)) {
+ const result = await maybePromiseLike;
+ if (result instanceof Kareem.overwriteArguments) {
+ $args = result.args;
+ }
+ } else if (maybePromiseLike instanceof Kareem.overwriteArguments) {
+ $args = maybePromiseLike.args;
+ }
+ } catch (error) {
+ if (error instanceof Kareem.skipWrappedFunction) {
+ skipWrappedFunction = error;
+ continue;
+ }
+ if (error instanceof Kareem.overwriteArguments) {
+ $args = error.args;
+ continue;
+ }
+ throw error;
+ }
+ }
+
+ if (skipWrappedFunction) {
+ throw skipWrappedFunction;
+ }
+
+ return $args;
+};
+
+/**
+ * Execute all "pre" hooks for "name" synchronously
+ * @param {String} name The hook name to execute
+ * @param {*} context Overwrite the "this" for the hook
+ * @param {Array} [args] Apply custom arguments to the hook
+ * @param {Object} [options] Optional options
+ * @param {Function} [options.filter] Filter function to select which hooks to run
+ * @returns {Array} The potentially modified arguments
+ */
+Kareem.prototype.execPreSync = function(name, context, args, options) {
+ let pres = this._pres.get(name) || [];
+ if (options?.filter) {
+ pres = pres.filter(options.filter);
+ }
+ const numPres = pres.length;
+ let $args = args || [];
+
+ for (let i = 0; i < numPres; ++i) {
+ const result = pres[i].fn.apply(context, $args);
+ if (result instanceof Kareem.overwriteArguments) {
+ $args = result.args;
+ }
+ }
+
+ return $args;
+};
+
+/**
+ * Execute all "post" hooks for "name"
+ * @param {String} name The hook name to execute
+ * @param {*} context Overwrite the "this" for the hook
+ * @param {Array} args Apply custom arguments to the hook
+ * @param {Object} [options] Optional options
+ * @param {Error} [options.error] Error to pass to error-handling middleware
+ * @param {Function} [options.filter] Filter function to select which hooks to run
+ * @returns {void}
+ */
+Kareem.prototype.execPost = async function execPost(name, context, args, options) {
+ let posts = this._posts.get(name) || [];
+ if (options?.filter) {
+ posts = posts.filter(options.filter);
+ }
+ const numPosts = posts.length;
+
+ let firstError = null;
+ if (options && options.error) {
+ firstError = options.error;
+ }
+
+ if (!numPosts) {
+ if (firstError != null) {
+ throw firstError;
+ }
+ return args;
+ }
+
+ let cbPromise = null;
+ let resolve;
+ let reject;
+ const nextCallback = function nextCallback(err) {
+ if (err) {
+ reject(err);
+ } else {
+ resolve();
+ }
+ };
+
+ let newArgs = args.slice();
+ _handleNumCallbackParams(newArgs, options?.numCallbackParams);
+ let numArgs = newArgs.length;
+ newArgs.push(nextCallback);
+ let errorArgs = options?.error ? [firstError, ...newArgs] : null;
+
+ for (const currentPost of posts) {
+ const post = currentPost.fn;
+
+ cbPromise = new Promise((_resolve, _reject) => {
+ resolve = _resolve;
+ reject = _reject;
+ });
+
+ if (firstError) {
+ if (isErrorHandlingMiddleware(currentPost, numArgs)) {
+ try {
+ const res = post.apply(context, errorArgs);
+ if (isPromiseLike(res)) {
+ await res;
+ } else if (post.length === numArgs + 2) {
+ // `numArgs + 2` because we added the error and the callback
+ await cbPromise;
+ }
+ } catch (error) {
+ if (error instanceof Kareem.overwriteResult) {
+ args = error.args;
+ newArgs = args.slice();
+ _handleNumCallbackParams(newArgs, options?.numCallbackParams);
+ numArgs = newArgs.length;
+ newArgs.push(nextCallback);
+ continue;
+ }
+ firstError = error;
+ errorArgs = [firstError, ...newArgs];
+ }
+ } else {
+ continue;
+ }
+ } else {
+ if (isErrorHandlingMiddleware(currentPost, numArgs)) {
+ // Skip error handlers if no error
+ continue;
+ } else {
+ let res = null;
+ try {
+ res = post.apply(context, newArgs);
+ if (isPromiseLike(res)) {
+ res = await res;
+ } else if (post.length === numArgs + 1) {
+ // If post function takes a callback, wait for the post function to call the callback
+ res = await cbPromise;
+ }
+ } catch (error) {
+ if (error instanceof Kareem.overwriteResult) {
+ args = error.args;
+ newArgs = args.slice();
+ _handleNumCallbackParams(newArgs, options?.numCallbackParams);
+ numArgs = newArgs.length;
+ newArgs.push(nextCallback);
+ errorArgs = [firstError, ...newArgs];
+ continue;
+ }
+ firstError = error;
+ errorArgs = [firstError, ...newArgs];
+ continue;
+ }
+
+ if (res instanceof Kareem.overwriteResult) {
+ args = res.args;
+ newArgs = args.slice();
+ _handleNumCallbackParams(newArgs, options?.numCallbackParams);
+ numArgs = newArgs.length;
+ newArgs.push(nextCallback);
+ continue;
+ }
+ }
+ }
+ }
+
+ if (firstError != null) {
+ throw firstError;
+ }
+
+ return args;
+};
+
+/*!
+ * Handle the `numCallbackParams` option for `execPostSync`: fill `newArgs` with `null` until
+ * length is `numCallbackParams` if `numCallbackParams` is a number.
+ *
+ * @param {Array} newArgs The arguments to fill
+ * @param {number|null|undefined} numCallbackParams The number of callback parameters
+ */
+
+function _handleNumCallbackParams(newArgs, numCallbackParams) {
+ if (typeof numCallbackParams === 'number' && numCallbackParams > newArgs.length) {
+ for (let i = newArgs.length; i < numCallbackParams; ++i) {
+ newArgs.push(null);
+ }
+ }
+}
+
+/**
+ * Execute all "post" hooks for "name" synchronously
+ * @param {String} name The hook name to execute
+ * @param {*} context Overwrite the "this" for the hook
+ * @param {Array} args Apply custom arguments to the hook
+ * @param {Object} [options] Optional options
+ * @param {Function} [options.filter] Filter function to select which hooks to run
+ * @returns {Array} The used arguments
+ */
+Kareem.prototype.execPostSync = function(name, context, args, options) {
+ let posts = this._posts.get(name) || [];
+ if (options?.filter) {
+ posts = posts.filter(options.filter);
+ }
+ const numPosts = posts.length;
+
+ for (let i = 0; i < numPosts; ++i) {
+ const res = posts[i].fn.apply(context, args || []);
+ if (res instanceof Kareem.overwriteResult) {
+ args = res.args;
+ }
+ }
+
+ return args;
+};
+
+/**
+ * Create a synchronous wrapper for "fn"
+ * @param {String} name The name of the hook
+ * @param {Function} fn The function to wrap
+ * @param {*} context Overwrite the "this" for the hook. If null/undefined, uses the calling context.
+ * @param {Object} [options] Options for the wrapper
+ * @param {Function} [options.getOptions] Function that receives the wrapper arguments and returns options for execPreSync/execPostSync. Can return `{ filter }` for both, or `{ pre: { filter }, post: { filter } }` for separate options.
+ * @returns {Function} The wrapped function
+ */
+Kareem.prototype.createWrapperSync = function(name, fn, context, options) {
+ const _this = this;
+ const getOptions = options?.getOptions;
+ return function syncWrapper() {
+ const _context = context ?? this;
+ const args = Array.from(arguments);
+ const execOptions = typeof getOptions === 'function' ? getOptions(args) : {};
+ const preOptions = execOptions.pre ?? execOptions;
+ const postOptions = execOptions.post ?? execOptions;
+
+ const modifiedArgs = _this.execPreSync(name, _context, args, preOptions);
+
+ const toReturn = fn.apply(_context, modifiedArgs);
+
+ const result = _this.execPostSync(name, _context, [toReturn], postOptions);
+
+ return result[0];
+ };
+};
+
+/**
+ * Executes pre hooks, followed by the wrapped function, followed by post hooks.
+ * @param {String} name The name of the hook
+ * @param {Function} fn The function for the hook
+ * @param {*} context Overwrite the "this" for the hook
+ * @param {Array} args Apply custom arguments to the hook
+ * @param {Object} options Additional options for the hook
+ * @returns {void}
+ */
+Kareem.prototype.wrap = async function wrap(name, fn, context, args, options) {
+ let ret;
+ let skipWrappedFunction = false;
+ let modifiedArgs = args;
+ try {
+ modifiedArgs = await this.execPre(name, context, args);
+ } catch (error) {
+ if (error instanceof Kareem.skipWrappedFunction) {
+ ret = error.args;
+ skipWrappedFunction = true;
+ } else {
+ await this.execPost(name, context, args, { ...options, error });
+ }
+ }
+
+ if (!skipWrappedFunction) {
+ ret = await fn.apply(context, modifiedArgs);
+ }
+
+ ret = await this.execPost(name, context, [ret], options);
+
+ return ret[0];
+};
+
+/**
+ * Filter current instance for something specific and return the filtered clone
+ * @param {Function} fn The filter function
+ * @returns {Kareem} The cloned and filtered instance
+ */
+Kareem.prototype.filter = function(fn) {
+ const clone = this.clone();
+
+ const pres = Array.from(clone._pres.keys());
+ for (const name of pres) {
+ const hooks = this._pres.get(name).
+ map(h => Object.assign({}, h, { name: name })).
+ filter(fn);
+
+ if (hooks.length === 0) {
+ clone._pres.delete(name);
+ continue;
+ }
+
+ clone._pres.set(name, hooks);
+ }
+
+ const posts = Array.from(clone._posts.keys());
+ for (const name of posts) {
+ const hooks = this._posts.get(name).
+ map(h => Object.assign({}, h, { name: name })).
+ filter(fn);
+
+ if (hooks.length === 0) {
+ clone._posts.delete(name);
+ continue;
+ }
+
+ clone._posts.set(name, hooks);
+ }
+
+ return clone;
+};
+
+/**
+ * Check for a "name" to exist either in pre or post hooks
+ * @param {String} name The name of the hook
+ * @returns {Boolean} "true" if found, "false" otherwise
+ */
+Kareem.prototype.hasHooks = function(name) {
+ return this._pres.has(name) || this._posts.has(name);
+};
+
+/**
+ * Create a Wrapper for "fn" on "name" and return the wrapped function
+ * @param {String} name The name of the hook
+ * @param {Function} fn The function to wrap
+ * @param {*} context Overwrite the "this" for the hook
+ * @param {Object} [options]
+ * @returns {Function} The wrapped function
+ */
+Kareem.prototype.createWrapper = function(name, fn, context, options) {
+ const _this = this;
+ if (!this.hasHooks(name)) {
+ // Fast path: if there's no hooks for this function, just return the function
+ return fn;
+ }
+ return function kareemWrappedFunction() {
+ const _context = context || this;
+ return _this.wrap(name, fn, _context, Array.from(arguments), options);
+ };
+};
+
+/**
+ * Register a new hook for "pre"
+ * @param {String} name The name of the hook
+ * @param {Object} [options]
+ * @param {Function} fn The function to register for "name"
+ * @param {never} error Unused
+ * @param {Boolean} [unshift] Wheter to "push" or to "unshift" the new hook
+ * @returns {Kareem}
+ */
+Kareem.prototype.pre = function(name, options, fn, error, unshift) {
+ if (typeof options === 'function') {
+ fn = options;
+ options = {};
+ } else if (options == null) {
+ options = {};
+ }
+
+ const pres = this._pres.get(name) || [];
+ this._pres.set(name, pres);
+
+ if (typeof fn !== 'function') {
+ throw new Error('pre() requires a function, got "' + typeof fn + '"');
+ }
+
+ if (unshift) {
+ pres.unshift(Object.assign({}, options, { fn: fn }));
+ } else {
+ pres.push(Object.assign({}, options, { fn: fn }));
+ }
+
+ return this;
+};
+
+/**
+ * Register a new hook for "post"
+ * @param {String} name The name of the hook
+ * @param {Object} [options]
+ * @param {Boolean} [options.errorHandler] Whether this is an error handler
+ * @param {Function} fn The function to register for "name"
+ * @param {Boolean} [unshift] Wheter to "push" or to "unshift" the new hook
+ * @returns {Kareem}
+ */
+Kareem.prototype.post = function(name, options, fn, unshift) {
+ const posts = this._posts.get(name) || [];
+
+ if (typeof options === 'function') {
+ unshift = !!fn;
+ fn = options;
+ options = {};
+ }
+
+ if (typeof fn !== 'function') {
+ throw new Error('post() requires a function, got "' + typeof fn + '"');
+ }
+
+ if (unshift) {
+ posts.unshift(Object.assign({}, options, { fn: fn }));
+ } else {
+ posts.push(Object.assign({}, options, { fn: fn }));
+ }
+ this._posts.set(name, posts);
+ return this;
+};
+
+/**
+ * Register a new error handler for "name"
+ * @param {String} name The name of the hook
+ * @param {Object} [options]
+ * @param {Function} fn The function to register for "name"
+ * @param {Boolean} [unshift] Wheter to "push" or to "unshift" the new hook
+ * @returns {Kareem}
+ */
+
+Kareem.prototype.postError = function postError(name, options, fn, unshift) {
+ if (typeof options === 'function') {
+ unshift = !!fn;
+ fn = options;
+ options = {};
+ }
+ return this.post(name, { ...options, errorHandler: true }, fn, unshift);
+};
+
+/**
+ * Clone the current instance
+ * @returns {Kareem} The cloned instance
+ */
+Kareem.prototype.clone = function() {
+ const n = new Kareem();
+
+ for (const key of this._pres.keys()) {
+ const clone = this._pres.get(key).slice();
+ n._pres.set(key, clone);
+ }
+ for (const key of this._posts.keys()) {
+ n._posts.set(key, this._posts.get(key).slice());
+ }
+
+ return n;
+};
+
+/**
+ * Merge "other" into self or "clone"
+ * @param {Kareem} other The instance to merge with
+ * @param {Kareem} [clone] The instance to merge onto (if not defined, using "this")
+ * @returns {Kareem} The merged instance
+ */
+Kareem.prototype.merge = function(other, clone) {
+ clone = arguments.length === 1 ? true : clone;
+ const ret = clone ? this.clone() : this;
+
+ for (const key of other._pres.keys()) {
+ const sourcePres = ret._pres.get(key) || [];
+ const deduplicated = other._pres.get(key).
+ // Deduplicate based on `fn`
+ filter(p => sourcePres.map(_p => _p.fn).indexOf(p.fn) === -1);
+ const combined = sourcePres.concat(deduplicated);
+ ret._pres.set(key, combined);
+ }
+ for (const key of other._posts.keys()) {
+ const sourcePosts = ret._posts.get(key) || [];
+ const deduplicated = other._posts.get(key).
+ filter(p => sourcePosts.indexOf(p) === -1);
+ ret._posts.set(key, sourcePosts.concat(deduplicated));
+ }
+
+ return ret;
+};
+
+function isPromiseLike(v) {
+ return (typeof v === 'object' && v !== null && typeof v.then === 'function');
+}
+
+function isErrorHandlingMiddleware(post, numArgs) {
+ if (post.errorHandler) {
+ return true;
+ }
+ return post.fn.length === numArgs + 2;
+}
+
+module.exports = Kareem;
diff --git a/node_modules/kareem/package.json b/node_modules/kareem/package.json
new file mode 100644
index 00000000..340b6638
--- /dev/null
+++ b/node_modules/kareem/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "kareem",
+ "version": "3.3.0",
+ "description": "Next-generation take on pre/post function hooks",
+ "main": "index.js",
+ "scripts": {
+ "lint": "eslint .",
+ "test": "mocha ./test/*",
+ "test-coverage": "nyc --reporter lcov mocha ./test/*",
+ "docs": "node ./docs.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mongoosejs/kareem.git"
+ },
+ "devDependencies": {
+ "acquit": "1.x",
+ "acquit-ignore": "0.2.x",
+ "eslint": "8.20.0",
+ "mocha": "11.x",
+ "nyc": "15.1.0"
+ },
+ "author": "Valeri Karpov ",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.0.0"
+ }
+}
diff --git a/node_modules/memory-pager/.travis.yml b/node_modules/memory-pager/.travis.yml
new file mode 100644
index 00000000..1c4ab31e
--- /dev/null
+++ b/node_modules/memory-pager/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - '4'
+ - '6'
diff --git a/node_modules/memory-pager/LICENSE b/node_modules/memory-pager/LICENSE
new file mode 100644
index 00000000..56fce089
--- /dev/null
+++ b/node_modules/memory-pager/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2017 Mathias Buus
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/memory-pager/README.md b/node_modules/memory-pager/README.md
new file mode 100644
index 00000000..aed17614
--- /dev/null
+++ b/node_modules/memory-pager/README.md
@@ -0,0 +1,65 @@
+# memory-pager
+
+Access memory using small fixed sized buffers instead of allocating a huge buffer.
+Useful if you are implementing sparse data structures (such as large bitfield).
+
+
+
+```
+npm install memory-pager
+```
+
+## Usage
+
+``` js
+var pager = require('paged-memory')
+
+var pages = pager(1024) // use 1kb per page
+
+var page = pages.get(10) // get page #10
+
+console.log(page.offset) // 10240
+console.log(page.buffer) // a blank 1kb buffer
+```
+
+## API
+
+#### `var pages = pager(pageSize)`
+
+Create a new pager. `pageSize` defaults to `1024`.
+
+#### `var page = pages.get(pageNumber, [noAllocate])`
+
+Get a page. The page will be allocated at first access.
+
+Optionally you can set the `noAllocate` flag which will make the
+method return undefined if no page has been allocated already
+
+A page looks like this
+
+``` js
+{
+ offset: byteOffset,
+ buffer: bufferWithPageSize
+}
+```
+
+#### `pages.set(pageNumber, buffer)`
+
+Explicitly set the buffer for a page.
+
+#### `pages.updated(page)`
+
+Mark a page as updated.
+
+#### `pages.lastUpdate()`
+
+Get the last page that was updated.
+
+#### `var buf = pages.toBuffer()`
+
+Concat all pages allocated pages into a single buffer
+
+## License
+
+MIT
diff --git a/node_modules/memory-pager/index.js b/node_modules/memory-pager/index.js
new file mode 100644
index 00000000..687f346f
--- /dev/null
+++ b/node_modules/memory-pager/index.js
@@ -0,0 +1,160 @@
+module.exports = Pager
+
+function Pager (pageSize, opts) {
+ if (!(this instanceof Pager)) return new Pager(pageSize, opts)
+
+ this.length = 0
+ this.updates = []
+ this.path = new Uint16Array(4)
+ this.pages = new Array(32768)
+ this.maxPages = this.pages.length
+ this.level = 0
+ this.pageSize = pageSize || 1024
+ this.deduplicate = opts ? opts.deduplicate : null
+ this.zeros = this.deduplicate ? alloc(this.deduplicate.length) : null
+}
+
+Pager.prototype.updated = function (page) {
+ while (this.deduplicate && page.buffer[page.deduplicate] === this.deduplicate[page.deduplicate]) {
+ page.deduplicate++
+ if (page.deduplicate === this.deduplicate.length) {
+ page.deduplicate = 0
+ if (page.buffer.equals && page.buffer.equals(this.deduplicate)) page.buffer = this.deduplicate
+ break
+ }
+ }
+ if (page.updated || !this.updates) return
+ page.updated = true
+ this.updates.push(page)
+}
+
+Pager.prototype.lastUpdate = function () {
+ if (!this.updates || !this.updates.length) return null
+ var page = this.updates.pop()
+ page.updated = false
+ return page
+}
+
+Pager.prototype._array = function (i, noAllocate) {
+ if (i >= this.maxPages) {
+ if (noAllocate) return
+ grow(this, i)
+ }
+
+ factor(i, this.path)
+
+ var arr = this.pages
+
+ for (var j = this.level; j > 0; j--) {
+ var p = this.path[j]
+ var next = arr[p]
+
+ if (!next) {
+ if (noAllocate) return
+ next = arr[p] = new Array(32768)
+ }
+
+ arr = next
+ }
+
+ return arr
+}
+
+Pager.prototype.get = function (i, noAllocate) {
+ var arr = this._array(i, noAllocate)
+ var first = this.path[0]
+ var page = arr && arr[first]
+
+ if (!page && !noAllocate) {
+ page = arr[first] = new Page(i, alloc(this.pageSize))
+ if (i >= this.length) this.length = i + 1
+ }
+
+ if (page && page.buffer === this.deduplicate && this.deduplicate && !noAllocate) {
+ page.buffer = copy(page.buffer)
+ page.deduplicate = 0
+ }
+
+ return page
+}
+
+Pager.prototype.set = function (i, buf) {
+ var arr = this._array(i, false)
+ var first = this.path[0]
+
+ if (i >= this.length) this.length = i + 1
+
+ if (!buf || (this.zeros && buf.equals && buf.equals(this.zeros))) {
+ arr[first] = undefined
+ return
+ }
+
+ if (this.deduplicate && buf.equals && buf.equals(this.deduplicate)) {
+ buf = this.deduplicate
+ }
+
+ var page = arr[first]
+ var b = truncate(buf, this.pageSize)
+
+ if (page) page.buffer = b
+ else arr[first] = new Page(i, b)
+}
+
+Pager.prototype.toBuffer = function () {
+ var list = new Array(this.length)
+ var empty = alloc(this.pageSize)
+ var ptr = 0
+
+ while (ptr < list.length) {
+ var arr = this._array(ptr, true)
+ for (var i = 0; i < 32768 && ptr < list.length; i++) {
+ list[ptr++] = (arr && arr[i]) ? arr[i].buffer : empty
+ }
+ }
+
+ return Buffer.concat(list)
+}
+
+function grow (pager, index) {
+ while (pager.maxPages < index) {
+ var old = pager.pages
+ pager.pages = new Array(32768)
+ pager.pages[0] = old
+ pager.level++
+ pager.maxPages *= 32768
+ }
+}
+
+function truncate (buf, len) {
+ if (buf.length === len) return buf
+ if (buf.length > len) return buf.slice(0, len)
+ var cpy = alloc(len)
+ buf.copy(cpy)
+ return cpy
+}
+
+function alloc (size) {
+ if (Buffer.alloc) return Buffer.alloc(size)
+ var buf = new Buffer(size)
+ buf.fill(0)
+ return buf
+}
+
+function copy (buf) {
+ var cpy = Buffer.allocUnsafe ? Buffer.allocUnsafe(buf.length) : new Buffer(buf.length)
+ buf.copy(cpy)
+ return cpy
+}
+
+function Page (i, buf) {
+ this.offset = i * buf.length
+ this.buffer = buf
+ this.updated = false
+ this.deduplicate = 0
+}
+
+function factor (n, out) {
+ n = (n - (out[0] = (n & 32767))) / 32768
+ n = (n - (out[1] = (n & 32767))) / 32768
+ out[3] = ((n - (out[2] = (n & 32767))) / 32768) & 32767
+}
diff --git a/node_modules/memory-pager/package.json b/node_modules/memory-pager/package.json
new file mode 100644
index 00000000..f4847e8c
--- /dev/null
+++ b/node_modules/memory-pager/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "memory-pager",
+ "version": "1.5.0",
+ "description": "Access memory using small fixed sized buffers",
+ "main": "index.js",
+ "dependencies": {},
+ "devDependencies": {
+ "standard": "^9.0.0",
+ "tape": "^4.6.3"
+ },
+ "scripts": {
+ "test": "standard && tape test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mafintosh/memory-pager.git"
+ },
+ "author": "Mathias Buus (@mafintosh)",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/mafintosh/memory-pager/issues"
+ },
+ "homepage": "https://github.com/mafintosh/memory-pager"
+}
diff --git a/node_modules/memory-pager/test.js b/node_modules/memory-pager/test.js
new file mode 100644
index 00000000..16382100
--- /dev/null
+++ b/node_modules/memory-pager/test.js
@@ -0,0 +1,80 @@
+var tape = require('tape')
+var pager = require('./')
+
+tape('get page', function (t) {
+ var pages = pager(1024)
+
+ var page = pages.get(0)
+
+ t.same(page.offset, 0)
+ t.same(page.buffer, Buffer.alloc(1024))
+ t.end()
+})
+
+tape('get page twice', function (t) {
+ var pages = pager(1024)
+ t.same(pages.length, 0)
+
+ var page = pages.get(0)
+
+ t.same(page.offset, 0)
+ t.same(page.buffer, Buffer.alloc(1024))
+ t.same(pages.length, 1)
+
+ var other = pages.get(0)
+
+ t.same(other, page)
+ t.end()
+})
+
+tape('get no mutable page', function (t) {
+ var pages = pager(1024)
+
+ t.ok(!pages.get(141, true))
+ t.ok(pages.get(141))
+ t.ok(pages.get(141, true))
+
+ t.end()
+})
+
+tape('get far out page', function (t) {
+ var pages = pager(1024)
+
+ var page = pages.get(1000000)
+
+ t.same(page.offset, 1000000 * 1024)
+ t.same(page.buffer, Buffer.alloc(1024))
+ t.same(pages.length, 1000000 + 1)
+
+ var other = pages.get(1)
+
+ t.same(other.offset, 1024)
+ t.same(other.buffer, Buffer.alloc(1024))
+ t.same(pages.length, 1000000 + 1)
+ t.ok(other !== page)
+
+ t.end()
+})
+
+tape('updates', function (t) {
+ var pages = pager(1024)
+
+ t.same(pages.lastUpdate(), null)
+
+ var page = pages.get(10)
+
+ page.buffer[42] = 1
+ pages.updated(page)
+
+ t.same(pages.lastUpdate(), page)
+ t.same(pages.lastUpdate(), null)
+
+ page.buffer[42] = 2
+ pages.updated(page)
+ pages.updated(page)
+
+ t.same(pages.lastUpdate(), page)
+ t.same(pages.lastUpdate(), null)
+
+ t.end()
+})
diff --git a/node_modules/mongodb-connection-string-url/.esm-wrapper.mjs b/node_modules/mongodb-connection-string-url/.esm-wrapper.mjs
new file mode 100644
index 00000000..a0f5be52
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/.esm-wrapper.mjs
@@ -0,0 +1,6 @@
+import mod from "./lib/index.js";
+
+export default mod["default"];
+export const CommaAndColonSeparatedRecord = mod.CommaAndColonSeparatedRecord;
+export const ConnectionString = mod.ConnectionString;
+export const redactConnectionString = mod.redactConnectionString;
diff --git a/node_modules/mongodb-connection-string-url/LICENSE b/node_modules/mongodb-connection-string-url/LICENSE
new file mode 100644
index 00000000..d57f55f4
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/LICENSE
@@ -0,0 +1,192 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ Copyright 2020 MongoDB Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/node_modules/mongodb-connection-string-url/README.md b/node_modules/mongodb-connection-string-url/README.md
new file mode 100644
index 00000000..0eb65d00
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/README.md
@@ -0,0 +1,25 @@
+# mongodb-connection-string-url
+
+MongoDB connection strings, based on the WhatWG URL API
+
+```js
+import ConnectionString from 'mongodb-connection-string-url';
+
+const cs = new ConnectionString('mongodb://localhost');
+cs.searchParams.set('readPreference', 'secondary');
+console.log(cs.href); // 'mongodb://localhost/?readPreference=secondary'
+```
+
+## Deviations from the WhatWG URL package
+
+- URL parameters are case-insensitive
+- The `.host`, `.hostname` and `.port` properties cannot be set, and reading
+ them does not return meaningful results (and are typed as `never`in TypeScript)
+- The `.hosts` property contains a list of all hosts in the connection string
+- The `.href` property cannot be set, only read
+- There is an additional `.isSRV` property, set to `true` for `mongodb+srv://`
+- There is an additional `.clone()` utility method on the prototype
+
+## LICENSE
+
+Apache-2.0
diff --git a/node_modules/mongodb-connection-string-url/lib/index.d.ts b/node_modules/mongodb-connection-string-url/lib/index.d.ts
new file mode 100644
index 00000000..54b35785
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/lib/index.d.ts
@@ -0,0 +1,63 @@
+import { URL } from 'whatwg-url';
+import { redactConnectionString, ConnectionStringRedactionOptions } from './redact';
+export { redactConnectionString, ConnectionStringRedactionOptions };
+declare class CaseInsensitiveMap extends Map {
+ delete(name: K): boolean;
+ get(name: K): string | undefined;
+ has(name: K): boolean;
+ set(name: K, value: any): this;
+ _normalizeKey(name: any): K;
+}
+declare abstract class URLWithoutHost extends URL {
+ abstract get host(): never;
+ abstract set host(value: never);
+ abstract get hostname(): never;
+ abstract set hostname(value: never);
+ abstract get port(): never;
+ abstract set port(value: never);
+ abstract get href(): string;
+ abstract set href(value: string);
+}
+export interface ConnectionStringParsingOptions {
+ looseValidation?: boolean;
+}
+export declare class ConnectionString extends URLWithoutHost {
+ _hosts: string[];
+ constructor(uri: string, options?: ConnectionStringParsingOptions);
+ get host(): never;
+ set host(_ignored: never);
+ get hostname(): never;
+ set hostname(_ignored: never);
+ get port(): never;
+ set port(_ignored: never);
+ get href(): string;
+ set href(_ignored: string);
+ get isSRV(): boolean;
+ get hosts(): string[];
+ set hosts(list: string[]);
+ toString(): string;
+ clone(): ConnectionString;
+ redact(options?: ConnectionStringRedactionOptions): ConnectionString;
+ typedSearchParams>(): {
+ append(name: keyof T & string, value: any): void;
+ delete(name: keyof T & string): void;
+ get(name: keyof T & string): string | null;
+ getAll(name: keyof T & string): string[];
+ has(name: keyof T & string): boolean;
+ set(name: keyof T & string, value: any): void;
+ keys(): IterableIterator;
+ values(): IterableIterator;
+ entries(): IterableIterator<[keyof T & string, string]>;
+ _normalizeKey(name: keyof T & string): string;
+ [Symbol.iterator](): IterableIterator<[keyof T & string, string]>;
+ get size(): number;
+ sort(): void;
+ forEach(callback: (this: THIS_ARG, value: string, name: string, searchParams: any) => void, thisArg?: THIS_ARG | undefined): void;
+ readonly [Symbol.toStringTag]: "URLSearchParams";
+ };
+}
+export declare class CommaAndColonSeparatedRecord = Record> extends CaseInsensitiveMap {
+ constructor(from?: string | null);
+ toString(): string;
+}
+export default ConnectionString;
diff --git a/node_modules/mongodb-connection-string-url/lib/index.js b/node_modules/mongodb-connection-string-url/lib/index.js
new file mode 100644
index 00000000..c2e82a30
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/lib/index.js
@@ -0,0 +1,239 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CommaAndColonSeparatedRecord = exports.ConnectionString = exports.redactConnectionString = void 0;
+const whatwg_url_1 = require("whatwg-url");
+const redact_1 = require("./redact");
+Object.defineProperty(exports, "redactConnectionString", { enumerable: true, get: function () { return redact_1.redactConnectionString; } });
+const DUMMY_HOSTNAME = '__this_is_a_placeholder__';
+function connectionStringHasValidScheme(connectionString) {
+ return connectionString.startsWith('mongodb://') || connectionString.startsWith('mongodb+srv://');
+}
+const HOSTS_REGEX = /^(?[^/]+):\/\/(?:(?[^:@]*)(?::(?[^@]*))?@)?(?(?!:)[^/?@]*)(?.*)/;
+class CaseInsensitiveMap extends Map {
+ delete(name) {
+ return super.delete(this._normalizeKey(name));
+ }
+ get(name) {
+ return super.get(this._normalizeKey(name));
+ }
+ has(name) {
+ return super.has(this._normalizeKey(name));
+ }
+ set(name, value) {
+ return super.set(this._normalizeKey(name), value);
+ }
+ _normalizeKey(name) {
+ name = `${name}`;
+ for (const key of this.keys()) {
+ if (key.toLowerCase() === name.toLowerCase()) {
+ name = key;
+ break;
+ }
+ }
+ return name;
+ }
+}
+function caseInsenstiveURLSearchParams(Ctor) {
+ return class CaseInsenstiveURLSearchParams extends Ctor {
+ append(name, value) {
+ return super.append(this._normalizeKey(name), value);
+ }
+ delete(name) {
+ return super.delete(this._normalizeKey(name));
+ }
+ get(name) {
+ return super.get(this._normalizeKey(name));
+ }
+ getAll(name) {
+ return super.getAll(this._normalizeKey(name));
+ }
+ has(name) {
+ return super.has(this._normalizeKey(name));
+ }
+ set(name, value) {
+ return super.set(this._normalizeKey(name), value);
+ }
+ keys() {
+ return super.keys();
+ }
+ values() {
+ return super.values();
+ }
+ entries() {
+ return super.entries();
+ }
+ [Symbol.iterator]() {
+ return super[Symbol.iterator]();
+ }
+ _normalizeKey(name) {
+ return CaseInsensitiveMap.prototype._normalizeKey.call(this, name);
+ }
+ };
+}
+class URLWithoutHost extends whatwg_url_1.URL {
+}
+class MongoParseError extends Error {
+ get name() {
+ return 'MongoParseError';
+ }
+}
+class ConnectionString extends URLWithoutHost {
+ _hosts;
+ constructor(uri, options = {}) {
+ const { looseValidation } = options;
+ if (!looseValidation && !connectionStringHasValidScheme(uri)) {
+ throw new MongoParseError('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');
+ }
+ const match = uri.match(HOSTS_REGEX);
+ if (!match) {
+ throw new MongoParseError(`Invalid connection string "${uri}"`);
+ }
+ const { protocol, username, password, hosts, rest } = match.groups ?? {};
+ if (!looseValidation) {
+ if (!protocol || !hosts) {
+ throw new MongoParseError(`Protocol and host list are required in "${uri}"`);
+ }
+ try {
+ decodeURIComponent(username ?? '');
+ decodeURIComponent(password ?? '');
+ }
+ catch (err) {
+ throw new MongoParseError(err.message);
+ }
+ const illegalCharacters = /[:/?#[\]@]/gi;
+ if (username?.match(illegalCharacters)) {
+ throw new MongoParseError(`Username contains unescaped characters ${username}`);
+ }
+ if (!username || !password) {
+ const uriWithoutProtocol = uri.replace(`${protocol}://`, '');
+ if (uriWithoutProtocol.startsWith('@') || uriWithoutProtocol.startsWith(':')) {
+ throw new MongoParseError('URI contained empty userinfo section');
+ }
+ }
+ if (password?.match(illegalCharacters)) {
+ throw new MongoParseError('Password contains unescaped characters');
+ }
+ }
+ let authString = '';
+ if (typeof username === 'string')
+ authString += username;
+ if (typeof password === 'string')
+ authString += `:${password}`;
+ if (authString)
+ authString += '@';
+ try {
+ super(`${protocol.toLowerCase()}://${authString}${DUMMY_HOSTNAME}${rest}`);
+ }
+ catch (err) {
+ if (looseValidation) {
+ new ConnectionString(uri, {
+ ...options,
+ looseValidation: false
+ });
+ }
+ if (typeof err.message === 'string') {
+ err.message = err.message.replace(DUMMY_HOSTNAME, hosts);
+ }
+ throw err;
+ }
+ this._hosts = hosts.split(',');
+ if (!looseValidation) {
+ if (this.isSRV && this.hosts.length !== 1) {
+ throw new MongoParseError('mongodb+srv URI cannot have multiple service names');
+ }
+ if (this.isSRV && this.hosts.some(host => host.includes(':'))) {
+ throw new MongoParseError('mongodb+srv URI cannot have port number');
+ }
+ }
+ if (!this.pathname) {
+ this.pathname = '/';
+ }
+ Object.setPrototypeOf(this.searchParams, caseInsenstiveURLSearchParams(this.searchParams.constructor).prototype);
+ }
+ get host() {
+ return DUMMY_HOSTNAME;
+ }
+ set host(_ignored) {
+ throw new Error('No single host for connection string');
+ }
+ get hostname() {
+ return DUMMY_HOSTNAME;
+ }
+ set hostname(_ignored) {
+ throw new Error('No single host for connection string');
+ }
+ get port() {
+ return '';
+ }
+ set port(_ignored) {
+ throw new Error('No single host for connection string');
+ }
+ get href() {
+ return this.toString();
+ }
+ set href(_ignored) {
+ throw new Error('Cannot set href for connection strings');
+ }
+ get isSRV() {
+ return this.protocol.includes('srv');
+ }
+ get hosts() {
+ return this._hosts;
+ }
+ set hosts(list) {
+ this._hosts = list;
+ }
+ toString() {
+ return super.toString().replace(DUMMY_HOSTNAME, this.hosts.join(','));
+ }
+ clone() {
+ return new ConnectionString(this.toString(), {
+ looseValidation: true
+ });
+ }
+ redact(options) {
+ return (0, redact_1.redactValidConnectionString)(this, options);
+ }
+ typedSearchParams() {
+ const _sametype = false && new (caseInsenstiveURLSearchParams(whatwg_url_1.URLSearchParams))();
+ return this.searchParams;
+ }
+ [Symbol.for('nodejs.util.inspect.custom')]() {
+ const { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash } = this;
+ return {
+ href,
+ origin,
+ protocol,
+ username,
+ password,
+ hosts,
+ pathname,
+ search,
+ searchParams,
+ hash
+ };
+ }
+}
+exports.ConnectionString = ConnectionString;
+class CommaAndColonSeparatedRecord extends CaseInsensitiveMap {
+ constructor(from) {
+ super();
+ for (const entry of (from ?? '').split(',')) {
+ if (!entry)
+ continue;
+ const colonIndex = entry.indexOf(':');
+ if (colonIndex === -1) {
+ this.set(entry, '');
+ }
+ else {
+ this.set(entry.slice(0, colonIndex), entry.slice(colonIndex + 1));
+ }
+ }
+ }
+ toString() {
+ return [...this].map(entry => entry.join(':')).join(',');
+ }
+}
+exports.CommaAndColonSeparatedRecord = CommaAndColonSeparatedRecord;
+exports.default = ConnectionString;
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb-connection-string-url/lib/index.js.map b/node_modules/mongodb-connection-string-url/lib/index.js.map
new file mode 100644
index 00000000..09dceef0
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/lib/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,2CAAkD;AAClD,qCAIkB;AACT,uGAHP,+BAAsB,OAGO;AAE/B,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD,SAAS,8BAA8B,CAAC,gBAAwB;IAC9D,OAAO,gBAAgB,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,gBAAgB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;AACpG,CAAC;AAID,MAAM,WAAW,GACf,4GAA4G,CAAC;AAE/G,MAAM,kBAA8C,SAAQ,GAAc;IACxE,MAAM,CAAC,IAAO;QACZ,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,GAAG,CAAC,IAAO;QACT,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,GAAG,CAAC,IAAO;QACT,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,GAAG,CAAC,IAAO,EAAE,KAAU;QACrB,OAAO,KAAK,CAAC,GAAG,CAA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KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;CACF;AApBD,oEAoBC;AAED,kBAAe,gBAAgB,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb-connection-string-url/lib/redact.d.ts b/node_modules/mongodb-connection-string-url/lib/redact.d.ts
new file mode 100644
index 00000000..94a64def
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/lib/redact.d.ts
@@ -0,0 +1,7 @@
+import ConnectionString from './index';
+export interface ConnectionStringRedactionOptions {
+ redactUsernames?: boolean;
+ replacementString?: string;
+}
+export declare function redactValidConnectionString(inputUrl: Readonly, options?: ConnectionStringRedactionOptions): ConnectionString;
+export declare function redactConnectionString(uri: string, options?: ConnectionStringRedactionOptions): string;
diff --git a/node_modules/mongodb-connection-string-url/lib/redact.js b/node_modules/mongodb-connection-string-url/lib/redact.js
new file mode 100644
index 00000000..67f534d9
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/lib/redact.js
@@ -0,0 +1,97 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || (function () {
+ var ownKeys = function(o) {
+ ownKeys = Object.getOwnPropertyNames || function (o) {
+ var ar = [];
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
+ return ar;
+ };
+ return ownKeys(o);
+ };
+ return function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
+ __setModuleDefault(result, mod);
+ return result;
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.redactValidConnectionString = redactValidConnectionString;
+exports.redactConnectionString = redactConnectionString;
+const index_1 = __importStar(require("./index"));
+function redactValidConnectionString(inputUrl, options) {
+ const url = inputUrl.clone();
+ const replacementString = options?.replacementString ?? '_credentials_';
+ const redactUsernames = options?.redactUsernames ?? true;
+ if ((url.username || url.password) && redactUsernames) {
+ url.username = replacementString;
+ url.password = '';
+ }
+ else if (url.password) {
+ url.password = replacementString;
+ }
+ if (url.searchParams.has('authMechanismProperties')) {
+ const props = new index_1.CommaAndColonSeparatedRecord(url.searchParams.get('authMechanismProperties'));
+ if (props.get('AWS_SESSION_TOKEN')) {
+ props.set('AWS_SESSION_TOKEN', replacementString);
+ url.searchParams.set('authMechanismProperties', props.toString());
+ }
+ }
+ if (url.searchParams.has('tlsCertificateKeyFilePassword')) {
+ url.searchParams.set('tlsCertificateKeyFilePassword', replacementString);
+ }
+ if (url.searchParams.has('proxyUsername') && redactUsernames) {
+ url.searchParams.set('proxyUsername', replacementString);
+ }
+ if (url.searchParams.has('proxyPassword')) {
+ url.searchParams.set('proxyPassword', replacementString);
+ }
+ return url;
+}
+function redactConnectionString(uri, options) {
+ const replacementString = options?.replacementString ?? '';
+ const redactUsernames = options?.redactUsernames ?? true;
+ let parsed;
+ try {
+ parsed = new index_1.default(uri);
+ }
+ catch {
+ }
+ if (parsed) {
+ options = { ...options, replacementString: '___credentials___' };
+ return parsed
+ .redact(options)
+ .toString()
+ .replace(/___credentials___/g, replacementString);
+ }
+ const R = replacementString;
+ const replacements = [
+ uri => uri.replace(redactUsernames ? /(\/\/)(.*)(@)/g : /(\/\/[^@]*:)(.*)(@)/g, `$1${R}$3`),
+ uri => uri.replace(/(AWS_SESSION_TOKEN(:|%3A))([^,&]+)/gi, `$1${R}`),
+ uri => uri.replace(/(tlsCertificateKeyFilePassword=)([^&]+)/gi, `$1${R}`),
+ uri => (redactUsernames ? uri.replace(/(proxyUsername=)([^&]+)/gi, `$1${R}`) : uri),
+ uri => uri.replace(/(proxyPassword=)([^&]+)/gi, `$1${R}`)
+ ];
+ for (const replacer of replacements) {
+ uri = replacer(uri);
+ }
+ return uri;
+}
+//# sourceMappingURL=redact.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb-connection-string-url/lib/redact.js.map b/node_modules/mongodb-connection-string-url/lib/redact.js.map
new file mode 100644
index 00000000..a8cd75e2
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/lib/redact.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,kEA+BC;AAED,wDA0CC;AAlFD,iDAAyE;AAOzE,SAAgB,2BAA2B,CACzC,QAAoC,EACpC,OAA0C;IAE1C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;IAC7B,MAAM,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,eAAe,CAAC;IACxE,MAAM,eAAe,GAAG,OAAO,EAAE,eAAe,IAAI,IAAI,CAAC;IAEzD,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,eAAe,EAAE,CAAC;QACtD,GAAG,CAAC,QAAQ,GAAG,iBAAiB,CAAC;QACjC,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;IACpB,CAAC;SAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,GAAG,iBAAiB,CAAC;IACnC,CAAC;IACD,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAE,CAA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AO,GAAG,EAAE,GAAG,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAC;QACjE,OAAO,MAAM;aACV,MAAM,CAAC,OAAO,CAAC;aACf,QAAQ,EAAE;aACV,OAAO,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;IACtD,CAAC;IAID,MAAM,CAAC,GAAG,iBAAiB,CAAC;IAC5B,MAAM,YAAY,GAAgC;QAEhD,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,sBAAsB,EAAE,KAAK,CAAC,IAAI,CAAC;QAE3F,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,sCAAsC,EAAE,KAAK,CAAC,EAAE,CAAC;QAEpE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,2CAA2C,EAAE,KAAK,CAAC,EAAE,CAAC;QAEzE,GAAG,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAEnF,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC;KAC1D,CAAC;IACF,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;QACpC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb-connection-string-url/package.json b/node_modules/mongodb-connection-string-url/package.json
new file mode 100644
index 00000000..ac0d35f9
--- /dev/null
+++ b/node_modules/mongodb-connection-string-url/package.json
@@ -0,0 +1,71 @@
+{
+ "name": "mongodb-connection-string-url",
+ "version": "7.0.1",
+ "description": "MongoDB connection strings, based on the WhatWG URL API",
+ "keywords": [
+ "password",
+ "prompt",
+ "tty"
+ ],
+ "homepage": "https://github.com/mongodb-js/mongodb-connection-string-url",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mongodb-js/mongodb-connection-string-url.git"
+ },
+ "bugs": {
+ "url": "https://github.com/mongodb-js/mongodb-connection-string-url/issues"
+ },
+ "main": "lib/index.js",
+ "types": "lib/index.d.ts",
+ "exports": {
+ "require": {
+ "default": "./lib/index.js",
+ "types": "./lib/index.d.ts"
+ },
+ "import": {
+ "default": "./.esm-wrapper.mjs",
+ "types": "./lib/index.d.ts"
+ }
+ },
+ "files": [
+ "LICENSE",
+ "lib",
+ "package.json",
+ "README.md",
+ ".esm-wrapper.mjs"
+ ],
+ "scripts": {
+ "lint": "ESLINT_USE_FLAT_CONFIG=false eslint \"{src,test}/**/*.ts\"",
+ "test": "npm run build && nyc mocha --colors -r ts-node/register test/*.ts",
+ "build": "npm run compile-ts && gen-esm-wrapper . ./.esm-wrapper.mjs",
+ "prepack": "npm run build",
+ "compile-ts": "tsc -p tsconfig.json"
+ },
+ "license": "Apache-2.0",
+ "devDependencies": {
+ "@types/chai": "^5.0.1",
+ "@types/mocha": "^10.0.10",
+ "@types/node": "^22.9.0",
+ "@typescript-eslint/eslint-plugin": "^8.39.1",
+ "@typescript-eslint/parser": "^8.39.1",
+ "chai": "^4.2.0",
+ "eslint": "^9.33.0",
+ "eslint-config-prettier": "^10.1.8",
+ "eslint-plugin-import": "^2.22.0",
+ "eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-prettier": "^5.5.4",
+ "eslint-plugin-promise": "^7.1.0",
+ "gen-esm-wrapper": "^1.1.3",
+ "mocha": "^11.0.1",
+ "nyc": "^17.1.0",
+ "ts-node": "^10.9.1",
+ "typescript": "^5.9.2"
+ },
+ "dependencies": {
+ "@types/whatwg-url": "^13.0.0",
+ "whatwg-url": "^14.1.0"
+ },
+ "engines": {
+ "node": ">=20.19.0"
+ }
+}
diff --git a/node_modules/mongodb/LICENSE.md b/node_modules/mongodb/LICENSE.md
new file mode 100644
index 00000000..ad410e11
--- /dev/null
+++ b/node_modules/mongodb/LICENSE.md
@@ -0,0 +1,201 @@
+Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
\ No newline at end of file
diff --git a/node_modules/mongodb/README.md b/node_modules/mongodb/README.md
new file mode 100644
index 00000000..bf10fe6d
--- /dev/null
+++ b/node_modules/mongodb/README.md
@@ -0,0 +1,366 @@
+# MongoDB Node.js Driver
+
+The official [MongoDB](https://www.mongodb.com/) driver for Node.js.
+
+**Upgrading to version 7? Take a look at our [upgrade guide here](https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/CHANGES_7.0.0.md)!**
+
+## Quick Links
+
+| Site | Link |
+| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
+| Documentation | [www.mongodb.com/docs/drivers/node](https://www.mongodb.com/docs/drivers/node) |
+| API Docs | [mongodb.github.io/node-mongodb-native](https://mongodb.github.io/node-mongodb-native) |
+| `npm` package | [www.npmjs.com/package/mongodb](https://www.npmjs.com/package/mongodb) |
+| MongoDB | [www.mongodb.com](https://www.mongodb.com) |
+| MongoDB University | [learn.mongodb.com](https://learn.mongodb.com/catalog?labels=%5B%22Language%22%5D&values=%5B%22Node.js%22%5D) |
+| MongoDB Developer Center | [www.mongodb.com/developer](https://www.mongodb.com/developer/languages/javascript/) |
+| Stack Overflow | [stackoverflow.com](https://stackoverflow.com/search?q=%28%5Btypescript%5D+or+%5Bjavascript%5D+or+%5Bnode.js%5D%29+and+%5Bmongodb%5D) |
+| Source Code | [github.com/mongodb/node-mongodb-native](https://github.com/mongodb/node-mongodb-native) |
+| Upgrade to v7 | [etc/notes/CHANGES_7.0.0.md](https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/CHANGES_7.0.0.md) |
+| Contributing | [CONTRIBUTING.md](https://github.com/mongodb/node-mongodb-native/blob/HEAD/CONTRIBUTING.md) |
+| Changelog | [HISTORY.md](https://github.com/mongodb/node-mongodb-native/blob/HEAD/HISTORY.md) |
+
+### Release Integrity
+
+Releases are created automatically and signed using the [Node team's GPG key](https://pgp.mongodb.com/node-driver.asc). This applies to the git tag as well as all release packages provided as part of a GitHub release. To verify the provided packages, download the key and import it using gpg:
+
+```shell
+gpg --import node-driver.asc
+```
+
+The GitHub release contains a detached signature file for the NPM package (named
+`mongodb-X.Y.Z.tgz.sig`).
+
+The following command returns the link npm package.
+
+```shell
+npm view mongodb@vX.Y.Z dist.tarball
+```
+
+Using the result of the above command, a `curl` command can return the official npm package for the release.
+
+To verify the integrity of the downloaded package, run the following command:
+
+```shell
+gpg --verify mongodb-X.Y.Z.tgz.sig mongodb-X.Y.Z.tgz
+```
+
+> [!Note]
+> No verification is done when using npm to install the package. The contents of the Github tarball and npm's tarball are identical.
+
+The MongoDB Node.js driver follows [semantic versioning](https://semver.org/) for its releases.
+
+### Bugs / Feature Requests
+
+Think you’ve found a bug? Want to see a new feature in `node-mongodb-native`? Please open a
+case in our issue management tool, JIRA:
+
+- Create an account and login [jira.mongodb.org](https://jira.mongodb.org).
+- Navigate to the NODE project [jira.mongodb.org/browse/NODE](https://jira.mongodb.org/browse/NODE).
+- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it.
+
+Bug reports in JIRA for all driver projects (i.e. NODE, PYTHON, CSHARP, JAVA) and the
+Core Server (i.e. SERVER) project are **public**.
+
+### Support / Feedback
+
+For issues with, questions about, or feedback for the Node.js driver, please look into our [support channels](https://www.mongodb.com/docs/manual/support). Please do not email any of the driver developers directly with issues or questions - you're more likely to get an answer on the [MongoDB Community Forums](https://community.mongodb.com/tags/c/drivers-odms-connectors/7/node-js-driver).
+
+### Change Log
+
+Change history can be found in [`HISTORY.md`](https://github.com/mongodb/node-mongodb-native/blob/HEAD/HISTORY.md).
+
+### Compatibility
+
+The driver currently supports 4.2+ servers.
+
+For exhaustive server and runtime version compatibility matrices, please refer to the following links:
+
+- [MongoDB](https://www.mongodb.com/docs/drivers/node/current/compatibility/#mongodb-compatibility)
+- [NodeJS](https://www.mongodb.com/docs/drivers/node/current/compatibility/#language-compatibility)
+
+#### Component Support Matrix
+
+The following table describes add-on component version compatibility for the Node.js driver. Only packages with versions in these supported ranges are stable when used in combination.
+
+| Component | `mongodb@3.x` | `mongodb@4.x` | `mongodb@5.x` | `mongodb@<6.12` | `mongodb@>=6.12` | `mongodb@7.x` |
+| ------------------------------------------------------------------------------------ | ------------------ | ------------------ | ------------------ | --------------- | ------------------ | ------------- |
+| [bson](https://www.npmjs.com/package/bson) | ^1.0.0 | ^4.0.0 | ^5.0.0 | ^6.0.0 | ^6.0.0 | ^7.0.0 |
+| [bson-ext](https://www.npmjs.com/package/bson-ext) | ^1.0.0 \|\| ^2.0.0 | ^4.0.0 | N/A | N/A | N/A | N/A |
+| [kerberos](https://www.npmjs.com/package/kerberos) | ^1.0.0 | ^1.0.0 \|\| ^2.0.0 | ^1.0.0 \|\| ^2.0.0 | ^2.0.1 | ^2.0.1 | ^7.0.0 |
+| [mongodb-client-encryption](https://www.npmjs.com/package/mongodb-client-encryption) | ^1.0.0 | ^1.0.0 \|\| ^2.0.0 | ^2.3.0 | ^6.0.0 | ^6.0.0 | ^7.0.0 |
+| [mongodb-legacy](https://www.npmjs.com/package/mongodb-legacy) | N/A | ^4.0.0 | ^5.0.0 | ^6.0.0 | ^6.0.0 | N/A |
+| [@mongodb-js/zstd](https://www.npmjs.com/package/@mongodb-js/zstd) | N/A | ^1.0.0 | ^1.0.0 | ^1.1.0 | ^1.1.0 \|\| ^2.0.0 | ^7.0.0 |
+
+#### Typescript Version
+
+We recommend using the latest version of typescript, however we currently ensure the driver's public types compile against `typescript@5.6.0`.
+This is the lowest typescript version guaranteed to work with our driver: older versions may or may not work - use at your own risk.
+Since typescript [does not restrict breaking changes to major versions](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes), we consider this support best effort.
+If you run into any unexpected compiler failures against our supported TypeScript versions, please let us know by filing an issue on our [JIRA](https://jira.mongodb.org/browse/NODE).
+
+Additionally, our Typescript types are compatible with the ECMAScript standard for our minimum supported Node version. Currently, our Typescript targets es2023.
+
+#### Running in Custom Runtimes
+
+We are working on removing Node.js as a dependency of the driver, so that in the future it will be possible to use the driver in non-Node environments.
+This work is currently in progress, and if you're curious, this is [our first runtime adapter commit](https://github.com/mongodb/node-mongodb-native/commit/d2ad07f20903d86334da81222a6df9717f76faaa).
+
+Some things to keep in mind if you are using a non-Node runtime:
+
+1. Users of Webpack/Vite may need to prevent `crypto` polyfill injection.
+2. Auth mechanism `SCRAM-SHA-1` has a hard dependency on Node.js.
+3. Auth mechanism `SCRAM-SHA-1` is not supported in FIPS mode.
+
+## Installation
+
+The recommended way to get started using the Node.js driver is by using the `npm` (Node Package Manager) to install the dependency in your project.
+
+After you've created your own project using `npm init`, you can run:
+
+```bash
+npm install mongodb
+```
+
+This will download the MongoDB driver and add a dependency entry in your `package.json` file.
+
+If you are a Typescript user, you will need the Node.js type definitions to use the driver's definitions:
+
+```sh
+npm install -D @types/node
+```
+
+## Driver Extensions
+
+The MongoDB driver can optionally be enhanced by the following feature packages:
+
+Maintained by MongoDB:
+
+- Zstd network compression - [@mongodb-js/zstd](https://github.com/mongodb-js/zstd)
+- MongoDB field level and queryable encryption - [mongodb-client-encryption](https://github.com/mongodb/libmongocrypt#readme)
+- GSSAPI / SSPI / Kerberos authentication - [kerberos](https://github.com/mongodb-js/kerberos)
+
+Some of these packages include native C++ extensions.
+Consult the [trouble shooting guide here](https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/native-extensions.md) if you run into compilation issues.
+
+Third party:
+
+- Snappy network compression - [snappy](https://github.com/Brooooooklyn/snappy)
+- AWS authentication - [@aws-sdk/credential-providers](https://github.com/aws/aws-sdk-js-v3/tree/main/packages/credential-providers)
+
+## Quick Start
+
+This guide will show you how to set up a simple application using Node.js and MongoDB. Its scope is only how to set up the driver and perform the simple CRUD operations. For more in-depth coverage, see the [official documentation](https://www.mongodb.com/docs/drivers/node/).
+
+### Create the `package.json` file
+
+First, create a directory where your application will live.
+
+```bash
+mkdir myProject
+cd myProject
+```
+
+Enter the following command and answer the questions to create the initial structure for your new project:
+
+```bash
+npm init -y
+```
+
+Next, install the driver as a dependency.
+
+```bash
+npm install mongodb
+```
+
+### Start a MongoDB Server
+
+For complete MongoDB installation instructions, see [the manual](https://www.mongodb.com/docs/manual/installation/).
+
+1. Download the right MongoDB version from [MongoDB](https://www.mongodb.org/downloads)
+2. Create a database directory (in this case under **/data**).
+3. Install and start a `mongod` process.
+
+```bash
+mongod --dbpath=/data
+```
+
+You should see the **mongod** process start up and print some status information.
+
+### Connect to MongoDB
+
+Create a new **app.js** file and add the following code to try out some basic CRUD
+operations using the MongoDB driver.
+
+Add code to connect to the server and the database **myProject**:
+
+> **NOTE:** Resolving DNS Connection issues
+>
+> Node.js 18 changed the default DNS resolution ordering from always prioritizing IPv4 to the ordering
+> returned by the DNS provider. In some environments, this can result in `localhost` resolving to
+> an IPv6 address instead of IPv4 and a consequent failure to connect to the server.
+>
+> This can be resolved by:
+>
+> - specifying the IP address family using the MongoClient `family` option (`MongoClient(, { family: 4 } )`)
+> - launching mongod or mongos with the ipv6 flag enabled ([--ipv6 mongod option documentation](https://www.mongodb.com/docs/manual/reference/program/mongod/#std-option-mongod.--ipv6))
+> - using a host of `127.0.0.1` in place of localhost
+> - specifying the DNS resolution ordering with the `--dns-resolution-order` Node.js command line argument (e.g. `node --dns-resolution-order=ipv4first`)
+
+```js
+const { MongoClient } = require('mongodb');
+// or as an es module:
+// import { MongoClient } from 'mongodb'
+
+// Connection URL
+const url = 'mongodb://localhost:27017';
+const client = new MongoClient(url);
+
+// Database Name
+const dbName = 'myProject';
+
+async function main() {
+ // Use connect method to connect to the server
+ await client.connect();
+ console.log('Connected successfully to server');
+ const db = client.db(dbName);
+ const collection = db.collection('documents');
+
+ // the following code examples can be pasted here...
+
+ return 'done.';
+}
+
+main()
+ .then(console.log)
+ .catch(console.error)
+ .finally(() => client.close());
+```
+
+Run your app from the command line with:
+
+```bash
+node app.js
+```
+
+The application should print **Connected successfully to server** to the console.
+
+### Insert a Document
+
+Add to **app.js** the following function which uses the **insertMany**
+method to add three documents to the **documents** collection.
+
+```js
+const insertResult = await collection.insertMany([{ a: 1 }, { a: 2 }, { a: 3 }]);
+console.log('Inserted documents =>', insertResult);
+```
+
+The **insertMany** command returns an object with information about the insert operations.
+
+### Find All Documents
+
+Add a query that returns all the documents.
+
+```js
+const findResult = await collection.find({}).toArray();
+console.log('Found documents =>', findResult);
+```
+
+This query returns all the documents in the **documents** collection.
+If you add this below the insertMany example, you'll see the documents you've inserted.
+
+### Find Documents with a Query Filter
+
+Add a query filter to find only documents which meet the query criteria.
+
+```js
+const filteredDocs = await collection.find({ a: 3 }).toArray();
+console.log('Found documents filtered by { a: 3 } =>', filteredDocs);
+```
+
+Only the documents which match `'a' : 3` should be returned.
+
+### Update a document
+
+The following operation updates a document in the **documents** collection.
+
+```js
+const updateResult = await collection.updateOne({ a: 3 }, { $set: { b: 1 } });
+console.log('Updated documents =>', updateResult);
+```
+
+The method updates the first document where the field **a** is equal to **3** by adding a new field **b** to the document set to **1**. `updateResult` contains information about whether there was a matching document to update or not.
+
+### Remove a document
+
+Remove the document where the field **a** is equal to **3**.
+
+```js
+const deleteResult = await collection.deleteMany({ a: 3 });
+console.log('Deleted documents =>', deleteResult);
+```
+
+### Index a Collection
+
+[Indexes](https://www.mongodb.com/docs/manual/indexes/) can improve your application's
+performance. The following function creates an index on the **a** field in the
+**documents** collection.
+
+```js
+const indexName = await collection.createIndex({ a: 1 });
+console.log('index name =', indexName);
+```
+
+For more detailed information, see the [indexing strategies page](https://www.mongodb.com/docs/manual/applications/indexes/).
+
+## Error Handling
+
+If you need to filter certain errors from our driver, we have a helpful tree of errors described in [etc/notes/errors.md](https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/errors.md).
+
+It is our recommendation to use `instanceof` checks on errors and to avoid relying on parsing `error.message` and `error.name` strings in your code.
+We guarantee `instanceof` checks will pass according to semver guidelines, but errors may be sub-classed or their messages may change at any time, even patch releases, as we see fit to increase the helpfulness of the errors.
+
+Any new errors we add to the driver will directly extend an existing error class and no existing error will be moved to a different parent class outside of a major release.
+This means `instanceof` will always be able to accurately capture the errors that our driver throws.
+
+```typescript
+const client = new MongoClient(url);
+await client.connect();
+const collection = client.db().collection('collection');
+
+try {
+ await collection.insertOne({ _id: 1 });
+ await collection.insertOne({ _id: 1 }); // duplicate key error
+} catch (error) {
+ if (error instanceof MongoServerError) {
+ console.log(`Error worth logging: ${error}`); // special case for some reason
+ }
+ throw error; // still want to crash
+}
+```
+
+## Nightly releases
+
+If you need to test with a change from the latest `main` branch, our `mongodb` npm package has nightly versions released under the `nightly` tag.
+
+```sh
+npm install mongodb@nightly
+```
+
+Nightly versions are published regardless of testing outcome.
+This means there could be semantic breakages or partially implemented features.
+The nightly build is not suitable for production use.
+
+## Next Steps
+
+- [MongoDB Documentation](https://www.mongodb.com/docs/manual/)
+- [MongoDB Node Driver Documentation](https://www.mongodb.com/docs/drivers/node/)
+- [Read about Schemas](https://www.mongodb.com/docs/manual/core/data-modeling-introduction/)
+- [Star us on GitHub](https://github.com/mongodb/node-mongodb-native)
+
+## License
+
+[Apache 2.0](LICENSE.md)
+
+© 2012-present MongoDB [Contributors](https://github.com/mongodb/node-mongodb-native/blob/HEAD/CONTRIBUTORS.md) \
+© 2009-2012 Christian Amor Kvalheim
diff --git a/node_modules/mongodb/etc/prepare.js b/node_modules/mongodb/etc/prepare.js
new file mode 100755
index 00000000..2039d0b3
--- /dev/null
+++ b/node_modules/mongodb/etc/prepare.js
@@ -0,0 +1,12 @@
+#! /usr/bin/env node
+var cp = require('child_process');
+var fs = require('fs');
+var os = require('os');
+
+if (fs.existsSync('src')) {
+ cp.spawn('npm', ['run', 'build:dts'], { stdio: 'inherit', shell: os.platform() === 'win32' });
+} else {
+ if (!fs.existsSync('lib')) {
+ console.warn('MongoDB: No compiled javascript present, the driver is not installed correctly.');
+ }
+}
diff --git a/node_modules/mongodb/lib/admin.js b/node_modules/mongodb/lib/admin.js
new file mode 100644
index 00000000..06279e34
--- /dev/null
+++ b/node_modules/mongodb/lib/admin.js
@@ -0,0 +1,136 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Admin = void 0;
+const bson_1 = require("./bson");
+const execute_operation_1 = require("./operations/execute_operation");
+const list_databases_1 = require("./operations/list_databases");
+const remove_user_1 = require("./operations/remove_user");
+const run_command_1 = require("./operations/run_command");
+const validate_collection_1 = require("./operations/validate_collection");
+const utils_1 = require("./utils");
+/**
+ * The **Admin** class is an internal class that allows convenient access to
+ * the admin functionality and commands for MongoDB.
+ *
+ * **ADMIN Cannot directly be instantiated**
+ * @public
+ *
+ * @example
+ * ```ts
+ * import { MongoClient } from 'mongodb';
+ *
+ * const client = new MongoClient('mongodb://localhost:27017');
+ * const admin = client.db().admin();
+ * const dbInfo = await admin.listDatabases();
+ * for (const db of dbInfo.databases) {
+ * console.log(db.name);
+ * }
+ * ```
+ */
+class Admin {
+ /**
+ * Create a new Admin instance
+ * @internal
+ */
+ constructor(db) {
+ this.s = { db };
+ }
+ /**
+ * Execute a command
+ *
+ * The driver will ensure the following fields are attached to the command sent to the server:
+ * - `lsid` - sourced from an implicit session or options.session
+ * - `$readPreference` - defaults to primary or can be configured by options.readPreference
+ * - `$db` - sourced from the name of this database
+ *
+ * If the client has a serverApi setting:
+ * - `apiVersion`
+ * - `apiStrict`
+ * - `apiDeprecationErrors`
+ *
+ * When in a transaction:
+ * - `readConcern` - sourced from readConcern set on the TransactionOptions
+ * - `writeConcern` - sourced from writeConcern set on the TransactionOptions
+ *
+ * Attaching any of the above fields to the command will have no effect as the driver will overwrite the value.
+ *
+ * @param command - The command to execute
+ * @param options - Optional settings for the command
+ */
+ async command(command, options) {
+ return await (0, execute_operation_1.executeOperation)(this.s.db.client, new run_command_1.RunCommandOperation(new utils_1.MongoDBNamespace('admin'), command, {
+ ...(0, bson_1.resolveBSONOptions)(options),
+ session: options?.session,
+ readPreference: options?.readPreference,
+ timeoutMS: options?.timeoutMS ?? this.s.db.timeoutMS
+ }));
+ }
+ /**
+ * Retrieve the server build information
+ *
+ * @param options - Optional settings for the command
+ */
+ async buildInfo(options) {
+ return await this.command({ buildinfo: 1 }, options);
+ }
+ /**
+ * Retrieve the server build information
+ *
+ * @param options - Optional settings for the command
+ */
+ async serverInfo(options) {
+ return await this.command({ buildinfo: 1 }, options);
+ }
+ /**
+ * Retrieve this db's server status.
+ *
+ * @param options - Optional settings for the command
+ */
+ async serverStatus(options) {
+ return await this.command({ serverStatus: 1 }, options);
+ }
+ /**
+ * Ping the MongoDB server and retrieve results
+ *
+ * @param options - Optional settings for the command
+ */
+ async ping(options) {
+ return await this.command({ ping: 1 }, options);
+ }
+ /**
+ * Remove a user from a database
+ *
+ * @param username - The username to remove
+ * @param options - Optional settings for the command
+ */
+ async removeUser(username, options) {
+ return await (0, execute_operation_1.executeOperation)(this.s.db.client, new remove_user_1.RemoveUserOperation(this.s.db, username, { dbName: 'admin', ...options }));
+ }
+ /**
+ * Validate an existing collection
+ *
+ * @param collectionName - The name of the collection to validate.
+ * @param options - Optional settings for the command
+ */
+ async validateCollection(collectionName, options = {}) {
+ return await (0, execute_operation_1.executeOperation)(this.s.db.client, new validate_collection_1.ValidateCollectionOperation(this, collectionName, options));
+ }
+ /**
+ * List the available databases
+ *
+ * @param options - Optional settings for the command
+ */
+ async listDatabases(options) {
+ return await (0, execute_operation_1.executeOperation)(this.s.db.client, new list_databases_1.ListDatabasesOperation(this.s.db, { timeoutMS: this.s.db.timeoutMS, ...options }));
+ }
+ /**
+ * Get ReplicaSet status
+ *
+ * @param options - Optional settings for the command
+ */
+ async replSetGetStatus(options) {
+ return await this.command({ replSetGetStatus: 1 }, options);
+ }
+}
+exports.Admin = Admin;
+//# sourceMappingURL=admin.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/admin.js.map b/node_modules/mongodb/lib/admin.js.map
new file mode 100644
index 00000000..180084d2
--- /dev/null
+++ b/node_modules/mongodb/lib/admin.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"admin.js","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":";;;AAAA,iCAA2D;AAG3D,sEAAkE;AAClE,gEAIqC;AACrC,0DAAuF;AACvF,0DAAuF;AACvF,0EAG0C;AAC1C,mCAA2C;AAO3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,KAAK;IAIhB;;;OAGG;IACH,YAAY,EAAM;QAChB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,OAAO,CAAC,OAAiB,EAAE,OAA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,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,CAC9E,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kBAAkB,CACtB,cAAsB,EACtB,UAAqC,EAAE;QAEvC,OAAO,MAAM,IAAA,oCAAgB,EAC3B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,EAChB,IAAI,iDAA2B,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,CAC/D,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,OAA8B;QAChD,OAAO,MAAM,IAAA,oCAAgB,EAC3B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,EAChB,IAAI,uCAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,CACtF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAAiC;QACtD,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF;AAnID,sBAmIC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/bson.js b/node_modules/mongodb/lib/bson.js
new file mode 100644
index 00000000..4b270de3
--- /dev/null
+++ b/node_modules/mongodb/lib/bson.js
@@ -0,0 +1,106 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.setUint32LE = exports.readInt32LE = exports.UUID = exports.Timestamp = exports.serialize = exports.ObjectId = exports.NumberUtils = exports.MinKey = exports.MaxKey = exports.Long = exports.Int32 = exports.EJSON = exports.Double = exports.deserialize = exports.Decimal128 = exports.DBRef = exports.Code = exports.calculateObjectSize = exports.ByteUtils = exports.BSONType = exports.BSONSymbol = exports.BSONRegExp = exports.BSONError = exports.BSON = exports.Binary = void 0;
+exports.parseToElementsToArray = parseToElementsToArray;
+exports.pluckBSONSerializeOptions = pluckBSONSerializeOptions;
+exports.resolveBSONOptions = resolveBSONOptions;
+exports.parseUtf8ValidationOption = parseUtf8ValidationOption;
+/* eslint-disable no-restricted-imports */
+const bson_1 = require("bson");
+var bson_2 = require("bson");
+Object.defineProperty(exports, "Binary", { enumerable: true, get: function () { return bson_2.Binary; } });
+Object.defineProperty(exports, "BSON", { enumerable: true, get: function () { return bson_2.BSON; } });
+Object.defineProperty(exports, "BSONError", { enumerable: true, get: function () { return bson_2.BSONError; } });
+Object.defineProperty(exports, "BSONRegExp", { enumerable: true, get: function () { return bson_2.BSONRegExp; } });
+Object.defineProperty(exports, "BSONSymbol", { enumerable: true, get: function () { return bson_2.BSONSymbol; } });
+Object.defineProperty(exports, "BSONType", { enumerable: true, get: function () { return bson_2.BSONType; } });
+Object.defineProperty(exports, "ByteUtils", { enumerable: true, get: function () { return bson_2.ByteUtils; } });
+Object.defineProperty(exports, "calculateObjectSize", { enumerable: true, get: function () { return bson_2.calculateObjectSize; } });
+Object.defineProperty(exports, "Code", { enumerable: true, get: function () { return bson_2.Code; } });
+Object.defineProperty(exports, "DBRef", { enumerable: true, get: function () { return bson_2.DBRef; } });
+Object.defineProperty(exports, "Decimal128", { enumerable: true, get: function () { return bson_2.Decimal128; } });
+Object.defineProperty(exports, "deserialize", { enumerable: true, get: function () { return bson_2.deserialize; } });
+Object.defineProperty(exports, "Double", { enumerable: true, get: function () { return bson_2.Double; } });
+Object.defineProperty(exports, "EJSON", { enumerable: true, get: function () { return bson_2.EJSON; } });
+Object.defineProperty(exports, "Int32", { enumerable: true, get: function () { return bson_2.Int32; } });
+Object.defineProperty(exports, "Long", { enumerable: true, get: function () { return bson_2.Long; } });
+Object.defineProperty(exports, "MaxKey", { enumerable: true, get: function () { return bson_2.MaxKey; } });
+Object.defineProperty(exports, "MinKey", { enumerable: true, get: function () { return bson_2.MinKey; } });
+Object.defineProperty(exports, "NumberUtils", { enumerable: true, get: function () { return bson_2.NumberUtils; } });
+Object.defineProperty(exports, "ObjectId", { enumerable: true, get: function () { return bson_2.ObjectId; } });
+Object.defineProperty(exports, "serialize", { enumerable: true, get: function () { return bson_2.serialize; } });
+Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return bson_2.Timestamp; } });
+Object.defineProperty(exports, "UUID", { enumerable: true, get: function () { return bson_2.UUID; } });
+function parseToElementsToArray(bytes, offset) {
+ const res = bson_1.BSON.onDemand.parseToElements(bytes, offset);
+ return Array.isArray(res) ? res : [...res];
+}
+// validates buffer inputs, used for read operations
+const validateBufferInputs = (buffer, offset, length) => {
+ if (offset < 0 || offset + length > buffer.length) {
+ throw new RangeError(`Attempt to access memory outside buffer bounds: buffer length: ${buffer.length}, offset: ${offset}, length: ${length}`);
+ }
+};
+// readInt32LE, reads a 32-bit integer from buffer at given offset
+// throws if offset is out of bounds
+const readInt32LE = (buffer, offset) => {
+ validateBufferInputs(buffer, offset, 4);
+ return bson_1.NumberUtils.getInt32LE(buffer, offset);
+};
+exports.readInt32LE = readInt32LE;
+const setUint32LE = (destination, offset, value) => {
+ destination[offset] = value;
+ value >>>= 8;
+ destination[offset + 1] = value;
+ value >>>= 8;
+ destination[offset + 2] = value;
+ value >>>= 8;
+ destination[offset + 3] = value;
+ return 4;
+};
+exports.setUint32LE = setUint32LE;
+function pluckBSONSerializeOptions(options) {
+ const { fieldsAsRaw, useBigInt64, promoteValues, promoteBuffers, promoteLongs, serializeFunctions, ignoreUndefined, bsonRegExp, raw, enableUtf8Validation } = options;
+ return {
+ fieldsAsRaw,
+ useBigInt64,
+ promoteValues,
+ promoteBuffers,
+ promoteLongs,
+ serializeFunctions,
+ ignoreUndefined,
+ bsonRegExp,
+ raw,
+ enableUtf8Validation
+ };
+}
+/**
+ * Merge the given BSONSerializeOptions, preferring options over the parent's options, and
+ * substituting defaults for values not set.
+ *
+ * @internal
+ */
+function resolveBSONOptions(options, parent) {
+ const parentOptions = parent?.bsonOptions;
+ return {
+ raw: options?.raw ?? parentOptions?.raw ?? false,
+ useBigInt64: options?.useBigInt64 ?? parentOptions?.useBigInt64 ?? false,
+ promoteLongs: options?.promoteLongs ?? parentOptions?.promoteLongs ?? true,
+ promoteValues: options?.promoteValues ?? parentOptions?.promoteValues ?? true,
+ promoteBuffers: options?.promoteBuffers ?? parentOptions?.promoteBuffers ?? false,
+ ignoreUndefined: options?.ignoreUndefined ?? parentOptions?.ignoreUndefined ?? false,
+ bsonRegExp: options?.bsonRegExp ?? parentOptions?.bsonRegExp ?? false,
+ serializeFunctions: options?.serializeFunctions ?? parentOptions?.serializeFunctions ?? false,
+ fieldsAsRaw: options?.fieldsAsRaw ?? parentOptions?.fieldsAsRaw ?? {},
+ enableUtf8Validation: options?.enableUtf8Validation ?? parentOptions?.enableUtf8Validation ?? true
+ };
+}
+/** @internal */
+function parseUtf8ValidationOption(options) {
+ const enableUtf8Validation = options?.enableUtf8Validation;
+ if (enableUtf8Validation === false) {
+ return { utf8: false };
+ }
+ return { utf8: { writeErrors: false } };
+}
+//# sourceMappingURL=bson.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/bson.js.map b/node_modules/mongodb/lib/bson.js.map
new file mode 100644
index 00000000..ce9aaff1
--- /dev/null
+++ b/node_modules/mongodb/lib/bson.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"bson.js","sourceRoot":"","sources":["../src/bson.ts"],"names":[],"mappings":";;;AAoCA,wDAGC;AAsED,8DAyBC;AAQD,gDAkBC;AAGD,8DAQC;AA3KD,0CAA0C;AAC1C,+BAAyF;AAEzF,6BA4Bc;AA3BZ,8FAAA,MAAM,OAAA;AACN,4FAAA,IAAI,OAAA;AACJ,iGAAA,SAAS,OAAA;AACT,kGAAA,UAAU,OAAA;AACV,kGAAA,UAAU,OAAA;AACV,gGAAA,QAAQ,OAAA;AACR,iGAAA,SAAS,OAAA;AAC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OAAO,EAAE,cAAc,IAAI,aAAa,EAAE,cAAc,IAAI,KAAK;QACjF,eAAe,EAAE,OAAO,EAAE,eAAe,IAAI,aAAa,EAAE,eAAe,IAAI,KAAK;QACpF,UAAU,EAAE,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,UAAU,IAAI,KAAK;QACrE,kBAAkB,EAAE,OAAO,EAAE,kBAAkB,IAAI,aAAa,EAAE,kBAAkB,IAAI,KAAK;QAC7F,WAAW,EAAE,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,WAAW,IAAI,EAAE;QACrE,oBAAoB,EAClB,OAAO,EAAE,oBAAoB,IAAI,aAAa,EAAE,oBAAoB,IAAI,IAAI;KAC/E,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,SAAgB,yBAAyB,CAAC,OAA4C;IAGpF,MAAM,oBAAoB,GAAG,OAAO,EAAE,oBAAoB,CAAC;IAC3D,IAAI,oBAAoB,KAAK,KAAK,EAAE,CAAC;QACnC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC;AAC1C,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/bulk/common.js b/node_modules/mongodb/lib/bulk/common.js
new file mode 100644
index 00000000..c838cb42
--- /dev/null
+++ b/node_modules/mongodb/lib/bulk/common.js
@@ -0,0 +1,835 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.BulkOperationBase = exports.FindOperators = exports.MongoBulkWriteError = exports.WriteError = exports.WriteConcernError = exports.BulkWriteResult = exports.Batch = exports.BatchType = void 0;
+exports.mergeBatchResults = mergeBatchResults;
+const bson_1 = require("../bson");
+const error_1 = require("../error");
+const delete_1 = require("../operations/delete");
+const execute_operation_1 = require("../operations/execute_operation");
+const insert_1 = require("../operations/insert");
+const update_1 = require("../operations/update");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const write_concern_1 = require("../write_concern");
+/** @public */
+exports.BatchType = Object.freeze({
+ INSERT: 1,
+ UPDATE: 2,
+ DELETE: 3
+});
+/**
+ * Keeps the state of a unordered batch so we can rewrite the results
+ * correctly after command execution
+ *
+ * @public
+ */
+class Batch {
+ constructor(batchType, originalZeroIndex) {
+ this.originalZeroIndex = originalZeroIndex;
+ this.currentIndex = 0;
+ this.originalIndexes = [];
+ this.batchType = batchType;
+ this.operations = [];
+ this.size = 0;
+ this.sizeBytes = 0;
+ }
+}
+exports.Batch = Batch;
+/**
+ * @public
+ * The result of a bulk write.
+ */
+class BulkWriteResult {
+ static generateIdMap(ids) {
+ const idMap = {};
+ for (const doc of ids) {
+ idMap[doc.index] = doc._id;
+ }
+ return idMap;
+ }
+ /**
+ * Create a new BulkWriteResult instance
+ * @internal
+ */
+ constructor(bulkResult, isOrdered) {
+ this.result = bulkResult;
+ this.insertedCount = this.result.nInserted ?? 0;
+ this.matchedCount = this.result.nMatched ?? 0;
+ this.modifiedCount = this.result.nModified ?? 0;
+ this.deletedCount = this.result.nRemoved ?? 0;
+ this.upsertedCount = this.result.upserted.length ?? 0;
+ this.upsertedIds = BulkWriteResult.generateIdMap(this.result.upserted);
+ this.insertedIds = BulkWriteResult.generateIdMap(this.getSuccessfullyInsertedIds(bulkResult, isOrdered));
+ Object.defineProperty(this, 'result', { value: this.result, enumerable: false });
+ }
+ /** Evaluates to true if the bulk operation correctly executes */
+ get ok() {
+ return this.result.ok;
+ }
+ /**
+ * Returns document_ids that were actually inserted
+ * @internal
+ */
+ getSuccessfullyInsertedIds(bulkResult, isOrdered) {
+ if (bulkResult.writeErrors.length === 0)
+ return bulkResult.insertedIds;
+ if (isOrdered) {
+ return bulkResult.insertedIds.slice(0, bulkResult.writeErrors[0].index);
+ }
+ return bulkResult.insertedIds.filter(({ index }) => !bulkResult.writeErrors.some(writeError => index === writeError.index));
+ }
+ /** Returns the upserted id at the given index */
+ getUpsertedIdAt(index) {
+ return this.result.upserted[index];
+ }
+ /** Returns raw internal result */
+ getRawResponse() {
+ return this.result;
+ }
+ /** Returns true if the bulk operation contains a write error */
+ hasWriteErrors() {
+ return this.result.writeErrors.length > 0;
+ }
+ /** Returns the number of write errors from the bulk operation */
+ getWriteErrorCount() {
+ return this.result.writeErrors.length;
+ }
+ /** Returns a specific write error object */
+ getWriteErrorAt(index) {
+ return index < this.result.writeErrors.length ? this.result.writeErrors[index] : undefined;
+ }
+ /** Retrieve all write errors */
+ getWriteErrors() {
+ return this.result.writeErrors;
+ }
+ /** Retrieve the write concern error if one exists */
+ getWriteConcernError() {
+ if (this.result.writeConcernErrors.length === 0) {
+ return;
+ }
+ else if (this.result.writeConcernErrors.length === 1) {
+ // Return the error
+ return this.result.writeConcernErrors[0];
+ }
+ else {
+ // Combine the errors
+ let errmsg = '';
+ for (let i = 0; i < this.result.writeConcernErrors.length; i++) {
+ const err = this.result.writeConcernErrors[i];
+ errmsg = errmsg + err.errmsg;
+ // TODO: Something better
+ if (i === 0)
+ errmsg = errmsg + ' and ';
+ }
+ return new WriteConcernError({ errmsg, code: error_1.MONGODB_ERROR_CODES.WriteConcernTimeout });
+ }
+ }
+ toString() {
+ return `BulkWriteResult(${bson_1.EJSON.stringify(this.result)})`;
+ }
+ isOk() {
+ return this.result.ok === 1;
+ }
+}
+exports.BulkWriteResult = BulkWriteResult;
+/**
+ * An error representing a failure by the server to apply the requested write concern to the bulk operation.
+ * @public
+ * @category Error
+ */
+class WriteConcernError {
+ constructor(error) {
+ this.serverError = error;
+ }
+ /** Write concern error code. */
+ get code() {
+ return this.serverError.code;
+ }
+ /** Write concern error message. */
+ get errmsg() {
+ return this.serverError.errmsg;
+ }
+ /** Write concern error info. */
+ get errInfo() {
+ return this.serverError.errInfo;
+ }
+ toJSON() {
+ return this.serverError;
+ }
+ toString() {
+ return `WriteConcernError(${this.errmsg})`;
+ }
+}
+exports.WriteConcernError = WriteConcernError;
+/**
+ * An error that occurred during a BulkWrite on the server.
+ * @public
+ * @category Error
+ */
+class WriteError {
+ constructor(err) {
+ this.err = err;
+ }
+ /** WriteError code. */
+ get code() {
+ return this.err.code;
+ }
+ /** WriteError original bulk operation index. */
+ get index() {
+ return this.err.index;
+ }
+ /** WriteError message. */
+ get errmsg() {
+ return this.err.errmsg;
+ }
+ /** WriteError details. */
+ get errInfo() {
+ return this.err.errInfo;
+ }
+ /** Returns the underlying operation that caused the error */
+ getOperation() {
+ return this.err.op;
+ }
+ toJSON() {
+ return { code: this.err.code, index: this.err.index, errmsg: this.err.errmsg, op: this.err.op };
+ }
+ toString() {
+ return `WriteError(${JSON.stringify(this.toJSON())})`;
+ }
+}
+exports.WriteError = WriteError;
+/** Merges results into shared data structure */
+function mergeBatchResults(batch, bulkResult, err, result) {
+ // If we have an error set the result to be the err object
+ if (err) {
+ result = err;
+ }
+ else if (result && result.result) {
+ result = result.result;
+ }
+ if (result == null) {
+ return;
+ }
+ // Do we have a top level error stop processing and return
+ if (result.ok === 0 && bulkResult.ok === 1) {
+ bulkResult.ok = 0;
+ const writeError = {
+ index: 0,
+ code: result.code || 0,
+ errmsg: result.message,
+ errInfo: result.errInfo,
+ op: batch.operations[0]
+ };
+ bulkResult.writeErrors.push(new WriteError(writeError));
+ return;
+ }
+ else if (result.ok === 0 && bulkResult.ok === 0) {
+ return;
+ }
+ // If we have an insert Batch type
+ if (isInsertBatch(batch) && result.n) {
+ bulkResult.nInserted = bulkResult.nInserted + result.n;
+ }
+ // If we have an insert Batch type
+ if (isDeleteBatch(batch) && result.n) {
+ bulkResult.nRemoved = bulkResult.nRemoved + result.n;
+ }
+ let nUpserted = 0;
+ // We have an array of upserted values, we need to rewrite the indexes
+ if (Array.isArray(result.upserted)) {
+ nUpserted = result.upserted.length;
+ for (let i = 0; i < result.upserted.length; i++) {
+ bulkResult.upserted.push({
+ index: result.upserted[i].index + batch.originalZeroIndex,
+ _id: result.upserted[i]._id
+ });
+ }
+ }
+ else if (result.upserted) {
+ nUpserted = 1;
+ bulkResult.upserted.push({
+ index: batch.originalZeroIndex,
+ _id: result.upserted
+ });
+ }
+ // If we have an update Batch type
+ if (isUpdateBatch(batch) && result.n) {
+ const nModified = result.nModified;
+ bulkResult.nUpserted = bulkResult.nUpserted + nUpserted;
+ bulkResult.nMatched = bulkResult.nMatched + (result.n - nUpserted);
+ if (typeof nModified === 'number') {
+ bulkResult.nModified = bulkResult.nModified + nModified;
+ }
+ else {
+ bulkResult.nModified = 0;
+ }
+ }
+ if (Array.isArray(result.writeErrors)) {
+ for (let i = 0; i < result.writeErrors.length; i++) {
+ const writeError = {
+ index: batch.originalIndexes[result.writeErrors[i].index],
+ code: result.writeErrors[i].code,
+ errmsg: result.writeErrors[i].errmsg,
+ errInfo: result.writeErrors[i].errInfo,
+ op: batch.operations[result.writeErrors[i].index]
+ };
+ bulkResult.writeErrors.push(new WriteError(writeError));
+ }
+ }
+ if (result.writeConcernError) {
+ bulkResult.writeConcernErrors.push(new WriteConcernError(result.writeConcernError));
+ }
+}
+async function executeCommands(bulkOperation, options) {
+ if (bulkOperation.s.batches.length === 0) {
+ return new BulkWriteResult(bulkOperation.s.bulkResult, bulkOperation.isOrdered);
+ }
+ for (const batch of bulkOperation.s.batches) {
+ const finalOptions = (0, utils_1.resolveOptions)(bulkOperation, {
+ ...options,
+ ordered: bulkOperation.isOrdered
+ });
+ if (finalOptions.bypassDocumentValidation !== true) {
+ delete finalOptions.bypassDocumentValidation;
+ }
+ // Is the bypassDocumentValidation options specific
+ if (bulkOperation.s.bypassDocumentValidation === true) {
+ finalOptions.bypassDocumentValidation = true;
+ }
+ // Is the checkKeys option disabled
+ if (bulkOperation.s.checkKeys === false) {
+ finalOptions.checkKeys = false;
+ }
+ if (bulkOperation.retryWrites) {
+ if (isUpdateBatch(batch)) {
+ bulkOperation.retryWrites =
+ bulkOperation.retryWrites && !batch.operations.some(op => op.multi);
+ }
+ if (isDeleteBatch(batch)) {
+ bulkOperation.retryWrites =
+ bulkOperation.retryWrites && !batch.operations.some(op => op.limit === 0);
+ }
+ }
+ const operation = isInsertBatch(batch)
+ ? new insert_1.InsertOperation(bulkOperation.s.namespace, batch.operations, finalOptions)
+ : isUpdateBatch(batch)
+ ? new update_1.UpdateOperation(bulkOperation.s.namespace, batch.operations, finalOptions)
+ : isDeleteBatch(batch)
+ ? new delete_1.DeleteOperation(bulkOperation.s.namespace, batch.operations, finalOptions)
+ : null;
+ if (operation == null)
+ throw new error_1.MongoRuntimeError(`Unknown batchType: ${batch.batchType}`);
+ let thrownError = null;
+ let result;
+ try {
+ result = await (0, execute_operation_1.executeOperation)(bulkOperation.s.collection.client, operation, finalOptions.timeoutContext);
+ }
+ catch (error) {
+ thrownError = error;
+ }
+ if (thrownError != null) {
+ if (thrownError instanceof error_1.MongoWriteConcernError) {
+ mergeBatchResults(batch, bulkOperation.s.bulkResult, thrownError, result);
+ const writeResult = new BulkWriteResult(bulkOperation.s.bulkResult, bulkOperation.isOrdered);
+ throw new MongoBulkWriteError({
+ message: thrownError.result.writeConcernError.errmsg,
+ code: thrownError.result.writeConcernError.code
+ }, writeResult);
+ }
+ else {
+ // Error is a driver related error not a bulk op error, return early
+ throw new MongoBulkWriteError(thrownError, new BulkWriteResult(bulkOperation.s.bulkResult, bulkOperation.isOrdered));
+ }
+ }
+ mergeBatchResults(batch, bulkOperation.s.bulkResult, thrownError, result);
+ const writeResult = new BulkWriteResult(bulkOperation.s.bulkResult, bulkOperation.isOrdered);
+ bulkOperation.handleWriteError(writeResult);
+ }
+ bulkOperation.s.batches.length = 0;
+ const writeResult = new BulkWriteResult(bulkOperation.s.bulkResult, bulkOperation.isOrdered);
+ bulkOperation.handleWriteError(writeResult);
+ return writeResult;
+}
+/**
+ * An error indicating an unsuccessful Bulk Write
+ * @public
+ * @category Error
+ */
+class MongoBulkWriteError extends error_1.MongoServerError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(error, result) {
+ super(error);
+ this.writeErrors = [];
+ if (error instanceof WriteConcernError)
+ this.err = error;
+ else if (!(error instanceof Error)) {
+ this.message = error.message;
+ this.code = error.code;
+ this.writeErrors = error.writeErrors ?? [];
+ }
+ this.result = result;
+ Object.assign(this, error);
+ }
+ get name() {
+ return 'MongoBulkWriteError';
+ }
+ /** Number of documents inserted. */
+ get insertedCount() {
+ return this.result.insertedCount;
+ }
+ /** Number of documents matched for update. */
+ get matchedCount() {
+ return this.result.matchedCount;
+ }
+ /** Number of documents modified. */
+ get modifiedCount() {
+ return this.result.modifiedCount;
+ }
+ /** Number of documents deleted. */
+ get deletedCount() {
+ return this.result.deletedCount;
+ }
+ /** Number of documents upserted. */
+ get upsertedCount() {
+ return this.result.upsertedCount;
+ }
+ /** Inserted document generated Id's, hash key is the index of the originating operation */
+ get insertedIds() {
+ return this.result.insertedIds;
+ }
+ /** Upserted document generated Id's, hash key is the index of the originating operation */
+ get upsertedIds() {
+ return this.result.upsertedIds;
+ }
+}
+exports.MongoBulkWriteError = MongoBulkWriteError;
+/**
+ * A builder object that is returned from {@link BulkOperationBase#find}.
+ * Is used to build a write operation that involves a query filter.
+ *
+ * @public
+ */
+class FindOperators {
+ /**
+ * Creates a new FindOperators object.
+ * @internal
+ */
+ constructor(bulkOperation) {
+ this.bulkOperation = bulkOperation;
+ }
+ /** Add a multiple update operation to the bulk operation */
+ update(updateDocument) {
+ const currentOp = buildCurrentOp(this.bulkOperation);
+ return this.bulkOperation.addToOperationsList(exports.BatchType.UPDATE, (0, update_1.makeUpdateStatement)(currentOp.selector, updateDocument, {
+ ...currentOp,
+ multi: true
+ }));
+ }
+ /** Add a single update operation to the bulk operation */
+ updateOne(updateDocument) {
+ if (!(0, utils_1.hasAtomicOperators)(updateDocument, this.bulkOperation.bsonOptions)) {
+ throw new error_1.MongoInvalidArgumentError('Update document requires atomic operators');
+ }
+ const currentOp = buildCurrentOp(this.bulkOperation);
+ return this.bulkOperation.addToOperationsList(exports.BatchType.UPDATE, (0, update_1.makeUpdateStatement)(currentOp.selector, updateDocument, { ...currentOp, multi: false }));
+ }
+ /** Add a replace one operation to the bulk operation */
+ replaceOne(replacement) {
+ if ((0, utils_1.hasAtomicOperators)(replacement)) {
+ throw new error_1.MongoInvalidArgumentError('Replacement document must not use atomic operators');
+ }
+ const currentOp = buildCurrentOp(this.bulkOperation);
+ return this.bulkOperation.addToOperationsList(exports.BatchType.UPDATE, (0, update_1.makeUpdateStatement)(currentOp.selector, replacement, { ...currentOp, multi: false }));
+ }
+ /** Add a delete one operation to the bulk operation */
+ deleteOne() {
+ const currentOp = buildCurrentOp(this.bulkOperation);
+ return this.bulkOperation.addToOperationsList(exports.BatchType.DELETE, (0, delete_1.makeDeleteStatement)(currentOp.selector, { ...currentOp, limit: 1 }));
+ }
+ /** Add a delete many operation to the bulk operation */
+ delete() {
+ const currentOp = buildCurrentOp(this.bulkOperation);
+ return this.bulkOperation.addToOperationsList(exports.BatchType.DELETE, (0, delete_1.makeDeleteStatement)(currentOp.selector, { ...currentOp, limit: 0 }));
+ }
+ /** Upsert modifier for update bulk operation, noting that this operation is an upsert. */
+ upsert() {
+ if (!this.bulkOperation.s.currentOp) {
+ this.bulkOperation.s.currentOp = {};
+ }
+ this.bulkOperation.s.currentOp.upsert = true;
+ return this;
+ }
+ /** Specifies the collation for the query condition. */
+ collation(collation) {
+ if (!this.bulkOperation.s.currentOp) {
+ this.bulkOperation.s.currentOp = {};
+ }
+ this.bulkOperation.s.currentOp.collation = collation;
+ return this;
+ }
+ /** Specifies arrayFilters for UpdateOne or UpdateMany bulk operations. */
+ arrayFilters(arrayFilters) {
+ if (!this.bulkOperation.s.currentOp) {
+ this.bulkOperation.s.currentOp = {};
+ }
+ this.bulkOperation.s.currentOp.arrayFilters = arrayFilters;
+ return this;
+ }
+ /** Specifies hint for the bulk operation. */
+ hint(hint) {
+ if (!this.bulkOperation.s.currentOp) {
+ this.bulkOperation.s.currentOp = {};
+ }
+ this.bulkOperation.s.currentOp.hint = hint;
+ return this;
+ }
+}
+exports.FindOperators = FindOperators;
+/** @public */
+class BulkOperationBase {
+ /**
+ * Create a new OrderedBulkOperation or UnorderedBulkOperation instance
+ * @internal
+ */
+ constructor(collection, options, isOrdered) {
+ this.collection = collection;
+ this.retryWrites = collection.db.options?.retryWrites;
+ // determine whether bulkOperation is ordered or unordered
+ this.isOrdered = isOrdered;
+ const topology = (0, utils_1.getTopology)(collection);
+ options = options == null ? {} : options;
+ // TODO Bring from driver information in hello
+ // Get the namespace for the write operations
+ const namespace = collection.s.namespace;
+ // Used to mark operation as executed
+ const executed = false;
+ // Current item
+ const currentOp = undefined;
+ // Set max byte size
+ const hello = topology.lastHello();
+ // If we have autoEncryption on, batch-splitting must be done on 2mb chunks, but single documents
+ // over 2mb are still allowed
+ const usingAutoEncryption = !!(topology.s.options && topology.s.options.autoEncrypter);
+ const maxBsonObjectSize = hello && hello.maxBsonObjectSize ? hello.maxBsonObjectSize : 1024 * 1024 * 16;
+ const maxBatchSizeBytes = usingAutoEncryption ? 1024 * 1024 * 2 : maxBsonObjectSize;
+ const maxWriteBatchSize = hello && hello.maxWriteBatchSize ? hello.maxWriteBatchSize : 1000;
+ // Calculates the largest possible size of an Array key, represented as a BSON string
+ // element. This calculation:
+ // 1 byte for BSON type
+ // # of bytes = length of (string representation of (maxWriteBatchSize - 1))
+ // + 1 bytes for null terminator
+ const maxKeySize = (maxWriteBatchSize - 1).toString(10).length + 2;
+ // Final results
+ const bulkResult = {
+ ok: 1,
+ writeErrors: [],
+ writeConcernErrors: [],
+ insertedIds: [],
+ nInserted: 0,
+ nUpserted: 0,
+ nMatched: 0,
+ nModified: 0,
+ nRemoved: 0,
+ upserted: []
+ };
+ // Internal state
+ this.s = {
+ // Final result
+ bulkResult,
+ // Current batch state
+ currentBatch: undefined,
+ currentIndex: 0,
+ // ordered specific
+ currentBatchSize: 0,
+ currentBatchSizeBytes: 0,
+ // unordered specific
+ currentInsertBatch: undefined,
+ currentUpdateBatch: undefined,
+ currentRemoveBatch: undefined,
+ batches: [],
+ // Write concern
+ writeConcern: write_concern_1.WriteConcern.fromOptions(options),
+ // Max batch size options
+ maxBsonObjectSize,
+ maxBatchSizeBytes,
+ maxWriteBatchSize,
+ maxKeySize,
+ // Namespace
+ namespace,
+ // Topology
+ topology,
+ // Options
+ options: options,
+ // BSON options
+ bsonOptions: (0, bson_1.resolveBSONOptions)(options),
+ // Current operation
+ currentOp,
+ // Executed
+ executed,
+ // Collection
+ collection,
+ // Fundamental error
+ err: undefined,
+ // check keys
+ checkKeys: typeof options.checkKeys === 'boolean' ? options.checkKeys : false
+ };
+ // bypass Validation
+ if (options.bypassDocumentValidation === true) {
+ this.s.bypassDocumentValidation = true;
+ }
+ }
+ /**
+ * Add a single insert document to the bulk operation
+ *
+ * @example
+ * ```ts
+ * const bulkOp = collection.initializeOrderedBulkOp();
+ *
+ * // Adds three inserts to the bulkOp.
+ * bulkOp
+ * .insert({ a: 1 })
+ * .insert({ b: 2 })
+ * .insert({ c: 3 });
+ * await bulkOp.execute();
+ * ```
+ */
+ insert(document) {
+ (0, utils_1.maybeAddIdToDocuments)(this.collection, document, {
+ forceServerObjectId: this.shouldForceServerObjectId()
+ });
+ return this.addToOperationsList(exports.BatchType.INSERT, document);
+ }
+ /**
+ * Builds a find operation for an update/updateOne/delete/deleteOne/replaceOne.
+ * Returns a builder object used to complete the definition of the operation.
+ *
+ * @example
+ * ```ts
+ * const bulkOp = collection.initializeOrderedBulkOp();
+ *
+ * // Add an updateOne to the bulkOp
+ * bulkOp.find({ a: 1 }).updateOne({ $set: { b: 2 } });
+ *
+ * // Add an updateMany to the bulkOp
+ * bulkOp.find({ c: 3 }).update({ $set: { d: 4 } });
+ *
+ * // Add an upsert
+ * bulkOp.find({ e: 5 }).upsert().updateOne({ $set: { f: 6 } });
+ *
+ * // Add a deletion
+ * bulkOp.find({ g: 7 }).deleteOne();
+ *
+ * // Add a multi deletion
+ * bulkOp.find({ h: 8 }).delete();
+ *
+ * // Add a replaceOne
+ * bulkOp.find({ i: 9 }).replaceOne({writeConcern: { j: 10 }});
+ *
+ * // Update using a pipeline (requires Mongodb 4.2 or higher)
+ * bulk.find({ k: 11, y: { $exists: true }, z: { $exists: true } }).updateOne([
+ * { $set: { total: { $sum: [ '$y', '$z' ] } } }
+ * ]);
+ *
+ * // All of the ops will now be executed
+ * await bulkOp.execute();
+ * ```
+ */
+ find(selector) {
+ if (!selector) {
+ throw new error_1.MongoInvalidArgumentError('Bulk find operation must specify a selector');
+ }
+ // Save a current selector
+ this.s.currentOp = {
+ selector: selector
+ };
+ return new FindOperators(this);
+ }
+ /** Specifies a raw operation to perform in the bulk write. */
+ raw(op) {
+ if (op == null || typeof op !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Operation must be an object with an operation key');
+ }
+ if ('insertOne' in op) {
+ const forceServerObjectId = this.shouldForceServerObjectId();
+ const document = op.insertOne && op.insertOne.document == null
+ ? // TODO(NODE-6003): remove support for omitting the `documents` subdocument in bulk inserts
+ op.insertOne
+ : op.insertOne.document;
+ (0, utils_1.maybeAddIdToDocuments)(this.collection, document, { forceServerObjectId });
+ return this.addToOperationsList(exports.BatchType.INSERT, document);
+ }
+ if ('replaceOne' in op || 'updateOne' in op || 'updateMany' in op) {
+ if ('replaceOne' in op) {
+ if ('q' in op.replaceOne) {
+ throw new error_1.MongoInvalidArgumentError('Raw operations are not allowed');
+ }
+ const updateStatement = (0, update_1.makeUpdateStatement)(op.replaceOne.filter, op.replaceOne.replacement, { ...op.replaceOne, multi: false });
+ if ((0, utils_1.hasAtomicOperators)(updateStatement.u)) {
+ throw new error_1.MongoInvalidArgumentError('Replacement document must not use atomic operators');
+ }
+ return this.addToOperationsList(exports.BatchType.UPDATE, updateStatement);
+ }
+ if ('updateOne' in op) {
+ if ('q' in op.updateOne) {
+ throw new error_1.MongoInvalidArgumentError('Raw operations are not allowed');
+ }
+ const updateStatement = (0, update_1.makeUpdateStatement)(op.updateOne.filter, op.updateOne.update, {
+ ...op.updateOne,
+ multi: false
+ });
+ if (!(0, utils_1.hasAtomicOperators)(updateStatement.u, this.bsonOptions)) {
+ throw new error_1.MongoInvalidArgumentError('Update document requires atomic operators');
+ }
+ return this.addToOperationsList(exports.BatchType.UPDATE, updateStatement);
+ }
+ if ('updateMany' in op) {
+ if ('q' in op.updateMany) {
+ throw new error_1.MongoInvalidArgumentError('Raw operations are not allowed');
+ }
+ const updateStatement = (0, update_1.makeUpdateStatement)(op.updateMany.filter, op.updateMany.update, {
+ ...op.updateMany,
+ multi: true
+ });
+ if (!(0, utils_1.hasAtomicOperators)(updateStatement.u, this.bsonOptions)) {
+ throw new error_1.MongoInvalidArgumentError('Update document requires atomic operators');
+ }
+ return this.addToOperationsList(exports.BatchType.UPDATE, updateStatement);
+ }
+ }
+ if ('deleteOne' in op) {
+ if ('q' in op.deleteOne) {
+ throw new error_1.MongoInvalidArgumentError('Raw operations are not allowed');
+ }
+ return this.addToOperationsList(exports.BatchType.DELETE, (0, delete_1.makeDeleteStatement)(op.deleteOne.filter, { ...op.deleteOne, limit: 1 }));
+ }
+ if ('deleteMany' in op) {
+ if ('q' in op.deleteMany) {
+ throw new error_1.MongoInvalidArgumentError('Raw operations are not allowed');
+ }
+ return this.addToOperationsList(exports.BatchType.DELETE, (0, delete_1.makeDeleteStatement)(op.deleteMany.filter, { ...op.deleteMany, limit: 0 }));
+ }
+ // otherwise an unknown operation was provided
+ throw new error_1.MongoInvalidArgumentError('bulkWrite only supports insertOne, updateOne, updateMany, deleteOne, deleteMany');
+ }
+ get length() {
+ return this.s.currentIndex;
+ }
+ get bsonOptions() {
+ return this.s.bsonOptions;
+ }
+ get writeConcern() {
+ return this.s.writeConcern;
+ }
+ get batches() {
+ const batches = [...this.s.batches];
+ if (this.isOrdered) {
+ if (this.s.currentBatch)
+ batches.push(this.s.currentBatch);
+ }
+ else {
+ if (this.s.currentInsertBatch)
+ batches.push(this.s.currentInsertBatch);
+ if (this.s.currentUpdateBatch)
+ batches.push(this.s.currentUpdateBatch);
+ if (this.s.currentRemoveBatch)
+ batches.push(this.s.currentRemoveBatch);
+ }
+ return batches;
+ }
+ async execute(options = {}) {
+ if (this.s.executed) {
+ throw new error_1.MongoBatchReExecutionError();
+ }
+ const writeConcern = write_concern_1.WriteConcern.fromOptions(options);
+ if (writeConcern) {
+ this.s.writeConcern = writeConcern;
+ }
+ // If we have current batch
+ if (this.isOrdered) {
+ if (this.s.currentBatch)
+ this.s.batches.push(this.s.currentBatch);
+ }
+ else {
+ if (this.s.currentInsertBatch)
+ this.s.batches.push(this.s.currentInsertBatch);
+ if (this.s.currentUpdateBatch)
+ this.s.batches.push(this.s.currentUpdateBatch);
+ if (this.s.currentRemoveBatch)
+ this.s.batches.push(this.s.currentRemoveBatch);
+ }
+ // If we have no operations in the bulk raise an error
+ if (this.s.batches.length === 0) {
+ throw new error_1.MongoInvalidArgumentError('Invalid BulkOperation, Batch cannot be empty');
+ }
+ this.s.executed = true;
+ const finalOptions = (0, utils_1.resolveOptions)(this.collection, { ...this.s.options, ...options });
+ // if there is no timeoutContext provided, create a timeoutContext and use it for
+ // all batches in the bulk operation
+ finalOptions.timeoutContext ??= timeout_1.TimeoutContext.create({
+ session: finalOptions.session,
+ timeoutMS: finalOptions.timeoutMS,
+ serverSelectionTimeoutMS: this.collection.client.s.options.serverSelectionTimeoutMS,
+ waitQueueTimeoutMS: this.collection.client.s.options.waitQueueTimeoutMS
+ });
+ if (finalOptions.session == null) {
+ // if there is not an explicit session provided to `execute()`, create
+ // an implicit session and use that for all batches in the bulk operation
+ return await this.collection.client.withSession({ explicit: false }, async (session) => {
+ return await executeCommands(this, { ...finalOptions, session });
+ });
+ }
+ return await executeCommands(this, { ...finalOptions });
+ }
+ /**
+ * Handles the write error before executing commands
+ * @internal
+ */
+ handleWriteError(writeResult) {
+ if (this.s.bulkResult.writeErrors.length > 0) {
+ const msg = this.s.bulkResult.writeErrors[0].errmsg
+ ? this.s.bulkResult.writeErrors[0].errmsg
+ : 'write operation failed';
+ throw new MongoBulkWriteError({
+ message: msg,
+ code: this.s.bulkResult.writeErrors[0].code,
+ writeErrors: this.s.bulkResult.writeErrors
+ }, writeResult);
+ }
+ const writeConcernError = writeResult.getWriteConcernError();
+ if (writeConcernError) {
+ throw new MongoBulkWriteError(writeConcernError, writeResult);
+ }
+ }
+ shouldForceServerObjectId() {
+ return (this.s.options.forceServerObjectId === true ||
+ this.s.collection.db.options?.forceServerObjectId === true);
+ }
+}
+exports.BulkOperationBase = BulkOperationBase;
+function isInsertBatch(batch) {
+ return batch.batchType === exports.BatchType.INSERT;
+}
+function isUpdateBatch(batch) {
+ return batch.batchType === exports.BatchType.UPDATE;
+}
+function isDeleteBatch(batch) {
+ return batch.batchType === exports.BatchType.DELETE;
+}
+function buildCurrentOp(bulkOp) {
+ let { currentOp } = bulkOp.s;
+ bulkOp.s.currentOp = undefined;
+ if (!currentOp)
+ currentOp = {};
+ return currentOp;
+}
+//# sourceMappingURL=common.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/bulk/common.js.map b/node_modules/mongodb/lib/bulk/common.js.map
new file mode 100644
index 00000000..1412f881
--- /dev/null
+++ b/node_modules/mongodb/lib/bulk/common.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/bulk/common.ts"],"names":[],"mappings":";;;AAkZA,8CAgGC;AAlfD,kCAA8F;AAE9F,oCAQkB;AAGlB,iDAAkG;AAClG,uEAAmE;AACnE,iDAAuD;AAEvD,iDAAkG;AAGlG,wCAA4C;AAC5C,oCAMkB;AAClB,oDAAgD;AAEhD,cAAc;AACD,QAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACD,CAAC,CAAC;AAgHZ;;;;;GAKG;AACH,MAAa,KAAK;IAShB,YAAY,SAAoB,EAAE,iBAAyB;QACzD,IAAI,CA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,MAAM,iBAAiB,GAAG,WAAW,CAAC,oBAAoB,EAAE,CAAC;QAC7D,IAAI,iBAAiB,EAAE,CAAC;YACtB,MAAM,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAOO,yBAAyB;QAC/B,OAAO,CACL,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,KAAK,IAAI;YAC3C,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAC3D,CAAC;IACJ,CAAC;CACF;AAzXD,8CAyXC;AAED,SAAS,aAAa,CAAC,KAAY;IACjC,OAAO,KAAK,CAAC,SAAS,KAAK,iBAAS,CAAC,MAAM,CAAC;AAC9C,CAAC;AAED,SAAS,aAAa,CAAC,KAAY;IACjC,OAAO,KAAK,CAAC,SAAS,KAAK,iBAAS,CAAC,MAAM,CAAC;AAC9C,CAAC;AAED,SAAS,aAAa,CAAC,KAAY;IACjC,OAAO,KAAK,CAAC,SAAS,KAAK,iBAAS,CAAC,MAAM,CAAC;AAC9C,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB;IAC/C,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IAC7B,MAAM,CAAC,CAAC,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,SAAS;QAAE,SAAS,GAAG,EAAE,CAAC;IAC/B,OAAO,SAAS,CAAC;AACnB,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/bulk/ordered.js b/node_modules/mongodb/lib/bulk/ordered.js
new file mode 100644
index 00000000..667f724f
--- /dev/null
+++ b/node_modules/mongodb/lib/bulk/ordered.js
@@ -0,0 +1,67 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.OrderedBulkOperation = void 0;
+const BSON = require("../bson");
+const error_1 = require("../error");
+const common_1 = require("./common");
+/** @public */
+class OrderedBulkOperation extends common_1.BulkOperationBase {
+ /** @internal */
+ constructor(collection, options) {
+ super(collection, options, true);
+ }
+ addToOperationsList(batchType, document) {
+ // Get the bsonSize
+ const bsonSize = BSON.calculateObjectSize(document, {
+ checkKeys: false,
+ // Since we don't know what the user selected for BSON options here,
+ // err on the safe side, and check the size with ignoreUndefined: false.
+ ignoreUndefined: false
+ });
+ // Throw error if the doc is bigger than the max BSON size
+ if (bsonSize >= this.s.maxBsonObjectSize)
+ // TODO(NODE-3483): Change this to MongoBSONError
+ throw new error_1.MongoInvalidArgumentError(`Document is larger than the maximum size ${this.s.maxBsonObjectSize}`);
+ // Create a new batch object if we don't have a current one
+ if (this.s.currentBatch == null) {
+ this.s.currentBatch = new common_1.Batch(batchType, this.s.currentIndex);
+ }
+ const maxKeySize = this.s.maxKeySize;
+ // Check if we need to create a new batch
+ if (
+ // New batch if we exceed the max batch op size
+ this.s.currentBatchSize + 1 >= this.s.maxWriteBatchSize ||
+ // New batch if we exceed the maxBatchSizeBytes. Only matters if batch already has a doc,
+ // since we can't sent an empty batch
+ (this.s.currentBatchSize > 0 &&
+ this.s.currentBatchSizeBytes + maxKeySize + bsonSize >= this.s.maxBatchSizeBytes) ||
+ // New batch if the new op does not have the same op type as the current batch
+ this.s.currentBatch.batchType !== batchType) {
+ // Save the batch to the execution stack
+ this.s.batches.push(this.s.currentBatch);
+ // Create a new batch
+ this.s.currentBatch = new common_1.Batch(batchType, this.s.currentIndex);
+ // Reset the current size trackers
+ this.s.currentBatchSize = 0;
+ this.s.currentBatchSizeBytes = 0;
+ }
+ if (batchType === common_1.BatchType.INSERT) {
+ this.s.bulkResult.insertedIds.push({
+ index: this.s.currentIndex,
+ _id: document._id
+ });
+ }
+ // We have an array of documents
+ if (Array.isArray(document)) {
+ throw new error_1.MongoInvalidArgumentError('Operation passed in cannot be an Array');
+ }
+ this.s.currentBatch.originalIndexes.push(this.s.currentIndex);
+ this.s.currentBatch.operations.push(document);
+ this.s.currentBatchSize += 1;
+ this.s.currentBatchSizeBytes += maxKeySize + bsonSize;
+ this.s.currentIndex += 1;
+ return this;
+ }
+}
+exports.OrderedBulkOperation = OrderedBulkOperation;
+//# sourceMappingURL=ordered.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/bulk/ordered.js.map b/node_modules/mongodb/lib/bulk/ordered.js.map
new file mode 100644
index 00000000..42791c81
--- /dev/null
+++ b/node_modules/mongodb/lib/bulk/ordered.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"ordered.js","sourceRoot":"","sources":["../../src/bulk/ordered.ts"],"names":[],"mappings":";;;AACA,gCAAgC;AAEhC,oCAAqD;AAGrD,qCAAsF;AAEtF,cAAc;AACd,MAAa,oBAAqB,SAAQ,0BAAiB;IACzD,gBAAgB;IAChB,YAAY,UAAsB,EAAE,OAAyB;QAC3D,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,mBAAmB,CACjB,SAAoB,EACpB,QAAsD;QAEtD,mBAAmB;QACnB,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE;YAClD,SAAS,EAAE,KAAK;YAChB,oEAAoE;YACpE,wEAAwE;YACxE,eAAe,EAAE,KAAK;SAChB,CAAC,CAAC;QAEV,0DAA0D;QAC1D,IAAI,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,iBAAiB;YACtC,iDAAiD;YACjD,MAAM,IAAI,iCAAyB,CACjC,4CAA4C,IAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE,CACvE,CAAC;QAEJ,2DAA2D;QAC3D,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC;YAChC,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,IAAI,cAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QAClE,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC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AC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QAC9D,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,CAAC,CAAC,CAAC,gBAAgB,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,CAAC,CAAC,qBAAqB,IAAI,UAAU,GAAG,QAAQ,CAAC;QACtD,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzED,oDAyEC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/bulk/unordered.js b/node_modules/mongodb/lib/bulk/unordered.js
new file mode 100644
index 00000000..2d964d26
--- /dev/null
+++ b/node_modules/mongodb/lib/bulk/unordered.js
@@ -0,0 +1,92 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.UnorderedBulkOperation = void 0;
+const BSON = require("../bson");
+const error_1 = require("../error");
+const common_1 = require("./common");
+/** @public */
+class UnorderedBulkOperation extends common_1.BulkOperationBase {
+ /** @internal */
+ constructor(collection, options) {
+ super(collection, options, false);
+ }
+ handleWriteError(writeResult) {
+ if (this.s.batches.length) {
+ return;
+ }
+ return super.handleWriteError(writeResult);
+ }
+ addToOperationsList(batchType, document) {
+ // Get the bsonSize
+ const bsonSize = BSON.calculateObjectSize(document, {
+ checkKeys: false,
+ // Since we don't know what the user selected for BSON options here,
+ // err on the safe side, and check the size with ignoreUndefined: false.
+ ignoreUndefined: false
+ });
+ // Throw error if the doc is bigger than the max BSON size
+ if (bsonSize >= this.s.maxBsonObjectSize) {
+ // TODO(NODE-3483): Change this to MongoBSONError
+ throw new error_1.MongoInvalidArgumentError(`Document is larger than the maximum size ${this.s.maxBsonObjectSize}`);
+ }
+ // Holds the current batch
+ this.s.currentBatch = undefined;
+ // Get the right type of batch
+ if (batchType === common_1.BatchType.INSERT) {
+ this.s.currentBatch = this.s.currentInsertBatch;
+ }
+ else if (batchType === common_1.BatchType.UPDATE) {
+ this.s.currentBatch = this.s.currentUpdateBatch;
+ }
+ else if (batchType === common_1.BatchType.DELETE) {
+ this.s.currentBatch = this.s.currentRemoveBatch;
+ }
+ const maxKeySize = this.s.maxKeySize;
+ // Create a new batch object if we don't have a current one
+ if (this.s.currentBatch == null) {
+ this.s.currentBatch = new common_1.Batch(batchType, this.s.currentIndex);
+ }
+ // Check if we need to create a new batch
+ if (
+ // New batch if we exceed the max batch op size
+ this.s.currentBatch.size + 1 >= this.s.maxWriteBatchSize ||
+ // New batch if we exceed the maxBatchSizeBytes. Only matters if batch already has a doc,
+ // since we can't sent an empty batch
+ (this.s.currentBatch.size > 0 &&
+ this.s.currentBatch.sizeBytes + maxKeySize + bsonSize >= this.s.maxBatchSizeBytes) ||
+ // New batch if the new op does not have the same op type as the current batch
+ this.s.currentBatch.batchType !== batchType) {
+ // Save the batch to the execution stack
+ this.s.batches.push(this.s.currentBatch);
+ // Create a new batch
+ this.s.currentBatch = new common_1.Batch(batchType, this.s.currentIndex);
+ }
+ // We have an array of documents
+ if (Array.isArray(document)) {
+ throw new error_1.MongoInvalidArgumentError('Operation passed in cannot be an Array');
+ }
+ this.s.currentBatch.operations.push(document);
+ this.s.currentBatch.originalIndexes.push(this.s.currentIndex);
+ this.s.currentIndex = this.s.currentIndex + 1;
+ // Save back the current Batch to the right type
+ if (batchType === common_1.BatchType.INSERT) {
+ this.s.currentInsertBatch = this.s.currentBatch;
+ this.s.bulkResult.insertedIds.push({
+ index: this.s.bulkResult.insertedIds.length,
+ _id: document._id
+ });
+ }
+ else if (batchType === common_1.BatchType.UPDATE) {
+ this.s.currentUpdateBatch = this.s.currentBatch;
+ }
+ else if (batchType === common_1.BatchType.DELETE) {
+ this.s.currentRemoveBatch = this.s.currentBatch;
+ }
+ // Update current batch size
+ this.s.currentBatch.size += 1;
+ this.s.currentBatch.sizeBytes += maxKeySize + bsonSize;
+ return this;
+ }
+}
+exports.UnorderedBulkOperation = UnorderedBulkOperation;
+//# sourceMappingURL=unordered.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/bulk/unordered.js.map b/node_modules/mongodb/lib/bulk/unordered.js.map
new file mode 100644
index 00000000..f6b65a4d
--- /dev/null
+++ b/node_modules/mongodb/lib/bulk/unordered.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"unordered.js","sourceRoot":"","sources":["../../src/bulk/unordered.ts"],"names":[],"mappings":";;;AACA,gCAAgC;AAEhC,oCAAqD;AAGrD,qCAMkB;AAElB,cAAc;AACd,MAAa,sBAAuB,SAAQ,0BAAiB;IAC3D,gBAAgB;IAChB,YAAY,UAAsB,EAAE,OAAyB;QAC3D,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAEQ,gBAAgB,CAAC,WAA4B;QACpD,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,OAAO,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED,mBAAmB,CACjB,SAAoB,EACpB,QAAsD;QAEtD,mBAAmB;QACnB,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE;YAClD,SAAS,EAAE,KAAK;YAEhB,oEAAoE;YACpE,wEAAwE;YACxE,eAAe,EAAE,KAAK;SAChB,CAAC,CAAC;QAEV,0DAA0D;QAC1D,IAAI,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;YACzC,iDAAiD;YACjD,MAAM,IAAI,iCAAyB,CACjC,4CAA4C,IAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE,CACvE,CAAC;QACJ,CAAC;QAED,0BAA0B;QAC1B,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,SAAS,CAAC;QAChC,8BAA8B;QAC9B,IAAI,SAAS,KAAK,kB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4BAA4B;QAC5B,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,IAAI,UAAU,GAAG,QAAQ,CAAC;QAEvD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAnGD,wDAmGC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/change_stream.js b/node_modules/mongodb/lib/change_stream.js
new file mode 100644
index 00000000..c7312506
--- /dev/null
+++ b/node_modules/mongodb/lib/change_stream.js
@@ -0,0 +1,517 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ChangeStream = void 0;
+exports.filterOutOptions = filterOutOptions;
+const collection_1 = require("./collection");
+const constants_1 = require("./constants");
+const abstract_cursor_1 = require("./cursor/abstract_cursor");
+const change_stream_cursor_1 = require("./cursor/change_stream_cursor");
+const db_1 = require("./db");
+const error_1 = require("./error");
+const mongo_client_1 = require("./mongo_client");
+const mongo_types_1 = require("./mongo_types");
+const server_selection_1 = require("./sdam/server_selection");
+const timeout_1 = require("./timeout");
+const utils_1 = require("./utils");
+const CHANGE_DOMAIN_TYPES = {
+ COLLECTION: Symbol('Collection'),
+ DATABASE: Symbol('Database'),
+ CLUSTER: Symbol('Cluster')
+};
+const CHANGE_STREAM_EVENTS = [constants_1.RESUME_TOKEN_CHANGED, constants_1.END, constants_1.CLOSE];
+const NO_RESUME_TOKEN_ERROR = 'A change stream document has been received that lacks a resume token (_id).';
+const CHANGESTREAM_CLOSED_ERROR = 'ChangeStream is closed';
+const INVALID_STAGE_OPTIONS = buildDisallowedChangeStreamOptions();
+function filterOutOptions(options) {
+ return Object.fromEntries(Object.entries(options).filter(([k, _]) => !INVALID_STAGE_OPTIONS.has(k)));
+}
+/**
+ * Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
+ * @public
+ */
+class ChangeStream extends mongo_types_1.TypedEventEmitter {
+ /**
+ * @experimental
+ * An alias for {@link ChangeStream.close|ChangeStream.close()}.
+ */
+ async [Symbol.asyncDispose]() {
+ await this.close();
+ }
+ /** @event */
+ static { this.RESPONSE = constants_1.RESPONSE; }
+ /** @event */
+ static { this.MORE = constants_1.MORE; }
+ /** @event */
+ static { this.INIT = constants_1.INIT; }
+ /** @event */
+ static { this.CLOSE = constants_1.CLOSE; }
+ /**
+ * Fired for each new matching change in the specified namespace. Attaching a `change`
+ * event listener to a Change Stream will switch the stream into flowing mode. Data will
+ * then be passed as soon as it is available.
+ * @event
+ */
+ static { this.CHANGE = constants_1.CHANGE; }
+ /** @event */
+ static { this.END = constants_1.END; }
+ /** @event */
+ static { this.ERROR = constants_1.ERROR; }
+ /**
+ * Emitted each time the change stream stores a new resume token.
+ * @event
+ */
+ static { this.RESUME_TOKEN_CHANGED = constants_1.RESUME_TOKEN_CHANGED; }
+ /**
+ * @internal
+ *
+ * @param parent - The parent object that created this change stream
+ * @param pipeline - An array of {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/|aggregation pipeline stages} through which to pass change stream documents
+ */
+ constructor(parent, pipeline = [], options = {}) {
+ super();
+ this.pipeline = pipeline;
+ this.options = { ...options };
+ let serverSelectionTimeoutMS;
+ delete this.options.writeConcern;
+ if (parent instanceof collection_1.Collection) {
+ this.type = CHANGE_DOMAIN_TYPES.COLLECTION;
+ serverSelectionTimeoutMS = parent.s.db.client.options.serverSelectionTimeoutMS;
+ }
+ else if (parent instanceof db_1.Db) {
+ this.type = CHANGE_DOMAIN_TYPES.DATABASE;
+ serverSelectionTimeoutMS = parent.client.options.serverSelectionTimeoutMS;
+ }
+ else if (parent instanceof mongo_client_1.MongoClient) {
+ this.type = CHANGE_DOMAIN_TYPES.CLUSTER;
+ serverSelectionTimeoutMS = parent.options.serverSelectionTimeoutMS;
+ }
+ else {
+ throw new error_1.MongoChangeStreamError('Parent provided to ChangeStream constructor must be an instance of Collection, Db, or MongoClient');
+ }
+ this.contextOwner = Symbol();
+ this.parent = parent;
+ this.namespace = parent.s.namespace;
+ if (!this.options.readPreference && parent.readPreference) {
+ this.options.readPreference = parent.readPreference;
+ }
+ // Create contained Change Stream cursor
+ this.cursor = this._createChangeStreamCursor(options);
+ this.isClosed = false;
+ this.mode = false;
+ // Listen for any `change` listeners being added to ChangeStream
+ this.on('newListener', eventName => {
+ if (eventName === 'change' && this.cursor && this.listenerCount('change') === 0) {
+ this._streamEvents(this.cursor);
+ }
+ });
+ this.on('removeListener', eventName => {
+ if (eventName === 'change' && this.listenerCount('change') === 0 && this.cursor) {
+ this.cursorStream?.removeAllListeners('data');
+ }
+ });
+ if (this.options.timeoutMS != null) {
+ this.timeoutContext = new timeout_1.CSOTTimeoutContext({
+ timeoutMS: this.options.timeoutMS,
+ serverSelectionTimeoutMS
+ });
+ }
+ }
+ /** The cached resume token that is used to resume after the most recently returned change. */
+ get resumeToken() {
+ return this.cursor?.resumeToken;
+ }
+ /** Returns the currently buffered documents length of the underlying cursor. */
+ bufferedCount() {
+ return this.cursor?.bufferedCount() ?? 0;
+ }
+ /** Check if there is any document still available in the Change Stream */
+ async hasNext() {
+ this._setIsIterator();
+ // Change streams must resume indefinitely while each resume event succeeds.
+ // This loop continues until either a change event is received or until a resume attempt
+ // fails.
+ this.timeoutContext?.refresh();
+ try {
+ while (true) {
+ try {
+ const hasNext = await this.cursor.hasNext();
+ return hasNext;
+ }
+ catch (error) {
+ try {
+ await this._processErrorIteratorMode(error, this.cursor.id != null);
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoOperationTimeoutError && this.cursor.id == null) {
+ throw error;
+ }
+ try {
+ await this.close();
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ throw error;
+ }
+ }
+ }
+ }
+ finally {
+ this.timeoutContext?.clear();
+ }
+ }
+ /** Get the next available document from the Change Stream. */
+ async next() {
+ this._setIsIterator();
+ // Change streams must resume indefinitely while each resume event succeeds.
+ // This loop continues until either a change event is received or until a resume attempt
+ // fails.
+ this.timeoutContext?.refresh();
+ try {
+ while (true) {
+ try {
+ const change = await this.cursor.next();
+ const processedChange = this._processChange(change ?? null);
+ return processedChange;
+ }
+ catch (error) {
+ try {
+ await this._processErrorIteratorMode(error, this.cursor.id != null);
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoOperationTimeoutError && this.cursor.id == null) {
+ throw error;
+ }
+ try {
+ await this.close();
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ throw error;
+ }
+ }
+ }
+ }
+ finally {
+ this.timeoutContext?.clear();
+ }
+ }
+ /**
+ * Try to get the next available document from the Change Stream's cursor or `null` if an empty batch is returned
+ */
+ async tryNext() {
+ this._setIsIterator();
+ // Change streams must resume indefinitely while each resume event succeeds.
+ // This loop continues until either a change event is received or until a resume attempt
+ // fails.
+ this.timeoutContext?.refresh();
+ try {
+ while (true) {
+ try {
+ const change = await this.cursor.tryNext();
+ if (!change) {
+ return null;
+ }
+ const processedChange = this._processChange(change);
+ return processedChange;
+ }
+ catch (error) {
+ try {
+ await this._processErrorIteratorMode(error, this.cursor.id != null);
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoOperationTimeoutError && this.cursor.id == null)
+ throw error;
+ try {
+ await this.close();
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ throw error;
+ }
+ }
+ }
+ }
+ finally {
+ this.timeoutContext?.clear();
+ }
+ }
+ async *[Symbol.asyncIterator]() {
+ if (this.closed) {
+ return;
+ }
+ try {
+ // Change streams run indefinitely as long as errors are resumable
+ // So the only loop breaking condition is if `next()` throws
+ while (true) {
+ yield await this.next();
+ }
+ }
+ finally {
+ try {
+ await this.close();
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ }
+ }
+ /** Is the cursor closed */
+ get closed() {
+ return this.isClosed || this.cursor.closed;
+ }
+ /**
+ * Frees the internal resources used by the change stream.
+ */
+ async close() {
+ this.timeoutContext?.clear();
+ this.timeoutContext = undefined;
+ this.isClosed = true;
+ const cursor = this.cursor;
+ try {
+ await cursor.close();
+ }
+ finally {
+ this._endStream();
+ }
+ }
+ /**
+ * Return a modified Readable stream including a possible transform method.
+ *
+ * NOTE: When using a Stream to process change stream events, the stream will
+ * NOT automatically resume in the case a resumable error is encountered.
+ *
+ * @throws MongoChangeStreamError if the underlying cursor or the change stream is closed
+ */
+ stream() {
+ if (this.closed) {
+ throw new error_1.MongoChangeStreamError(CHANGESTREAM_CLOSED_ERROR);
+ }
+ return this.cursor.stream();
+ }
+ /** @internal */
+ _setIsEmitter() {
+ if (this.mode === 'iterator') {
+ // TODO(NODE-3485): Replace with MongoChangeStreamModeError
+ throw new error_1.MongoAPIError('ChangeStream cannot be used as an EventEmitter after being used as an iterator');
+ }
+ this.mode = 'emitter';
+ }
+ /** @internal */
+ _setIsIterator() {
+ if (this.mode === 'emitter') {
+ // TODO(NODE-3485): Replace with MongoChangeStreamModeError
+ throw new error_1.MongoAPIError('ChangeStream cannot be used as an iterator after being used as an EventEmitter');
+ }
+ this.mode = 'iterator';
+ }
+ /**
+ * Create a new change stream cursor based on self's configuration
+ * @internal
+ */
+ _createChangeStreamCursor(options) {
+ const changeStreamStageOptions = filterOutOptions(options);
+ if (this.type === CHANGE_DOMAIN_TYPES.CLUSTER) {
+ changeStreamStageOptions.allChangesForCluster = true;
+ }
+ const pipeline = [{ $changeStream: changeStreamStageOptions }, ...this.pipeline];
+ const client = this.type === CHANGE_DOMAIN_TYPES.CLUSTER
+ ? this.parent
+ : this.type === CHANGE_DOMAIN_TYPES.DATABASE
+ ? this.parent.client
+ : this.type === CHANGE_DOMAIN_TYPES.COLLECTION
+ ? this.parent.client
+ : null;
+ if (client == null) {
+ // This should never happen because of the assertion in the constructor
+ throw new error_1.MongoRuntimeError(`Changestream type should only be one of cluster, database, collection. Found ${this.type.toString()}`);
+ }
+ const changeStreamCursor = new change_stream_cursor_1.ChangeStreamCursor(client, this.namespace, pipeline, {
+ ...options,
+ timeoutContext: this.timeoutContext
+ ? new abstract_cursor_1.CursorTimeoutContext(this.timeoutContext, this.contextOwner)
+ : undefined
+ });
+ for (const event of CHANGE_STREAM_EVENTS) {
+ changeStreamCursor.on(event, e => this.emit(event, e));
+ }
+ if (this.listenerCount(ChangeStream.CHANGE) > 0) {
+ this._streamEvents(changeStreamCursor);
+ }
+ return changeStreamCursor;
+ }
+ /** @internal */
+ _closeEmitterModeWithError(error) {
+ this.emit(ChangeStream.ERROR, error);
+ this.close().then(undefined, utils_1.squashError);
+ }
+ /** @internal */
+ _streamEvents(cursor) {
+ this._setIsEmitter();
+ const stream = this.cursorStream ?? cursor.stream();
+ this.cursorStream = stream;
+ stream.on('data', change => {
+ try {
+ const processedChange = this._processChange(change);
+ this.emit(ChangeStream.CHANGE, processedChange);
+ }
+ catch (error) {
+ this.emit(ChangeStream.ERROR, error);
+ }
+ this.timeoutContext?.refresh();
+ });
+ stream.on('error', error => this._processErrorStreamMode(error, this.cursor.id != null));
+ }
+ /** @internal */
+ _endStream() {
+ this.cursorStream?.removeAllListeners('data');
+ this.cursorStream?.removeAllListeners('close');
+ this.cursorStream?.removeAllListeners('end');
+ this.cursorStream?.destroy();
+ this.cursorStream = undefined;
+ }
+ /** @internal */
+ _processChange(change) {
+ if (this.isClosed) {
+ // TODO(NODE-3485): Replace with MongoChangeStreamClosedError
+ throw new error_1.MongoAPIError(CHANGESTREAM_CLOSED_ERROR);
+ }
+ // a null change means the cursor has been notified, implicitly closing the change stream
+ if (change == null) {
+ // TODO(NODE-3485): Replace with MongoChangeStreamClosedError
+ throw new error_1.MongoRuntimeError(CHANGESTREAM_CLOSED_ERROR);
+ }
+ if (change && !change._id) {
+ throw new error_1.MongoChangeStreamError(NO_RESUME_TOKEN_ERROR);
+ }
+ // cache the resume token
+ this.cursor.cacheResumeToken(change._id);
+ // wipe the startAtOperationTime if there was one so that there won't be a conflict
+ // between resumeToken and startAtOperationTime if we need to reconnect the cursor
+ this.options.startAtOperationTime = undefined;
+ return change;
+ }
+ /** @internal */
+ _processErrorStreamMode(changeStreamError, cursorInitialized) {
+ // If the change stream has been closed explicitly, do not process error.
+ if (this.isClosed)
+ return;
+ if (cursorInitialized &&
+ ((0, error_1.isResumableError)(changeStreamError, this.cursor.maxWireVersion) ||
+ changeStreamError instanceof error_1.MongoOperationTimeoutError)) {
+ this._endStream();
+ this.cursor
+ .close()
+ .then(() => this._resume(changeStreamError), e => {
+ (0, utils_1.squashError)(e);
+ return this._resume(changeStreamError);
+ })
+ .then(() => {
+ if (changeStreamError instanceof error_1.MongoOperationTimeoutError)
+ this.emit(ChangeStream.ERROR, changeStreamError);
+ }, () => this._closeEmitterModeWithError(changeStreamError));
+ }
+ else {
+ this._closeEmitterModeWithError(changeStreamError);
+ }
+ }
+ /** @internal */
+ async _processErrorIteratorMode(changeStreamError, cursorInitialized) {
+ if (this.isClosed) {
+ // TODO(NODE-3485): Replace with MongoChangeStreamClosedError
+ throw new error_1.MongoAPIError(CHANGESTREAM_CLOSED_ERROR);
+ }
+ if (cursorInitialized &&
+ ((0, error_1.isResumableError)(changeStreamError, this.cursor.maxWireVersion) ||
+ changeStreamError instanceof error_1.MongoOperationTimeoutError)) {
+ try {
+ await this.cursor.close();
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ await this._resume(changeStreamError);
+ if (changeStreamError instanceof error_1.MongoOperationTimeoutError)
+ throw changeStreamError;
+ }
+ else {
+ try {
+ await this.close();
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ throw changeStreamError;
+ }
+ }
+ async _resume(changeStreamError) {
+ this.timeoutContext?.refresh();
+ const topology = (0, utils_1.getTopology)(this.parent);
+ try {
+ await topology.selectServer(this.cursor.readPreference, {
+ operationName: 'reconnect topology in change stream',
+ timeoutContext: this.timeoutContext,
+ deprioritizedServers: new server_selection_1.DeprioritizedServers()
+ });
+ this.cursor = this._createChangeStreamCursor(this.cursor.resumeOptions);
+ }
+ catch {
+ // if the topology can't reconnect, close the stream
+ await this.close();
+ throw changeStreamError;
+ }
+ }
+}
+exports.ChangeStream = ChangeStream;
+/**
+ * This function returns a list of options that are *not* supported by the $changeStream
+ * aggregation stage. This is best-effort - it uses the options "officially supported" by the driver
+ * to derive a list of known, unsupported options for the $changeStream stage.
+ *
+ * Notably, at runtime, users can still provide options unknown to the driver and the driver will
+ * *not* filter them out of the options object (see NODE-5510).
+ */
+function buildDisallowedChangeStreamOptions() {
+ const denyList = {
+ allowDiskUse: '',
+ authdb: '',
+ batchSize: '',
+ bsonRegExp: '',
+ bypassDocumentValidation: '',
+ bypassPinningCheck: '',
+ checkKeys: '',
+ collation: '',
+ comment: '',
+ cursor: '',
+ dbName: '',
+ enableUtf8Validation: '',
+ explain: '',
+ fieldsAsRaw: '',
+ hint: '',
+ ignoreUndefined: '',
+ let: '',
+ maxAwaitTimeMS: '',
+ maxTimeMS: '',
+ omitMaxTimeMS: '',
+ out: '',
+ promoteBuffers: '',
+ promoteLongs: '',
+ promoteValues: '',
+ raw: '',
+ rawData: '',
+ readConcern: '',
+ readPreference: '',
+ serializeFunctions: '',
+ session: '',
+ timeoutContext: '',
+ timeoutMS: '',
+ timeoutMode: '',
+ useBigInt64: '',
+ willRetryWrite: '',
+ writeConcern: ''
+ };
+ return new Set(Object.keys(denyList));
+}
+//# sourceMappingURL=change_stream.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/change_stream.js.map b/node_modules/mongodb/lib/change_stream.js.map
new file mode 100644
index 00000000..8cacb78b
--- /dev/null
+++ b/node_modules/mongodb/lib/change_stream.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"change_stream.js","sourceRoot":"","sources":["../src/change_stream.ts"],"names":[],"mappings":";;;AAuCA,4CAIC;AAxCD,6CAA0C;AAC1C,2CAAoG;AACpG,8DAAgE;AAChE,wEAAmG;AACnG,6BAA0B;AAC1B,mCAOiB;AACjB,iDAA6C;AAC7C,+CAAoE;AAGpE,8DAA+D;AAE/D,uCAAoE;AACpE,mCAA2F;AAE3F,MAAM,mBAAmB,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC,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E,EAAE;QAClB,kBAAkB,EAAE,EAAE;QACtB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE;QAClB,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,EAAE;QACf,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,EAAE;KACjB,CAAC;IAEF,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js b/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js
new file mode 100644
index 00000000..6f8c1966
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js
@@ -0,0 +1,281 @@
+"use strict";
+var _a;
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AutoEncrypter = exports.AutoEncryptionLoggerLevel = void 0;
+const net = require("net");
+const bson_1 = require("../bson");
+const constants_1 = require("../constants");
+const deps_1 = require("../deps");
+const error_1 = require("../error");
+const mongo_client_1 = require("../mongo_client");
+const utils_1 = require("../utils");
+const client_encryption_1 = require("./client_encryption");
+const errors_1 = require("./errors");
+const mongocryptd_manager_1 = require("./mongocryptd_manager");
+const providers_1 = require("./providers");
+const state_machine_1 = require("./state_machine");
+/** @public */
+exports.AutoEncryptionLoggerLevel = Object.freeze({
+ FatalError: 0,
+ Error: 1,
+ Warning: 2,
+ Info: 3,
+ Trace: 4
+});
+/**
+ * @internal An internal class to be used by the driver for auto encryption
+ * **NOTE**: Not meant to be instantiated directly, this is for internal use only.
+ */
+class AutoEncrypter {
+ static { _a = constants_1.kDecorateResult; }
+ /** @internal */
+ static getMongoCrypt() {
+ const encryption = (0, deps_1.getMongoDBClientEncryption)();
+ if ('kModuleError' in encryption) {
+ throw encryption.kModuleError;
+ }
+ return encryption.MongoCrypt;
+ }
+ /**
+ * Create an AutoEncrypter
+ *
+ * **Note**: Do not instantiate this class directly. Rather, supply the relevant options to a MongoClient
+ *
+ * **Note**: Supplying `options.schemaMap` provides more security than relying on JSON Schemas obtained from the server.
+ * It protects against a malicious server advertising a false JSON Schema, which could trick the client into sending unencrypted data that should be encrypted.
+ * Schemas supplied in the schemaMap only apply to configuring automatic encryption for Client-Side Field Level Encryption.
+ * Other validation rules in the JSON schema will not be enforced by the driver and will result in an error.
+ *
+ * @example Create an AutoEncrypter that makes use of mongocryptd
+ * ```ts
+ * // Enabling autoEncryption via a MongoClient using mongocryptd
+ * const { MongoClient } = require('mongodb');
+ * const client = new MongoClient(URL, {
+ * autoEncryption: {
+ * kmsProviders: {
+ * aws: {
+ * accessKeyId: AWS_ACCESS_KEY,
+ * secretAccessKey: AWS_SECRET_KEY
+ * }
+ * }
+ * }
+ * });
+ * ```
+ *
+ * await client.connect();
+ * // From here on, the client will be encrypting / decrypting automatically
+ * @example Create an AutoEncrypter that makes use of libmongocrypt's CSFLE shared library
+ * ```ts
+ * // Enabling autoEncryption via a MongoClient using CSFLE shared library
+ * const { MongoClient } = require('mongodb');
+ * const client = new MongoClient(URL, {
+ * autoEncryption: {
+ * kmsProviders: {
+ * aws: {}
+ * },
+ * extraOptions: {
+ * cryptSharedLibPath: '/path/to/local/crypt/shared/lib',
+ * cryptSharedLibRequired: true
+ * }
+ * }
+ * });
+ * ```
+ *
+ * await client.connect();
+ * // From here on, the client will be encrypting / decrypting automatically
+ */
+ constructor(client, options) {
+ /**
+ * Used by devtools to enable decorating decryption results.
+ *
+ * When set and enabled, `decrypt` will automatically recursively
+ * traverse a decrypted document and if a field has been decrypted,
+ * it will mark it as decrypted. Compass uses this to determine which
+ * fields were decrypted.
+ */
+ this[_a] = false;
+ this._client = client;
+ this._bypassEncryption = options.bypassAutoEncryption === true;
+ this._keyVaultNamespace = options.keyVaultNamespace || 'admin.datakeys';
+ this._keyVaultClient = options.keyVaultClient || client;
+ this._metaDataClient = options.metadataClient || client;
+ this._proxyOptions = options.proxyOptions || {};
+ this._tlsOptions = options.tlsOptions || {};
+ this._kmsProviders = options.kmsProviders || {};
+ this._credentialProviders = options.credentialProviders;
+ if (options.credentialProviders?.aws && !(0, providers_1.isEmptyCredentials)('aws', this._kmsProviders)) {
+ throw new errors_1.MongoCryptInvalidArgumentError('Can only provide a custom AWS credential provider when the state machine is configured for automatic AWS credential fetching');
+ }
+ const mongoCryptOptions = {
+ errorWrapper: errors_1.defaultErrorWrapper
+ };
+ if (options.schemaMap) {
+ if (bson_1.ByteUtils.isUint8Array(options.schemaMap)) {
+ mongoCryptOptions.schemaMap = options.schemaMap;
+ }
+ else {
+ mongoCryptOptions.schemaMap = (0, bson_1.serialize)(options.schemaMap);
+ }
+ }
+ if (options.encryptedFieldsMap) {
+ if (bson_1.ByteUtils.isUint8Array(options.encryptedFieldsMap)) {
+ mongoCryptOptions.encryptedFieldsMap = options.encryptedFieldsMap;
+ }
+ else {
+ mongoCryptOptions.encryptedFieldsMap = (0, bson_1.serialize)(options.encryptedFieldsMap);
+ }
+ }
+ if (bson_1.ByteUtils.isUint8Array(this._kmsProviders)) {
+ mongoCryptOptions.kmsProviders = this._kmsProviders;
+ }
+ else {
+ mongoCryptOptions.kmsProviders = (0, bson_1.serialize)(this._kmsProviders);
+ }
+ if (options.options?.logger) {
+ mongoCryptOptions.logger = options.options.logger;
+ }
+ if (options.extraOptions && options.extraOptions.cryptSharedLibPath) {
+ mongoCryptOptions.cryptSharedLibPath = options.extraOptions.cryptSharedLibPath;
+ }
+ if (options.bypassQueryAnalysis) {
+ mongoCryptOptions.bypassQueryAnalysis = options.bypassQueryAnalysis;
+ }
+ if (options.keyExpirationMS != null) {
+ mongoCryptOptions.keyExpirationMS = options.keyExpirationMS;
+ }
+ this._bypassMongocryptdAndCryptShared = this._bypassEncryption || !!options.bypassQueryAnalysis;
+ if (options.extraOptions && options.extraOptions.cryptSharedLibSearchPaths) {
+ // Only for driver testing
+ mongoCryptOptions.cryptSharedLibSearchPaths = options.extraOptions.cryptSharedLibSearchPaths;
+ }
+ else if (!this._bypassMongocryptdAndCryptShared) {
+ mongoCryptOptions.cryptSharedLibSearchPaths = ['$SYSTEM'];
+ }
+ const MongoCrypt = AutoEncrypter.getMongoCrypt();
+ this._mongocrypt = new MongoCrypt(mongoCryptOptions);
+ this._contextCounter = 0;
+ if (options.extraOptions &&
+ options.extraOptions.cryptSharedLibRequired &&
+ !this.cryptSharedLibVersionInfo) {
+ throw new errors_1.MongoCryptInvalidArgumentError('`cryptSharedLibRequired` set but no crypt_shared library loaded');
+ }
+ // Only instantiate mongocryptd manager/client once we know for sure
+ // that we are not using the CSFLE shared library.
+ if (!this._bypassMongocryptdAndCryptShared && !this.cryptSharedLibVersionInfo) {
+ this._mongocryptdManager = new mongocryptd_manager_1.MongocryptdManager(options.extraOptions);
+ const clientOptions = {
+ serverSelectionTimeoutMS: 10000
+ };
+ if ((options.extraOptions == null || typeof options.extraOptions.mongocryptdURI !== 'string') &&
+ !net.getDefaultAutoSelectFamily) {
+ // Only set family if autoSelectFamily options are not supported.
+ clientOptions.family = 4;
+ }
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore: TS complains as this always returns true on versions where it is present.
+ if (net.getDefaultAutoSelectFamily) {
+ // AutoEncrypter is made inside of MongoClient constructor while options are being parsed,
+ // we do not have access to the options that are in progress.
+ // TODO(NODE-6449): AutoEncrypter does not use client options for autoSelectFamily
+ Object.assign(clientOptions, (0, client_encryption_1.autoSelectSocketOptions)(this._client.s?.options ?? {}));
+ }
+ this._mongocryptdClient = new mongo_client_1.MongoClient(this._mongocryptdManager.uri, clientOptions);
+ }
+ }
+ /**
+ * Initializes the auto encrypter by spawning a mongocryptd and connecting to it.
+ *
+ * This function is a no-op when bypassSpawn is set or the crypt shared library is used.
+ */
+ async init() {
+ if (this._bypassMongocryptdAndCryptShared || this.cryptSharedLibVersionInfo) {
+ return;
+ }
+ if (!this._mongocryptdManager) {
+ throw new error_1.MongoRuntimeError('Reached impossible state: mongocryptdManager is undefined when neither bypassSpawn nor the shared lib are specified.');
+ }
+ if (!this._mongocryptdClient) {
+ throw new error_1.MongoRuntimeError('Reached impossible state: mongocryptdClient is undefined when neither bypassSpawn nor the shared lib are specified.');
+ }
+ if (!this._mongocryptdManager.bypassSpawn) {
+ await this._mongocryptdManager.spawn();
+ }
+ try {
+ const client = await this._mongocryptdClient.connect();
+ return client;
+ }
+ catch (error) {
+ throw new error_1.MongoRuntimeError('Unable to connect to `mongocryptd`, please make sure it is running or in your PATH for auto-spawn', { cause: error });
+ }
+ }
+ /**
+ * Cleans up the `_mongocryptdClient`, if present.
+ */
+ async close() {
+ await this._mongocryptdClient?.close();
+ }
+ /**
+ * Encrypt a command for a given namespace.
+ */
+ async encrypt(ns, cmd, options = {}) {
+ options.signal?.throwIfAborted();
+ if (this._bypassEncryption) {
+ // If `bypassAutoEncryption` has been specified, don't encrypt
+ return cmd;
+ }
+ const commandBuffer = (0, bson_1.serialize)(cmd, options);
+ const context = this._mongocrypt.makeEncryptionContext(utils_1.MongoDBCollectionNamespace.fromString(ns).db, commandBuffer);
+ context.id = this._contextCounter++;
+ context.ns = ns;
+ context.document = cmd;
+ const stateMachine = new state_machine_1.StateMachine({
+ promoteValues: false,
+ promoteLongs: false,
+ proxyOptions: this._proxyOptions,
+ tlsOptions: this._tlsOptions,
+ socketOptions: (0, client_encryption_1.autoSelectSocketOptions)(this._client.s.options)
+ });
+ return (0, bson_1.deserialize)(await stateMachine.execute(this, context, options), {
+ promoteValues: false,
+ promoteLongs: false
+ });
+ }
+ /**
+ * Decrypt a command response
+ */
+ async decrypt(response, options = {}) {
+ options.signal?.throwIfAborted();
+ const context = this._mongocrypt.makeDecryptionContext(response);
+ context.id = this._contextCounter++;
+ const stateMachine = new state_machine_1.StateMachine({
+ ...options,
+ proxyOptions: this._proxyOptions,
+ tlsOptions: this._tlsOptions,
+ socketOptions: (0, client_encryption_1.autoSelectSocketOptions)(this._client.s.options)
+ });
+ return await stateMachine.execute(this, context, options);
+ }
+ /**
+ * Ask the user for KMS credentials.
+ *
+ * This returns anything that looks like the kmsProviders original input
+ * option. It can be empty, and any provider specified here will override
+ * the original ones.
+ */
+ async askForKMSCredentials() {
+ return await (0, providers_1.refreshKMSCredentials)(this._kmsProviders, this._credentialProviders);
+ }
+ /**
+ * Return the current libmongocrypt's CSFLE shared library version
+ * as `{ version: bigint, versionStr: string }`, or `null` if no CSFLE
+ * shared library was loaded.
+ */
+ get cryptSharedLibVersionInfo() {
+ return this._mongocrypt.cryptSharedLibVersionInfo;
+ }
+ static get libmongocryptVersion() {
+ return AutoEncrypter.getMongoCrypt().libmongocryptVersion;
+ }
+}
+exports.AutoEncrypter = AutoEncrypter;
+//# sourceMappingURL=auto_encrypter.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js.map b/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js.map
new file mode 100644
index 00000000..01ee7b78
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"auto_encrypter.js","sourceRoot":"","sources":["../../src/client-side-encryption/auto_encrypter.ts"],"names":[],"mappings":";;;;AACA,2BAA2B;AAE3B,kCAA2E;AAE3E,4CAA+C;AAC/C,kCAAqD;AACrD,oCAA6C;AAC7C,kDAAuE;AAEvE,oCAAsD;AACtD,2DAA8D;AAC9D,qCAA+E;AAC/E,+DAA2D;AAC3D,2CAKqB;AACrB,mDAAwE;AAsGxE,cAAc;AACD,QAAA,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;IACrD,UAAU,EAAE,CAAC;IACb,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACA,CAAC,CAAC;AAiBZ;;;GAGG;AACH,MAAa,aAAa;kBA2BvB,2BAAe;IAEhB,gBAAgB;IAChB,MAAM,CAAC,aAAa;QAClB,MAAM,UAAU,GAAG,IAAA,iCAA0B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AAM,EAAE,cAAc,EAAE,CAAC;QAEjC,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAEjE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAEpC,MAAM,YAAY,GAAG,IAAI,4BAAY,CAAC;YACpC,GAAG,OAAO;YACV,YAAY,EAAE,IAAI,CAAC,aAAa;YAChC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,aAAa,EAAE,IAAA,2CAAuB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;SAC/D,CAAC,CAAC;QAEH,OAAO,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,oBAAoB;QACxB,OAAO,MAAM,IAAA,iCAAqB,EAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACpF,CAAC;IAED;;;;OAIG;IACH,IAAI,yBAAyB;QAC3B,OAAO,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;IACpD,CAAC;IAED,MAAM,KAAK,oBAAoB;QAC7B,OAAO,aAAa,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC;IAC5D,CAAC;CACF;AApUD,sCAoUC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/client_encryption.js b/node_modules/mongodb/lib/client-side-encryption/client_encryption.js
new file mode 100644
index 00000000..22e54ad1
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/client_encryption.js
@@ -0,0 +1,607 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ClientEncryption = void 0;
+exports.autoSelectSocketOptions = autoSelectSocketOptions;
+const bson_1 = require("../bson");
+const deps_1 = require("../deps");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const errors_1 = require("./errors");
+const index_1 = require("./providers/index");
+const state_machine_1 = require("./state_machine");
+/**
+ * @public
+ * The public interface for explicit in-use encryption
+ */
+class ClientEncryption {
+ /** @internal */
+ static getMongoCrypt() {
+ const encryption = (0, deps_1.getMongoDBClientEncryption)();
+ if ('kModuleError' in encryption) {
+ throw encryption.kModuleError;
+ }
+ return encryption.MongoCrypt;
+ }
+ /**
+ * Create a new encryption instance
+ *
+ * @example
+ * ```ts
+ * new ClientEncryption(mongoClient, {
+ * keyVaultNamespace: 'client.encryption',
+ * kmsProviders: {
+ * local: {
+ * key: masterKey // The master key used for encryption/decryption. A 96-byte long Buffer
+ * }
+ * }
+ * });
+ * ```
+ *
+ * @example
+ * ```ts
+ * new ClientEncryption(mongoClient, {
+ * keyVaultNamespace: 'client.encryption',
+ * kmsProviders: {
+ * aws: {
+ * accessKeyId: AWS_ACCESS_KEY,
+ * secretAccessKey: AWS_SECRET_KEY
+ * }
+ * }
+ * });
+ * ```
+ */
+ constructor(client, options) {
+ this._client = client;
+ this._proxyOptions = options.proxyOptions ?? {};
+ this._tlsOptions = options.tlsOptions ?? {};
+ this._kmsProviders = options.kmsProviders || {};
+ const { timeoutMS } = (0, utils_1.resolveTimeoutOptions)(client, options);
+ this._timeoutMS = timeoutMS;
+ this._credentialProviders = options.credentialProviders;
+ if (options.credentialProviders?.aws && !(0, index_1.isEmptyCredentials)('aws', this._kmsProviders)) {
+ throw new errors_1.MongoCryptInvalidArgumentError('Can only provide a custom AWS credential provider when the state machine is configured for automatic AWS credential fetching');
+ }
+ if (options.keyVaultNamespace == null) {
+ throw new errors_1.MongoCryptInvalidArgumentError('Missing required option `keyVaultNamespace`');
+ }
+ const mongoCryptOptions = {
+ ...options,
+ kmsProviders: (0, bson_1.serialize)(this._kmsProviders),
+ errorWrapper: errors_1.defaultErrorWrapper
+ };
+ this._keyVaultNamespace = options.keyVaultNamespace;
+ this._keyVaultClient = options.keyVaultClient || client;
+ const MongoCrypt = ClientEncryption.getMongoCrypt();
+ this._mongoCrypt = new MongoCrypt(mongoCryptOptions);
+ }
+ /**
+ * Creates a data key used for explicit encryption and inserts it into the key vault namespace
+ *
+ * @example
+ * ```ts
+ * // Using async/await to create a local key
+ * const dataKeyId = await clientEncryption.createDataKey('local');
+ * ```
+ *
+ * @example
+ * ```ts
+ * // Using async/await to create an aws key
+ * const dataKeyId = await clientEncryption.createDataKey('aws', {
+ * masterKey: {
+ * region: 'us-east-1',
+ * key: 'xxxxxxxxxxxxxx' // CMK ARN here
+ * }
+ * });
+ * ```
+ *
+ * @example
+ * ```ts
+ * // Using async/await to create an aws key with a keyAltName
+ * const dataKeyId = await clientEncryption.createDataKey('aws', {
+ * masterKey: {
+ * region: 'us-east-1',
+ * key: 'xxxxxxxxxxxxxx' // CMK ARN here
+ * },
+ * keyAltNames: [ 'mySpecialKey' ]
+ * });
+ * ```
+ */
+ async createDataKey(provider, options = {}) {
+ if (options.keyAltNames && !Array.isArray(options.keyAltNames)) {
+ throw new errors_1.MongoCryptInvalidArgumentError(`Option "keyAltNames" must be an array of strings, but was of type ${typeof options.keyAltNames}.`);
+ }
+ let keyAltNames = undefined;
+ if (options.keyAltNames && options.keyAltNames.length > 0) {
+ keyAltNames = options.keyAltNames.map((keyAltName, i) => {
+ if (typeof keyAltName !== 'string') {
+ throw new errors_1.MongoCryptInvalidArgumentError(`Option "keyAltNames" must be an array of strings, but item at index ${i} was of type ${typeof keyAltName}`);
+ }
+ return (0, bson_1.serialize)({ keyAltName });
+ });
+ }
+ let keyMaterial = undefined;
+ if (options.keyMaterial) {
+ keyMaterial = (0, bson_1.serialize)({ keyMaterial: options.keyMaterial });
+ }
+ const dataKeyBson = (0, bson_1.serialize)({
+ provider,
+ ...options.masterKey
+ });
+ const context = this._mongoCrypt.makeDataKeyContext(dataKeyBson, {
+ keyAltNames,
+ keyMaterial
+ });
+ const stateMachine = new state_machine_1.StateMachine({
+ proxyOptions: this._proxyOptions,
+ tlsOptions: this._tlsOptions,
+ socketOptions: autoSelectSocketOptions(this._client.s.options)
+ });
+ const timeoutContext = options?.timeoutContext ??
+ timeout_1.TimeoutContext.create((0, utils_1.resolveTimeoutOptions)(this._client, { timeoutMS: this._timeoutMS }));
+ const dataKey = (0, bson_1.deserialize)(await stateMachine.execute(this, context, { timeoutContext }));
+ const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);
+ const { insertedId } = await this._keyVaultClient
+ .db(dbName)
+ .collection(collectionName)
+ .insertOne(dataKey, {
+ writeConcern: { w: 'majority' },
+ timeoutMS: timeoutContext?.csotEnabled()
+ ? timeoutContext?.getRemainingTimeMSOrThrow()
+ : undefined
+ });
+ return insertedId;
+ }
+ /**
+ * Searches the keyvault for any data keys matching the provided filter. If there are matches, rewrapManyDataKey then attempts to re-wrap the data keys using the provided options.
+ *
+ * If no matches are found, then no bulk write is performed.
+ *
+ * @example
+ * ```ts
+ * // rewrapping all data data keys (using a filter that matches all documents)
+ * const filter = {};
+ *
+ * const result = await clientEncryption.rewrapManyDataKey(filter);
+ * if (result.bulkWriteResult != null) {
+ * // keys were re-wrapped, results will be available in the bulkWrite object.
+ * }
+ * ```
+ *
+ * @example
+ * ```ts
+ * // attempting to rewrap all data keys with no matches
+ * const filter = { _id: new Binary() } // assume _id matches no documents in the database
+ * const result = await clientEncryption.rewrapManyDataKey(filter);
+ *
+ * if (result.bulkWriteResult == null) {
+ * // no keys matched, `bulkWriteResult` does not exist on the result object
+ * }
+ * ```
+ */
+ async rewrapManyDataKey(filter, options) {
+ let keyEncryptionKeyBson = undefined;
+ if (options) {
+ const keyEncryptionKey = Object.assign({ provider: options.provider }, options.masterKey);
+ keyEncryptionKeyBson = (0, bson_1.serialize)(keyEncryptionKey);
+ }
+ const filterBson = (0, bson_1.serialize)(filter);
+ const context = this._mongoCrypt.makeRewrapManyDataKeyContext(filterBson, keyEncryptionKeyBson);
+ const stateMachine = new state_machine_1.StateMachine({
+ proxyOptions: this._proxyOptions,
+ tlsOptions: this._tlsOptions,
+ socketOptions: autoSelectSocketOptions(this._client.s.options)
+ });
+ const timeoutContext = timeout_1.TimeoutContext.create((0, utils_1.resolveTimeoutOptions)(this._client, { timeoutMS: this._timeoutMS }));
+ const { v: dataKeys } = (0, bson_1.deserialize)(await stateMachine.execute(this, context, { timeoutContext }));
+ if (dataKeys.length === 0) {
+ return {};
+ }
+ const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);
+ const replacements = dataKeys.map((key) => ({
+ updateOne: {
+ filter: { _id: key._id },
+ update: {
+ $set: {
+ masterKey: key.masterKey,
+ keyMaterial: key.keyMaterial
+ },
+ $currentDate: {
+ updateDate: true
+ }
+ }
+ }
+ }));
+ const result = await this._keyVaultClient
+ .db(dbName)
+ .collection(collectionName)
+ .bulkWrite(replacements, {
+ writeConcern: { w: 'majority' },
+ timeoutMS: timeoutContext.csotEnabled() ? timeoutContext?.remainingTimeMS : undefined
+ });
+ return { bulkWriteResult: result };
+ }
+ /**
+ * Deletes the key with the provided id from the keyvault, if it exists.
+ *
+ * @example
+ * ```ts
+ * // delete a key by _id
+ * const id = new Binary(); // id is a bson binary subtype 4 object
+ * const { deletedCount } = await clientEncryption.deleteKey(id);
+ *
+ * if (deletedCount != null && deletedCount > 0) {
+ * // successful deletion
+ * }
+ * ```
+ *
+ */
+ async deleteKey(_id) {
+ const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);
+ return await this._keyVaultClient
+ .db(dbName)
+ .collection(collectionName)
+ .deleteOne({ _id }, { writeConcern: { w: 'majority' }, timeoutMS: this._timeoutMS });
+ }
+ /**
+ * Finds all the keys currently stored in the keyvault.
+ *
+ * This method will not throw.
+ *
+ * @returns a FindCursor over all keys in the keyvault.
+ * @example
+ * ```ts
+ * // fetching all keys
+ * const keys = await clientEncryption.getKeys().toArray();
+ * ```
+ */
+ getKeys() {
+ const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);
+ return this._keyVaultClient
+ .db(dbName)
+ .collection(collectionName)
+ .find({}, { readConcern: { level: 'majority' }, timeoutMS: this._timeoutMS });
+ }
+ /**
+ * Finds a key in the keyvault with the specified _id.
+ *
+ * Returns a promise that either resolves to a {@link DataKey} if a document matches the key or null if no documents
+ * match the id. The promise rejects with an error if an error is thrown.
+ * @example
+ * ```ts
+ * // getting a key by id
+ * const id = new Binary(); // id is a bson binary subtype 4 object
+ * const key = await clientEncryption.getKey(id);
+ * if (!key) {
+ * // key is null if there was no matching key
+ * }
+ * ```
+ */
+ async getKey(_id) {
+ const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);
+ return await this._keyVaultClient
+ .db(dbName)
+ .collection(collectionName)
+ .findOne({ _id }, { readConcern: { level: 'majority' }, timeoutMS: this._timeoutMS });
+ }
+ /**
+ * Finds a key in the keyvault which has the specified keyAltName.
+ *
+ * @param keyAltName - a keyAltName to search for a key
+ * @returns Returns a promise that either resolves to a {@link DataKey} if a document matches the key or null if no documents
+ * match the keyAltName. The promise rejects with an error if an error is thrown.
+ * @example
+ * ```ts
+ * // get a key by alt name
+ * const keyAltName = 'keyAltName';
+ * const key = await clientEncryption.getKeyByAltName(keyAltName);
+ * if (!key) {
+ * // key is null if there is no matching key
+ * }
+ * ```
+ */
+ async getKeyByAltName(keyAltName) {
+ const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);
+ return await this._keyVaultClient
+ .db(dbName)
+ .collection(collectionName)
+ .findOne({ keyAltNames: keyAltName }, { readConcern: { level: 'majority' }, timeoutMS: this._timeoutMS });
+ }
+ /**
+ * Adds a keyAltName to a key identified by the provided _id.
+ *
+ * This method resolves to/returns the *old* key value (prior to adding the new altKeyName).
+ *
+ * @param _id - The id of the document to update.
+ * @param keyAltName - a keyAltName to search for a key
+ * @returns Returns a promise that either resolves to a {@link DataKey} if a document matches the key or null if no documents
+ * match the id. The promise rejects with an error if an error is thrown.
+ * @example
+ * ```ts
+ * // adding an keyAltName to a data key
+ * const id = new Binary(); // id is a bson binary subtype 4 object
+ * const keyAltName = 'keyAltName';
+ * const oldKey = await clientEncryption.addKeyAltName(id, keyAltName);
+ * if (!oldKey) {
+ * // null is returned if there is no matching document with an id matching the supplied id
+ * }
+ * ```
+ */
+ async addKeyAltName(_id, keyAltName) {
+ const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);
+ const value = await this._keyVaultClient
+ .db(dbName)
+ .collection(collectionName)
+ .findOneAndUpdate({ _id }, { $addToSet: { keyAltNames: keyAltName } }, { writeConcern: { w: 'majority' }, returnDocument: 'before', timeoutMS: this._timeoutMS });
+ return value;
+ }
+ /**
+ * Adds a keyAltName to a key identified by the provided _id.
+ *
+ * This method resolves to/returns the *old* key value (prior to removing the new altKeyName).
+ *
+ * If the removed keyAltName is the last keyAltName for that key, the `altKeyNames` property is unset from the document.
+ *
+ * @param _id - The id of the document to update.
+ * @param keyAltName - a keyAltName to search for a key
+ * @returns Returns a promise that either resolves to a {@link DataKey} if a document matches the key or null if no documents
+ * match the id. The promise rejects with an error if an error is thrown.
+ * @example
+ * ```ts
+ * // removing a key alt name from a data key
+ * const id = new Binary(); // id is a bson binary subtype 4 object
+ * const keyAltName = 'keyAltName';
+ * const oldKey = await clientEncryption.removeKeyAltName(id, keyAltName);
+ *
+ * if (!oldKey) {
+ * // null is returned if there is no matching document with an id matching the supplied id
+ * }
+ * ```
+ */
+ async removeKeyAltName(_id, keyAltName) {
+ const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);
+ const pipeline = [
+ {
+ $set: {
+ keyAltNames: {
+ $cond: [
+ {
+ $eq: ['$keyAltNames', [keyAltName]]
+ },
+ '$$REMOVE',
+ {
+ $filter: {
+ input: '$keyAltNames',
+ cond: {
+ $ne: ['$$this', keyAltName]
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ];
+ const value = await this._keyVaultClient
+ .db(dbName)
+ .collection(collectionName)
+ .findOneAndUpdate({ _id }, pipeline, {
+ writeConcern: { w: 'majority' },
+ returnDocument: 'before',
+ timeoutMS: this._timeoutMS
+ });
+ return value;
+ }
+ /**
+ * A convenience method for creating an encrypted collection.
+ * This method will create data keys for any encryptedFields that do not have a `keyId` defined
+ * and then create a new collection with the full set of encryptedFields.
+ *
+ * @param db - A Node.js driver Db object with which to create the collection
+ * @param name - The name of the collection to be created
+ * @param options - Options for createDataKey and for createCollection
+ * @returns created collection and generated encryptedFields
+ * @throws MongoCryptCreateDataKeyError - If part way through the process a createDataKey invocation fails, an error will be rejected that has the partial `encryptedFields` that were created.
+ * @throws MongoCryptCreateEncryptedCollectionError - If creating the collection fails, an error will be rejected that has the entire `encryptedFields` that were created.
+ */
+ async createEncryptedCollection(db, name, options) {
+ const { provider, masterKey, createCollectionOptions: { encryptedFields: { ...encryptedFields }, ...createCollectionOptions } } = options;
+ const timeoutContext = this._timeoutMS != null
+ ? timeout_1.TimeoutContext.create((0, utils_1.resolveTimeoutOptions)(this._client, { timeoutMS: this._timeoutMS }))
+ : undefined;
+ if (Array.isArray(encryptedFields.fields)) {
+ const createDataKeyPromises = encryptedFields.fields.map(async (field) => field == null || typeof field !== 'object' || field.keyId != null
+ ? field
+ : {
+ ...field,
+ keyId: await this.createDataKey(provider, {
+ masterKey,
+ // clone the timeoutContext
+ // in order to avoid sharing the same timeout for server selection and connection checkout across different concurrent operations
+ timeoutContext: timeoutContext?.csotEnabled() ? timeoutContext?.clone() : undefined
+ })
+ });
+ const createDataKeyResolutions = await Promise.allSettled(createDataKeyPromises);
+ encryptedFields.fields = createDataKeyResolutions.map((resolution, index) => resolution.status === 'fulfilled' ? resolution.value : encryptedFields.fields[index]);
+ const rejection = createDataKeyResolutions.find((result) => result.status === 'rejected');
+ if (rejection != null) {
+ throw new errors_1.MongoCryptCreateDataKeyError(encryptedFields, { cause: rejection.reason });
+ }
+ }
+ try {
+ const collection = await db.createCollection(name, {
+ ...createCollectionOptions,
+ encryptedFields,
+ timeoutMS: timeoutContext?.csotEnabled()
+ ? timeoutContext?.getRemainingTimeMSOrThrow()
+ : undefined
+ });
+ return { collection, encryptedFields };
+ }
+ catch (cause) {
+ throw new errors_1.MongoCryptCreateEncryptedCollectionError(encryptedFields, { cause });
+ }
+ }
+ /**
+ * Explicitly encrypt a provided value. Note that either `options.keyId` or `options.keyAltName` must
+ * be specified. Specifying both `options.keyId` and `options.keyAltName` is considered an error.
+ *
+ * @param value - The value that you wish to serialize. Must be of a type that can be serialized into BSON
+ * @param options -
+ * @returns a Promise that either resolves with the encrypted value, or rejects with an error.
+ *
+ * @example
+ * ```ts
+ * // Encryption with async/await api
+ * async function encryptMyData(value) {
+ * const keyId = await clientEncryption.createDataKey('local');
+ * return clientEncryption.encrypt(value, { keyId, algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' });
+ * }
+ * ```
+ *
+ * @example
+ * ```ts
+ * // Encryption using a keyAltName
+ * async function encryptMyData(value) {
+ * await clientEncryption.createDataKey('local', { keyAltNames: 'mySpecialKey' });
+ * return clientEncryption.encrypt(value, { keyAltName: 'mySpecialKey', algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' });
+ * }
+ * ```
+ */
+ async encrypt(value, options) {
+ return await this._encrypt(value, false, options);
+ }
+ /**
+ * Encrypts a Match Expression or Aggregate Expression to query a range index.
+ *
+ * Only supported when queryType is "range" and algorithm is "Range".
+ *
+ * @param expression - a BSON document of one of the following forms:
+ * 1. A Match Expression of this form:
+ * `{$and: [{: {$gt: }}, {: {$lt: }}]}`
+ * 2. An Aggregate Expression of this form:
+ * `{$and: [{$gt: [, ]}, {$lt: [, ]}]}`
+ *
+ * `$gt` may also be `$gte`. `$lt` may also be `$lte`.
+ *
+ * @param options -
+ * @returns Returns a Promise that either resolves with the encrypted value or rejects with an error.
+ */
+ async encryptExpression(expression, options) {
+ return await this._encrypt(expression, true, options);
+ }
+ /**
+ * Explicitly decrypt a provided encrypted value
+ *
+ * @param value - An encrypted value
+ * @returns a Promise that either resolves with the decrypted value, or rejects with an error
+ *
+ * @example
+ * ```ts
+ * // Decrypting value with async/await API
+ * async function decryptMyValue(value) {
+ * return clientEncryption.decrypt(value);
+ * }
+ * ```
+ */
+ async decrypt(value) {
+ const valueBuffer = (0, bson_1.serialize)({ v: value });
+ const context = this._mongoCrypt.makeExplicitDecryptionContext(valueBuffer);
+ const stateMachine = new state_machine_1.StateMachine({
+ proxyOptions: this._proxyOptions,
+ tlsOptions: this._tlsOptions,
+ socketOptions: autoSelectSocketOptions(this._client.s.options)
+ });
+ const timeoutContext = this._timeoutMS != null
+ ? timeout_1.TimeoutContext.create((0, utils_1.resolveTimeoutOptions)(this._client, { timeoutMS: this._timeoutMS }))
+ : undefined;
+ const { v } = (0, bson_1.deserialize)(await stateMachine.execute(this, context, { timeoutContext }));
+ return v;
+ }
+ /**
+ * @internal
+ * Ask the user for KMS credentials.
+ *
+ * This returns anything that looks like the kmsProviders original input
+ * option. It can be empty, and any provider specified here will override
+ * the original ones.
+ */
+ async askForKMSCredentials() {
+ return await (0, index_1.refreshKMSCredentials)(this._kmsProviders, this._credentialProviders);
+ }
+ static get libmongocryptVersion() {
+ return ClientEncryption.getMongoCrypt().libmongocryptVersion;
+ }
+ /**
+ * @internal
+ * A helper that perform explicit encryption of values and expressions.
+ * Explicitly encrypt a provided value. Note that either `options.keyId` or `options.keyAltName` must
+ * be specified. Specifying both `options.keyId` and `options.keyAltName` is considered an error.
+ *
+ * @param value - The value that you wish to encrypt. Must be of a type that can be serialized into BSON
+ * @param expressionMode - a boolean that indicates whether or not to encrypt the value as an expression
+ * @param options - options to pass to encrypt
+ * @returns the raw result of the call to stateMachine.execute(). When expressionMode is set to true, the return
+ * value will be a bson document. When false, the value will be a BSON Binary.
+ *
+ */
+ async _encrypt(value, expressionMode, options) {
+ const { algorithm, keyId, keyAltName, contentionFactor, queryType, rangeOptions, textOptions } = options;
+ const contextOptions = {
+ expressionMode,
+ algorithm
+ };
+ if (keyId) {
+ contextOptions.keyId = keyId.buffer;
+ }
+ if (keyAltName) {
+ if (keyId) {
+ throw new errors_1.MongoCryptInvalidArgumentError(`"options" cannot contain both "keyId" and "keyAltName"`);
+ }
+ if (typeof keyAltName !== 'string') {
+ throw new errors_1.MongoCryptInvalidArgumentError(`"options.keyAltName" must be of type string, but was of type ${typeof keyAltName}`);
+ }
+ contextOptions.keyAltName = (0, bson_1.serialize)({ keyAltName });
+ }
+ if (typeof contentionFactor === 'number' || typeof contentionFactor === 'bigint') {
+ contextOptions.contentionFactor = contentionFactor;
+ }
+ if (typeof queryType === 'string') {
+ contextOptions.queryType = queryType;
+ }
+ if (typeof rangeOptions === 'object') {
+ contextOptions.rangeOptions = (0, bson_1.serialize)(rangeOptions);
+ }
+ if (typeof textOptions === 'object') {
+ contextOptions.textOptions = (0, bson_1.serialize)(textOptions);
+ }
+ const valueBuffer = (0, bson_1.serialize)({ v: value });
+ const stateMachine = new state_machine_1.StateMachine({
+ proxyOptions: this._proxyOptions,
+ tlsOptions: this._tlsOptions,
+ socketOptions: autoSelectSocketOptions(this._client.s.options)
+ });
+ const context = this._mongoCrypt.makeExplicitEncryptionContext(valueBuffer, contextOptions);
+ const timeoutContext = this._timeoutMS != null
+ ? timeout_1.TimeoutContext.create((0, utils_1.resolveTimeoutOptions)(this._client, { timeoutMS: this._timeoutMS }))
+ : undefined;
+ const { v } = (0, bson_1.deserialize)(await stateMachine.execute(this, context, { timeoutContext }));
+ return v;
+ }
+}
+exports.ClientEncryption = ClientEncryption;
+/**
+ * Get the socket options from the client.
+ * @param baseOptions - The mongo client options.
+ * @returns ClientEncryptionSocketOptions
+ */
+function autoSelectSocketOptions(baseOptions) {
+ const options = { autoSelectFamily: true };
+ if ('autoSelectFamily' in baseOptions) {
+ options.autoSelectFamily = baseOptions.autoSelectFamily;
+ }
+ if ('autoSelectFamilyAttemptTimeout' in baseOptions) {
+ options.autoSelectFamilyAttemptTimeout = baseOptions.autoSelectFamilyAttemptTimeout;
+ }
+ return options;
+}
+//# sourceMappingURL=client_encryption.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/client_encryption.js.map b/node_modules/mongodb/lib/client-side-encryption/client_encryption.js.map
new file mode 100644
index 00000000..6b68bae2
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/client_encryption.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"client_encryption.js","sourceRoot":"","sources":["../../src/client-side-encryption/client_encryption.ts"],"names":[],"mappings":";;;AAgnCA,0DAWC;AArnCD,kCAQiB;AAMjB,kCAAqD;AAKrD,wCAAqE;AACrE,oCAA6E;AAC7E,qCAKkB;AAClB,6CAM2B;AAC3B,mDAIyB;AAiBzB;;;GAGG;AACH,MAAa,gBAAgB;IAsB3B,gBAAgB;IAChB,MAAM,CAAC,aAAa;QAClB,MAAM,UAAU,GAAG,IAAA,iCAA0B,GAAE,CAAC;QAChD,IAAI,cAAc,IAAI,UAAU,EAAE,CAAC;YACjC,MAAM,UAAU,CAAC,YAAY,CAAC;QAChC,CAAC;QACD,OAAO,UAAU,CAAC,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,YAAY,MAAmB,EAAE,OAAgC;QAC/D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC5C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;QAChD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,6BAAqB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7D,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,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AS,CAAC;QAChB,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,kBAAW,EAAC,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;QACzF,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAhuBD,4CAguBC;AA0UD;;;;GAIG;AACH,SAAgB,uBAAuB,CACrC,WAA+B;IAE/B,MAAM,OAAO,GAAkC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;IAC1E,IAAI,kBAAkB,IAAI,WAAW,EAAE,CAAC;QACtC,OAAO,CAAC,gBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;IAC1D,CAAC;IACD,IAAI,gCAAgC,IAAI,WAAW,EAAE,CAAC;QACpD,OAAO,CAAC,8BAA8B,GAAG,WAAW,CAAC,8BAA8B,CAAC;IACtF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/errors.js b/node_modules/mongodb/lib/client-side-encryption/errors.js
new file mode 100644
index 00000000..c6356dea
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/errors.js
@@ -0,0 +1,138 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongoCryptKMSRequestNetworkTimeoutError = exports.MongoCryptAzureKMSRequestError = exports.MongoCryptCreateEncryptedCollectionError = exports.MongoCryptCreateDataKeyError = exports.MongoCryptInvalidArgumentError = exports.defaultErrorWrapper = exports.MongoCryptError = void 0;
+const error_1 = require("../error");
+/**
+ * @public
+ * An error indicating that something went wrong specifically with MongoDB Client Encryption
+ */
+class MongoCryptError extends error_1.MongoError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options = {}) {
+ super(message, options);
+ }
+ get name() {
+ return 'MongoCryptError';
+ }
+}
+exports.MongoCryptError = MongoCryptError;
+const defaultErrorWrapper = (error) => new MongoCryptError(error.message, { cause: error });
+exports.defaultErrorWrapper = defaultErrorWrapper;
+/**
+ * @public
+ *
+ * An error indicating an invalid argument was provided to an encryption API.
+ */
+class MongoCryptInvalidArgumentError extends MongoCryptError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoCryptInvalidArgumentError';
+ }
+}
+exports.MongoCryptInvalidArgumentError = MongoCryptInvalidArgumentError;
+/**
+ * @public
+ * An error indicating that `ClientEncryption.createEncryptedCollection()` failed to create data keys
+ */
+class MongoCryptCreateDataKeyError extends MongoCryptError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(encryptedFields, { cause }) {
+ super(`Unable to complete creating data keys: ${cause.message}`, { cause });
+ this.encryptedFields = encryptedFields;
+ }
+ get name() {
+ return 'MongoCryptCreateDataKeyError';
+ }
+}
+exports.MongoCryptCreateDataKeyError = MongoCryptCreateDataKeyError;
+/**
+ * @public
+ * An error indicating that `ClientEncryption.createEncryptedCollection()` failed to create a collection
+ */
+class MongoCryptCreateEncryptedCollectionError extends MongoCryptError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(encryptedFields, { cause }) {
+ super(`Unable to create collection: ${cause.message}`, { cause });
+ this.encryptedFields = encryptedFields;
+ }
+ get name() {
+ return 'MongoCryptCreateEncryptedCollectionError';
+ }
+}
+exports.MongoCryptCreateEncryptedCollectionError = MongoCryptCreateEncryptedCollectionError;
+/**
+ * @public
+ * An error indicating that mongodb-client-encryption failed to auto-refresh Azure KMS credentials.
+ */
+class MongoCryptAzureKMSRequestError extends MongoCryptError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, body) {
+ super(message);
+ this.body = body;
+ }
+ get name() {
+ return 'MongoCryptAzureKMSRequestError';
+ }
+}
+exports.MongoCryptAzureKMSRequestError = MongoCryptAzureKMSRequestError;
+/** @public */
+class MongoCryptKMSRequestNetworkTimeoutError extends MongoCryptError {
+ get name() {
+ return 'MongoCryptKMSRequestNetworkTimeoutError';
+ }
+}
+exports.MongoCryptKMSRequestNetworkTimeoutError = MongoCryptKMSRequestNetworkTimeoutError;
+//# sourceMappingURL=errors.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/errors.js.map b/node_modules/mongodb/lib/client-side-encryption/errors.js.map
new file mode 100644
index 00000000..ecc9233c
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/errors.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/client-side-encryption/errors.ts"],"names":[],"mappings":";;;AACA,oCAAsC;AAEtC;;;GAGG;AACH,MAAa,eAAgB,SAAQ,kBAAU;IAC7C;;;;;;;;;;QAUI;IACJ,YAAY,OAAe,EAAE,UAA6B,EAAE;QAC1D,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,IAAa,IAAI;QACf,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAnBD,0CAmBC;AAEM,MAAM,mBAAmB,GAAG,CAAC,KAAY,EAAE,EAAE,CAClD,IAAI,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tBD,wEAsBC;AAED,cAAc;AACd,MAAa,uCAAwC,SAAQ,eAAe;IAC1E,IAAa,IAAI;QACf,OAAO,yCAAyC,CAAC;IACnD,CAAC;CACF;AAJD,0FAIC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js b/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js
new file mode 100644
index 00000000..4270a328
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js
@@ -0,0 +1,85 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongocryptdManager = void 0;
+const error_1 = require("../error");
+/**
+ * @internal
+ * An internal class that handles spawning a mongocryptd.
+ */
+class MongocryptdManager {
+ static { this.DEFAULT_MONGOCRYPTD_URI = 'mongodb://localhost:27020'; }
+ constructor(extraOptions = {}) {
+ this.spawnPath = '';
+ this.spawnArgs = [];
+ this.uri =
+ typeof extraOptions.mongocryptdURI === 'string' && extraOptions.mongocryptdURI.length > 0
+ ? extraOptions.mongocryptdURI
+ : MongocryptdManager.DEFAULT_MONGOCRYPTD_URI;
+ this.bypassSpawn = !!extraOptions.mongocryptdBypassSpawn;
+ if (Object.hasOwn(extraOptions, 'mongocryptdSpawnPath') && extraOptions.mongocryptdSpawnPath) {
+ this.spawnPath = extraOptions.mongocryptdSpawnPath;
+ }
+ if (Object.hasOwn(extraOptions, 'mongocryptdSpawnArgs') &&
+ Array.isArray(extraOptions.mongocryptdSpawnArgs)) {
+ this.spawnArgs = this.spawnArgs.concat(extraOptions.mongocryptdSpawnArgs);
+ }
+ if (this.spawnArgs
+ .filter(arg => typeof arg === 'string')
+ .every(arg => arg.indexOf('--idleShutdownTimeoutSecs') < 0)) {
+ this.spawnArgs.push('--idleShutdownTimeoutSecs', '60');
+ }
+ }
+ /**
+ * Will check to see if a mongocryptd is up. If it is not up, it will attempt
+ * to spawn a mongocryptd in a detached process, and then wait for it to be up.
+ */
+ async spawn() {
+ const cmdName = this.spawnPath || 'mongocryptd';
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ const { spawn } = require('child_process');
+ // Spawned with stdio: ignore and detached: true
+ // to ensure child can outlive parent.
+ this._child = spawn(cmdName, this.spawnArgs, {
+ stdio: 'ignore',
+ detached: true
+ });
+ this._child.on('error', () => {
+ // From the FLE spec:
+ // "The stdout and stderr of the spawned process MUST not be exposed in the driver
+ // (e.g. redirect to /dev/null). Users can pass the argument --logpath to
+ // extraOptions.mongocryptdSpawnArgs if they need to inspect mongocryptd logs.
+ // If spawning is necessary, the driver MUST spawn mongocryptd whenever server
+ // selection on the MongoClient to mongocryptd fails. If the MongoClient fails to
+ // connect after spawning, the server selection error is propagated to the user."
+ // The AutoEncrypter and MongoCryptdManager should work together to spawn
+ // mongocryptd whenever necessary. Additionally, the `mongocryptd` intentionally
+ // shuts down after 60s and gets respawned when necessary. We rely on server
+ // selection timeouts when connecting to the `mongocryptd` to inform users that something
+ // has been configured incorrectly. For those reasons, we suppress stderr from
+ // the `mongocryptd` process and immediately unref the process.
+ });
+ // unref child to remove handle from event loop
+ this._child.unref();
+ }
+ /**
+ * @returns the result of `fn` or rejects with an error.
+ */
+ async withRespawn(fn) {
+ try {
+ const result = await fn();
+ return result;
+ }
+ catch (err) {
+ // If we are not bypassing spawning, then we should retry once on a MongoTimeoutError (server selection error)
+ const shouldSpawn = err instanceof error_1.MongoNetworkTimeoutError && !this.bypassSpawn;
+ if (!shouldSpawn) {
+ throw err;
+ }
+ }
+ await this.spawn();
+ const result = await fn();
+ return result;
+ }
+}
+exports.MongocryptdManager = MongocryptdManager;
+//# sourceMappingURL=mongocryptd_manager.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js.map b/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js.map
new file mode 100644
index 00000000..fa5da130
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js.map
@@ -0,0 +1 @@
+{"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FH,gDA0FC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/providers/aws.js b/node_modules/mongodb/lib/client-side-encryption/providers/aws.js
new file mode 100644
index 00000000..4882003c
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/providers/aws.js
@@ -0,0 +1,23 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.loadAWSCredentials = loadAWSCredentials;
+const aws_temporary_credentials_1 = require("../../cmap/auth/aws_temporary_credentials");
+/**
+ * @internal
+ */
+async function loadAWSCredentials(kmsProviders, provider) {
+ const credentialProvider = new aws_temporary_credentials_1.AWSSDKCredentialProvider(provider);
+ // We shouldn't ever receive a response from the AWS SDK that doesn't have a `SecretAccessKey`
+ // or `AccessKeyId`. However, TS says these fields are optional. We provide empty strings
+ // and let libmongocrypt error if we're unable to fetch the required keys.
+ const { SecretAccessKey = '', AccessKeyId = '', Token } = await credentialProvider.getCredentials();
+ const aws = {
+ secretAccessKey: SecretAccessKey,
+ accessKeyId: AccessKeyId
+ };
+ // the AWS session token is only required for temporary credentials so only attach it to the
+ // result if it's present in the response from the aws sdk
+ Token != null && (aws.sessionToken = Token);
+ return { ...kmsProviders, aws };
+}
+//# sourceMappingURL=aws.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/providers/aws.js.map b/node_modules/mongodb/lib/client-side-encryption/providers/aws.js.map
new file mode 100644
index 00000000..3e466ea7
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/providers/aws.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"aws.js","sourceRoot":"","sources":["../../../src/client-side-encryption/providers/aws.ts"],"names":[],"mappings":";;AASA,gDAuBC;AAhCD,yFAGmD;AAGnD;;GAEG;AACI,KAAK,UAAU,kBAAkB,CACtC,YAA0B,EAC1B,QAAgC;IAEhC,MAAM,kBAAkB,GAAG,IAAI,oDAAwB,CAAC,QAAQ,CAAC,CAAC;IAElE,8FAA8F;IAC9F,2FAA2F;IAC3F,0EAA0E;IAC1E,MAAM,EACJ,eAAe,GAAG,EAAE,EACpB,WAAW,GAAG,EAAE,EAChB,KAAK,EACN,GAAG,MAAM,kBAAkB,CAAC,cAAc,EAAE,CAAC;IAC9C,MAAM,GAAG,GAAqC;QAC5C,eAAe,EAAE,eAAe;QAChC,WAAW,EAAE,WAAW;KACzB,CAAC;IACF,4FAA4F;IAC5F,0DAA0D;IAC1D,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;IAE5C,OAAO,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,CAAC;AAClC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/providers/azure.js b/node_modules/mongodb/lib/client-side-encryption/providers/azure.js
new file mode 100644
index 00000000..9829f154
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/providers/azure.js
@@ -0,0 +1,132 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.tokenCache = exports.AzureCredentialCache = exports.AZURE_BASE_URL = void 0;
+exports.addAzureParams = addAzureParams;
+exports.prepareRequest = prepareRequest;
+exports.fetchAzureKMSToken = fetchAzureKMSToken;
+exports.loadAzureCredentials = loadAzureCredentials;
+const error_1 = require("../../error");
+const utils_1 = require("../../utils");
+const errors_1 = require("../errors");
+const MINIMUM_TOKEN_REFRESH_IN_MILLISECONDS = 6000;
+/** Base URL for getting Azure tokens. */
+exports.AZURE_BASE_URL = 'http://169.254.169.254/metadata/identity/oauth2/token?';
+/**
+ * @internal
+ */
+class AzureCredentialCache {
+ constructor() {
+ this.cachedToken = null;
+ }
+ async getToken() {
+ if (this.cachedToken == null || this.needsRefresh(this.cachedToken)) {
+ this.cachedToken = await this._getToken();
+ }
+ return { accessToken: this.cachedToken.accessToken };
+ }
+ needsRefresh(token) {
+ const timeUntilExpirationMS = token.expiresOnTimestamp - Date.now();
+ return timeUntilExpirationMS <= MINIMUM_TOKEN_REFRESH_IN_MILLISECONDS;
+ }
+ /**
+ * exposed for testing
+ */
+ resetCache() {
+ this.cachedToken = null;
+ }
+ /**
+ * exposed for testing
+ */
+ _getToken() {
+ return fetchAzureKMSToken();
+ }
+}
+exports.AzureCredentialCache = AzureCredentialCache;
+/** @internal */
+exports.tokenCache = new AzureCredentialCache();
+/** @internal */
+async function parseResponse(response) {
+ const { status, body: rawBody } = response;
+ const body = (() => {
+ try {
+ return JSON.parse(rawBody);
+ }
+ catch {
+ throw new errors_1.MongoCryptAzureKMSRequestError('Malformed JSON body in GET request.');
+ }
+ })();
+ if (status !== 200) {
+ throw new errors_1.MongoCryptAzureKMSRequestError('Unable to complete request.', body);
+ }
+ if (!body.access_token) {
+ throw new errors_1.MongoCryptAzureKMSRequestError('Malformed response body - missing field `access_token`.');
+ }
+ if (!body.expires_in) {
+ throw new errors_1.MongoCryptAzureKMSRequestError('Malformed response body - missing field `expires_in`.');
+ }
+ const expiresInMS = Number(body.expires_in) * 1000;
+ if (Number.isNaN(expiresInMS)) {
+ throw new errors_1.MongoCryptAzureKMSRequestError('Malformed response body - unable to parse int from `expires_in` field.');
+ }
+ return {
+ accessToken: body.access_token,
+ expiresOnTimestamp: Date.now() + expiresInMS
+ };
+}
+/**
+ * @internal
+ * Get the Azure endpoint URL.
+ */
+function addAzureParams(url, resource, username) {
+ url.searchParams.append('api-version', '2018-02-01');
+ url.searchParams.append('resource', resource);
+ if (username) {
+ url.searchParams.append('client_id', username);
+ }
+ return url;
+}
+/**
+ * @internal
+ *
+ * parses any options provided by prose tests to `fetchAzureKMSToken` and merges them with
+ * the default values for headers and the request url.
+ */
+function prepareRequest(options) {
+ const url = new URL(options.url?.toString() ?? exports.AZURE_BASE_URL);
+ addAzureParams(url, 'https://vault.azure.net');
+ const headers = { ...options.headers, 'Content-Type': 'application/json', Metadata: true };
+ return { headers, url };
+}
+/**
+ * @internal
+ *
+ * `AzureKMSRequestOptions` allows prose tests to modify the http request sent to the idms
+ * servers. This is required to simulate different server conditions. No options are expected to
+ * be set outside of tests.
+ *
+ * exposed for CSFLE
+ * [prose test 18](https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#azure-imds-credentials)
+ */
+async function fetchAzureKMSToken(options = {}) {
+ const { headers, url } = prepareRequest(options);
+ try {
+ const response = await (0, utils_1.get)(url, { headers });
+ return await parseResponse(response);
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoNetworkTimeoutError) {
+ throw new errors_1.MongoCryptAzureKMSRequestError(`[Azure KMS] ${error.message}`);
+ }
+ throw error;
+ }
+}
+/**
+ * @internal
+ *
+ * @throws Will reject with a `MongoCryptError` if the http request fails or the http response is malformed.
+ */
+async function loadAzureCredentials(kmsProviders) {
+ const azure = await exports.tokenCache.getToken();
+ return { ...kmsProviders, azure };
+}
+//# sourceMappingURL=azure.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/providers/azure.js.map b/node_modules/mongodb/lib/client-side-encryption/providers/azure.js.map
new file mode 100644
index 00000000..1c555728
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/providers/azure.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"azure.js","sourceRoot":"","sources":["../../../src/client-side-encryption/providers/azure.ts"],"names":[],"mappings":";;;AA0HA,wCAOC;AAQD,wCAQC;AAYD,gDAaC;AAOD,oDAGC;AAnLD,uCAAuD;AACvD,uCAAkC;AAClC,sCAA2D;AAG3D,MAAM,qCAAqC,GAAG,IAAI,CAAC;AACnD,yCAAyC;AAC5B,QAAA,cAAc,GAAG,wDAAwD,CAAC;AAkBvF;;GAEG;AACH,MAAa,oBAAoB;IAAjC;QACE,gBAAW,GAAgC,IAAI,CAAC;IA4BlD,CAAC;IA1BC,KAAK,CAAC,QAAQ;QACZ,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACpE,IAAI,CAAC,WAAW,GAAG,MAAM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,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAA,WAAG,EAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7C,OAAO,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,gCAAwB,EAAE,CAAC;YAC9C,MAAM,IAAI,uCAA8B,CAAC,eAAe,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3E,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,oBAAoB,CAAC,YAA0B;IACnE,MAAM,KAAK,GAAG,MAAM,kBAAU,CAAC,QAAQ,EAAE,CAAC;IAC1C,OAAO,EAAE,GAAG,YAAY,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/providers/gcp.js b/node_modules/mongodb/lib/client-side-encryption/providers/gcp.js
new file mode 100644
index 00000000..7493adfb
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/providers/gcp.js
@@ -0,0 +1,16 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.loadGCPCredentials = loadGCPCredentials;
+const deps_1 = require("../../deps");
+/** @internal */
+async function loadGCPCredentials(kmsProviders) {
+ const gcpMetadata = (0, deps_1.getGcpMetadata)();
+ if ('kModuleError' in gcpMetadata) {
+ return kmsProviders;
+ }
+ const { access_token: accessToken } = await gcpMetadata.instance({
+ property: 'service-accounts/default/token'
+ });
+ return { ...kmsProviders, gcp: { accessToken } };
+}
+//# sourceMappingURL=gcp.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/providers/gcp.js.map b/node_modules/mongodb/lib/client-side-encryption/providers/gcp.js.map
new file mode 100644
index 00000000..a20cc7d2
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/providers/gcp.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"gcp.js","sourceRoot":"","sources":["../../../src/client-side-encryption/providers/gcp.ts"],"names":[],"mappings":";;AAIA,gDAWC;AAfD,qCAA4C;AAG5C,gBAAgB;AACT,KAAK,UAAU,kBAAkB,CAAC,YAA0B;IACjE,MAAM,WAAW,GAAG,IAAA,qBAAc,GAAE,CAAC;IAErC,IAAI,cAAc,IAAI,WAAW,EAAE,CAAC;QAClC,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,WAAW,CAAC,QAAQ,CAA2B;QACzF,QAAQ,EAAE,gCAAgC;KAC3C,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,EAAE,CAAC;AACnD,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/providers/index.js b/node_modules/mongodb/lib/client-side-encryption/providers/index.js
new file mode 100644
index 00000000..504d009d
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/providers/index.js
@@ -0,0 +1,43 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isEmptyCredentials = isEmptyCredentials;
+exports.refreshKMSCredentials = refreshKMSCredentials;
+const aws_1 = require("./aws");
+const azure_1 = require("./azure");
+const gcp_1 = require("./gcp");
+/**
+ * Auto credential fetching should only occur when the provider is defined on the kmsProviders map
+ * and the settings are an empty object.
+ *
+ * This is distinct from a nullish provider key.
+ *
+ * @internal - exposed for testing purposes only
+ */
+function isEmptyCredentials(providerName, kmsProviders) {
+ const provider = kmsProviders[providerName];
+ if (provider == null) {
+ return false;
+ }
+ return typeof provider === 'object' && Object.keys(provider).length === 0;
+}
+/**
+ * Load cloud provider credentials for the user provided KMS providers.
+ * Credentials will only attempt to get loaded if they do not exist
+ * and no existing credentials will get overwritten.
+ *
+ * @internal
+ */
+async function refreshKMSCredentials(kmsProviders, credentialProviders) {
+ let finalKMSProviders = kmsProviders;
+ if (isEmptyCredentials('aws', kmsProviders)) {
+ finalKMSProviders = await (0, aws_1.loadAWSCredentials)(finalKMSProviders, credentialProviders?.aws);
+ }
+ if (isEmptyCredentials('gcp', kmsProviders)) {
+ finalKMSProviders = await (0, gcp_1.loadGCPCredentials)(finalKMSProviders);
+ }
+ if (isEmptyCredentials('azure', kmsProviders)) {
+ finalKMSProviders = await (0, azure_1.loadAzureCredentials)(finalKMSProviders);
+ }
+ return finalKMSProviders;
+}
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/providers/index.js.map b/node_modules/mongodb/lib/client-side-encryption/providers/index.js.map
new file mode 100644
index 00000000..b5d46f3a
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/providers/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client-side-encryption/providers/index.ts"],"names":[],"mappings":";;AA0KA,gDASC;AASD,sDAkBC;AA5MD,+BAA2C;AAC3C,mCAA+C;AAC/C,+BAA2C;AA8J3C;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAChC,YAA6C,EAC7C,YAA0B;IAE1B,MAAM,QAAQ,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAC5C,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,qBAAqB,CACzC,YAA0B,EAC1B,mBAAyC;IAEzC,IAAI,iBAAiB,GAAG,YAAY,CAAC;IAErC,IAAI,kBAAkB,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,CAAC;QAC5C,iBAAiB,GAAG,MAAM,IAAA,wBAAkB,EAAC,iBAAiB,EAAE,mBAAmB,EAAE,GAAG,CAAC,CAAC;IAC5F,CAAC;IAED,IAAI,kBAAkB,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,CAAC;QAC5C,iBAAiB,GAAG,MAAM,IAAA,wBAAkB,EAAC,iBAAiB,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,CAAC;QAC9C,iBAAiB,GAAG,MAAM,IAAA,4BAAoB,EAAC,iBAAiB,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/state_machine.js b/node_modules/mongodb/lib/client-side-encryption/state_machine.js
new file mode 100644
index 00000000..13fc15d4
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/state_machine.js
@@ -0,0 +1,427 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.StateMachine = void 0;
+const fs = require("fs/promises");
+const net = require("net");
+const process = require("process");
+const tls = require("tls");
+const bson_1 = require("../bson");
+const abstract_cursor_1 = require("../cursor/abstract_cursor");
+const deps_1 = require("../deps");
+const error_1 = require("../error");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const client_encryption_1 = require("./client_encryption");
+const errors_1 = require("./errors");
+let socks = null;
+function loadSocks() {
+ if (socks == null) {
+ const socksImport = (0, deps_1.getSocks)();
+ if ('kModuleError' in socksImport) {
+ throw socksImport.kModuleError;
+ }
+ socks = socksImport;
+ }
+ return socks;
+}
+// libmongocrypt states
+const MONGOCRYPT_CTX_ERROR = 0;
+const MONGOCRYPT_CTX_NEED_MONGO_COLLINFO = 1;
+const MONGOCRYPT_CTX_NEED_MONGO_MARKINGS = 2;
+const MONGOCRYPT_CTX_NEED_MONGO_KEYS = 3;
+const MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS = 7;
+const MONGOCRYPT_CTX_NEED_KMS = 4;
+const MONGOCRYPT_CTX_READY = 5;
+const MONGOCRYPT_CTX_DONE = 6;
+const HTTPS_PORT = 443;
+const stateToString = new Map([
+ [MONGOCRYPT_CTX_ERROR, 'MONGOCRYPT_CTX_ERROR'],
+ [MONGOCRYPT_CTX_NEED_MONGO_COLLINFO, 'MONGOCRYPT_CTX_NEED_MONGO_COLLINFO'],
+ [MONGOCRYPT_CTX_NEED_MONGO_MARKINGS, 'MONGOCRYPT_CTX_NEED_MONGO_MARKINGS'],
+ [MONGOCRYPT_CTX_NEED_MONGO_KEYS, 'MONGOCRYPT_CTX_NEED_MONGO_KEYS'],
+ [MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS, 'MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS'],
+ [MONGOCRYPT_CTX_NEED_KMS, 'MONGOCRYPT_CTX_NEED_KMS'],
+ [MONGOCRYPT_CTX_READY, 'MONGOCRYPT_CTX_READY'],
+ [MONGOCRYPT_CTX_DONE, 'MONGOCRYPT_CTX_DONE']
+]);
+const INSECURE_TLS_OPTIONS = [
+ 'tlsInsecure',
+ 'tlsAllowInvalidCertificates',
+ 'tlsAllowInvalidHostnames'
+];
+/**
+ * Helper function for logging. Enabled by setting the environment flag MONGODB_CRYPT_DEBUG.
+ * @param msg - Anything you want to be logged.
+ */
+function debug(msg) {
+ if (process.env.MONGODB_CRYPT_DEBUG) {
+ // eslint-disable-next-line no-console
+ console.error(msg);
+ }
+}
+/**
+ * This is kind of a hack. For `rewrapManyDataKey`, we have tests that
+ * guarantee that when there are no matching keys, `rewrapManyDataKey` returns
+ * nothing. We also have tests for auto encryption that guarantee for `encrypt`
+ * we return an error when there are no matching keys. This error is generated in
+ * subsequent iterations of the state machine.
+ * Some apis (`encrypt`) throw if there are no filter matches and others (`rewrapManyDataKey`)
+ * do not. We set the result manually here, and let the state machine continue. `libmongocrypt`
+ * will inform us if we need to error by setting the state to `MONGOCRYPT_CTX_ERROR` but
+ * otherwise we'll return `{ v: [] }`.
+ */
+let EMPTY_V;
+/**
+ * @internal
+ * An internal class that executes across a MongoCryptContext until either
+ * a finishing state or an error is reached. Do not instantiate directly.
+ */
+// TODO(DRIVERS-2671): clarify CSOT behavior for FLE APIs
+class StateMachine {
+ constructor(options, bsonOptions = (0, bson_1.pluckBSONSerializeOptions)(options)) {
+ this.options = options;
+ this.bsonOptions = bsonOptions;
+ }
+ /**
+ * Executes the state machine according to the specification
+ */
+ async execute(executor, context, options) {
+ const keyVaultNamespace = executor._keyVaultNamespace;
+ const keyVaultClient = executor._keyVaultClient;
+ const metaDataClient = executor._metaDataClient;
+ const mongocryptdClient = executor._mongocryptdClient;
+ const mongocryptdManager = executor._mongocryptdManager;
+ let result = null;
+ // Typescript treats getters just like properties: Once you've tested it for equality
+ // it cannot change. Which is exactly the opposite of what we use state and status for.
+ // Every call to at least `addMongoOperationResponse` and `finalize` can change the state.
+ // These wrappers let us write code more naturally and not add compiler exceptions
+ // to conditions checks inside the state machine.
+ const getStatus = () => context.status;
+ const getState = () => context.state;
+ while (getState() !== MONGOCRYPT_CTX_DONE && getState() !== MONGOCRYPT_CTX_ERROR) {
+ options.signal?.throwIfAborted();
+ debug(`[context#${context.id}] ${stateToString.get(getState()) || getState()}`);
+ switch (getState()) {
+ case MONGOCRYPT_CTX_NEED_MONGO_COLLINFO: {
+ const filter = (0, bson_1.deserialize)(context.nextMongoOperation());
+ if (!metaDataClient) {
+ throw new errors_1.MongoCryptError('unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_COLLINFO but metadata client is undefined');
+ }
+ const collInfoCursor = this.fetchCollectionInfo(metaDataClient, context.ns, filter, options);
+ for await (const collInfo of collInfoCursor) {
+ context.addMongoOperationResponse((0, bson_1.serialize)(collInfo));
+ if (getState() === MONGOCRYPT_CTX_ERROR)
+ break;
+ }
+ if (getState() === MONGOCRYPT_CTX_ERROR)
+ break;
+ context.finishMongoOperation();
+ break;
+ }
+ case MONGOCRYPT_CTX_NEED_MONGO_MARKINGS: {
+ const command = context.nextMongoOperation();
+ if (getState() === MONGOCRYPT_CTX_ERROR)
+ break;
+ if (!mongocryptdClient) {
+ throw new errors_1.MongoCryptError('unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_MARKINGS but mongocryptdClient is undefined');
+ }
+ // When we are using the shared library, we don't have a mongocryptd manager.
+ const markedCommand = mongocryptdManager
+ ? await mongocryptdManager.withRespawn(this.markCommand.bind(this, mongocryptdClient, context.ns, command, options))
+ : await this.markCommand(mongocryptdClient, context.ns, command, options);
+ context.addMongoOperationResponse(markedCommand);
+ context.finishMongoOperation();
+ break;
+ }
+ case MONGOCRYPT_CTX_NEED_MONGO_KEYS: {
+ const filter = context.nextMongoOperation();
+ const keys = await this.fetchKeys(keyVaultClient, keyVaultNamespace, filter, options);
+ if (keys.length === 0) {
+ // See docs on EMPTY_V
+ result = EMPTY_V ??= (0, bson_1.serialize)({ v: [] });
+ }
+ for (const key of keys) {
+ context.addMongoOperationResponse((0, bson_1.serialize)(key));
+ }
+ context.finishMongoOperation();
+ break;
+ }
+ case MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS: {
+ const kmsProviders = await executor.askForKMSCredentials();
+ context.provideKMSProviders((0, bson_1.serialize)(kmsProviders));
+ break;
+ }
+ case MONGOCRYPT_CTX_NEED_KMS: {
+ await Promise.all(this.requests(context, options));
+ context.finishKMSRequests();
+ break;
+ }
+ case MONGOCRYPT_CTX_READY: {
+ const finalizedContext = context.finalize();
+ if (getState() === MONGOCRYPT_CTX_ERROR) {
+ const message = getStatus().message || 'Finalization error';
+ throw new errors_1.MongoCryptError(message);
+ }
+ result = finalizedContext;
+ break;
+ }
+ default:
+ throw new errors_1.MongoCryptError(`Unknown state: ${getState()}`);
+ }
+ }
+ if (getState() === MONGOCRYPT_CTX_ERROR || result == null) {
+ const message = getStatus().message;
+ if (!message) {
+ debug(`unidentifiable error in MongoCrypt - received an error status from \`libmongocrypt\` but received no error message.`);
+ }
+ throw new errors_1.MongoCryptError(message ??
+ 'unidentifiable error in MongoCrypt - received an error status from `libmongocrypt` but received no error message.');
+ }
+ return result;
+ }
+ /**
+ * Handles the request to the KMS service. Exposed for testing purposes. Do not directly invoke.
+ * @param kmsContext - A C++ KMS context returned from the bindings
+ * @returns A promise that resolves when the KMS reply has be fully parsed
+ */
+ async kmsRequest(request, options) {
+ const parsedUrl = request.endpoint.split(':');
+ const port = parsedUrl[1] != null ? Number.parseInt(parsedUrl[1], 10) : HTTPS_PORT;
+ const socketOptions = {
+ host: parsedUrl[0],
+ servername: parsedUrl[0],
+ port,
+ ...(0, client_encryption_1.autoSelectSocketOptions)(this.options.socketOptions || {})
+ };
+ const message = request.message;
+ const buffer = new utils_1.BufferPool();
+ let netSocket;
+ let socket;
+ function destroySockets() {
+ for (const sock of [socket, netSocket]) {
+ if (sock) {
+ sock.destroy();
+ }
+ }
+ }
+ function onerror(cause) {
+ return new errors_1.MongoCryptError('KMS request failed', { cause });
+ }
+ function onclose() {
+ return new errors_1.MongoCryptError('KMS request closed');
+ }
+ const tlsOptions = this.options.tlsOptions;
+ if (tlsOptions) {
+ const kmsProvider = request.kmsProvider;
+ const providerTlsOptions = tlsOptions[kmsProvider];
+ if (providerTlsOptions) {
+ const error = this.validateTlsOptions(kmsProvider, providerTlsOptions);
+ if (error) {
+ throw error;
+ }
+ try {
+ await this.setTlsOptions(providerTlsOptions, socketOptions);
+ }
+ catch (err) {
+ throw onerror(err);
+ }
+ }
+ }
+ let abortListener;
+ try {
+ if (this.options.proxyOptions && this.options.proxyOptions.proxyHost) {
+ netSocket = new net.Socket();
+ const { promise: willConnect, reject: rejectOnNetSocketError, resolve: resolveOnNetSocketConnect } = (0, utils_1.promiseWithResolvers)();
+ netSocket
+ .once('error', err => rejectOnNetSocketError(onerror(err)))
+ .once('close', () => rejectOnNetSocketError(onclose()))
+ .once('connect', () => resolveOnNetSocketConnect());
+ const netSocketOptions = {
+ ...socketOptions,
+ host: this.options.proxyOptions.proxyHost,
+ port: this.options.proxyOptions.proxyPort || 1080
+ };
+ netSocket.connect(netSocketOptions);
+ await willConnect;
+ try {
+ socks ??= loadSocks();
+ socketOptions.socket = (await socks.SocksClient.createConnection({
+ existing_socket: netSocket,
+ command: 'connect',
+ destination: { host: socketOptions.host, port: socketOptions.port },
+ proxy: {
+ // host and port are ignored because we pass existing_socket
+ host: 'iLoveJavaScript',
+ port: 0,
+ type: 5,
+ userId: this.options.proxyOptions.proxyUsername,
+ password: this.options.proxyOptions.proxyPassword
+ }
+ })).socket;
+ }
+ catch (err) {
+ throw onerror(err);
+ }
+ }
+ socket = tls.connect(socketOptions, () => {
+ socket.write(message);
+ });
+ const { promise: willResolveKmsRequest, reject: rejectOnTlsSocketError, resolve } = (0, utils_1.promiseWithResolvers)();
+ abortListener = (0, utils_1.addAbortListener)(options?.signal, function () {
+ destroySockets();
+ rejectOnTlsSocketError(this.reason);
+ });
+ socket
+ .once('error', err => rejectOnTlsSocketError(onerror(err)))
+ .once('close', () => rejectOnTlsSocketError(onclose()))
+ .on('data', data => {
+ buffer.append(data);
+ while (request.bytesNeeded > 0 && buffer.length) {
+ const bytesNeeded = Math.min(request.bytesNeeded, buffer.length);
+ request.addResponse(buffer.read(bytesNeeded));
+ }
+ if (request.bytesNeeded <= 0) {
+ resolve();
+ }
+ });
+ await (options?.timeoutContext?.csotEnabled()
+ ? Promise.all([
+ willResolveKmsRequest,
+ timeout_1.Timeout.expires(options.timeoutContext?.remainingTimeMS)
+ ])
+ : willResolveKmsRequest);
+ }
+ catch (error) {
+ if (error instanceof timeout_1.TimeoutError)
+ throw new error_1.MongoOperationTimeoutError('KMS request timed out');
+ throw error;
+ }
+ finally {
+ // There's no need for any more activity on this socket at this point.
+ destroySockets();
+ abortListener?.[utils_1.kDispose]();
+ }
+ }
+ *requests(context, options) {
+ for (let request = context.nextKMSRequest(); request != null; request = context.nextKMSRequest()) {
+ yield this.kmsRequest(request, options);
+ }
+ }
+ /**
+ * Validates the provided TLS options are secure.
+ *
+ * @param kmsProvider - The KMS provider name.
+ * @param tlsOptions - The client TLS options for the provider.
+ *
+ * @returns An error if any option is invalid.
+ */
+ validateTlsOptions(kmsProvider, tlsOptions) {
+ const tlsOptionNames = Object.keys(tlsOptions);
+ for (const option of INSECURE_TLS_OPTIONS) {
+ if (tlsOptionNames.includes(option)) {
+ return new errors_1.MongoCryptError(`Insecure TLS options prohibited for ${kmsProvider}: ${option}`);
+ }
+ }
+ }
+ /**
+ * Sets only the valid secure TLS options.
+ *
+ * @param tlsOptions - The client TLS options for the provider.
+ * @param options - The existing connection options.
+ */
+ async setTlsOptions(tlsOptions, options) {
+ // If a secureContext is provided, ensure it is set.
+ if (tlsOptions.secureContext) {
+ options.secureContext = tlsOptions.secureContext;
+ }
+ if (tlsOptions.tlsCertificateKeyFile) {
+ const cert = await fs.readFile(tlsOptions.tlsCertificateKeyFile);
+ options.cert = options.key = cert;
+ }
+ if (tlsOptions.tlsCAFile) {
+ options.ca = await fs.readFile(tlsOptions.tlsCAFile);
+ }
+ if (tlsOptions.tlsCertificateKeyFilePassword) {
+ options.passphrase = tlsOptions.tlsCertificateKeyFilePassword;
+ }
+ }
+ /**
+ * Fetches collection info for a provided namespace, when libmongocrypt
+ * enters the `MONGOCRYPT_CTX_NEED_MONGO_COLLINFO` state. The result is
+ * used to inform libmongocrypt of the schema associated with this
+ * namespace. Exposed for testing purposes. Do not directly invoke.
+ *
+ * @param client - A MongoClient connected to the topology
+ * @param ns - The namespace to list collections from
+ * @param filter - A filter for the listCollections command
+ * @param callback - Invoked with the info of the requested collection, or with an error
+ */
+ fetchCollectionInfo(client, ns, filter, options) {
+ const { db } = utils_1.MongoDBCollectionNamespace.fromString(ns);
+ const cursor = client.db(db).listCollections(filter, {
+ promoteLongs: false,
+ promoteValues: false,
+ timeoutContext: options?.timeoutContext && new abstract_cursor_1.CursorTimeoutContext(options?.timeoutContext, Symbol()),
+ signal: options?.signal,
+ nameOnly: false
+ });
+ return cursor;
+ }
+ /**
+ * Calls to the mongocryptd to provide markings for a command.
+ * Exposed for testing purposes. Do not directly invoke.
+ * @param client - A MongoClient connected to a mongocryptd
+ * @param ns - The namespace (database.collection) the command is being executed on
+ * @param command - The command to execute.
+ * @param callback - Invoked with the serialized and marked bson command, or with an error
+ */
+ async markCommand(client, ns, command, options) {
+ const { db } = utils_1.MongoDBCollectionNamespace.fromString(ns);
+ const bsonOptions = { promoteLongs: false, promoteValues: false };
+ const rawCommand = (0, bson_1.deserialize)(command, bsonOptions);
+ const commandOptions = {
+ timeoutMS: undefined,
+ signal: undefined
+ };
+ if (options?.timeoutContext?.csotEnabled()) {
+ commandOptions.timeoutMS = options.timeoutContext.remainingTimeMS;
+ }
+ if (options?.signal) {
+ commandOptions.signal = options.signal;
+ }
+ const response = await client.db(db).command(rawCommand, {
+ ...bsonOptions,
+ ...commandOptions
+ });
+ return (0, bson_1.serialize)(response, this.bsonOptions);
+ }
+ /**
+ * Requests keys from the keyVault collection on the topology.
+ * Exposed for testing purposes. Do not directly invoke.
+ * @param client - A MongoClient connected to the topology
+ * @param keyVaultNamespace - The namespace (database.collection) of the keyVault Collection
+ * @param filter - The filter for the find query against the keyVault Collection
+ * @param callback - Invoked with the found keys, or with an error
+ */
+ fetchKeys(client, keyVaultNamespace, filter, options) {
+ const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(keyVaultNamespace);
+ const commandOptions = {
+ timeoutContext: undefined,
+ signal: undefined
+ };
+ if (options?.timeoutContext != null) {
+ commandOptions.timeoutContext = new abstract_cursor_1.CursorTimeoutContext(options.timeoutContext, Symbol());
+ }
+ if (options?.signal != null) {
+ commandOptions.signal = options.signal;
+ }
+ return client
+ .db(dbName)
+ .collection(collectionName, { readConcern: { level: 'majority' } })
+ .find((0, bson_1.deserialize)(filter), commandOptions)
+ .toArray();
+ }
+}
+exports.StateMachine = StateMachine;
+//# sourceMappingURL=state_machine.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/client-side-encryption/state_machine.js.map b/node_modules/mongodb/lib/client-side-encryption/state_machine.js.map
new file mode 100644
index 00000000..24ae90c5
--- /dev/null
+++ b/node_modules/mongodb/lib/client-side-encryption/state_machine.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"state_machine.js","sourceRoot":"","sources":["../../src/client-side-encryption/state_machine.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAElC,2BAA2B;AAC3B,mCAAmC;AACnC,2BAA2B;AAE3B,kCAMiB;AAEjB,+DAAiE;AACjE,kCAAkD;AAClD,oCAAsD;AAItD,wCAAwE;AACxE,oCAMkB;AAClB,2DAA4E;AAC5E,qCAA2C;AAI3C,IAAI,KAAK,GAAoB,IAAI,CAAC;AAClC,SAAS,SAAS;IAChB,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,MAAM,WAAW,GAAG,IAAA,eAAQ,GAAE,CAAC;QAC/B,IAAI,cAAc,IAAI,WAAW,EAAE,CAAC;YAClC,MAAM,WAAW,CAAC,YAAY,CAAC;QACjC,CAAC;QACD,KAAK,GAAG,WAAW,CAAC;IACtB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,uBAAuB;AACvB,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAC7C,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAC7C,MAAM,8BAA8B,GAAG,CAAC,CAAC;AACzC,MAAM,mCAAmC,GAAG,CAAC,CAAC;AAC9C,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,CAAC,oBAAoB,EAAE,sBAAsB,CAAC;IAC9C,CAAC,kCAAkC,EAAE,oCAAoC,CAAC;IAC1E,CAAC,kCAAkC,EAAE,oCAAoC,CAAC;IAC1E,CAAC,8BAA8B,EAA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,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;OAOG;IACH,SAAS,CACP,MAAmB,EACnB,iBAAyB,EACzB,MAAkB,EAClB,OAAyD;QAEzD,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAC9C,kCAA0B,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAE3D,MAAM,cAAc,GAGhB;YACF,cAAc,EAAE,SAAS;YACzB,MAAM,EAAE,SAAS;SAClB,CAAC;QAEF,IAAI,OAAO,EAAE,cAAc,IAAI,IAAI,EAAE,CAAC;YACpC,cAAc,CAAC,cAAc,GAAG,IAAI,sCAAoB,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,IAAI,OAAO,EAAE,MAAM,IAAI,IAAI,EAAE,CAAC;YAC5B,cAAc,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACzC,CAAC;QAED,OAAO,MAAM;aACV,EAAE,CAAC,MAAM,CAAC;aACV,UAAU,CAAU,cAAc,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC;aAC3E,IAAI,CAAC,IAAA,kBAAW,EAAC,MAAM,CAAC,EAAE,cAAc,CAAC;aACzC,OAAO,EAAE,CAAC;IACf,CAAC;CACF;AAndD,oCAmdC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/auth_provider.js b/node_modules/mongodb/lib/cmap/auth/auth_provider.js
new file mode 100644
index 00000000..99cbf72a
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/auth_provider.js
@@ -0,0 +1,51 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AuthProvider = exports.AuthContext = void 0;
+const error_1 = require("../../error");
+/**
+ * Context used during authentication
+ * @internal
+ */
+class AuthContext {
+ constructor(connection, credentials, options) {
+ /** If the context is for reauthentication. */
+ this.reauthenticating = false;
+ this.connection = connection;
+ this.credentials = credentials;
+ this.options = options;
+ }
+}
+exports.AuthContext = AuthContext;
+/**
+ * Provider used during authentication.
+ * @internal
+ */
+class AuthProvider {
+ /**
+ * Prepare the handshake document before the initial handshake.
+ *
+ * @param handshakeDoc - The document used for the initial handshake on a connection
+ * @param authContext - Context for authentication flow
+ */
+ async prepare(handshakeDoc, _authContext) {
+ return handshakeDoc;
+ }
+ /**
+ * Reauthenticate.
+ * @param context - The shared auth context.
+ */
+ async reauth(context) {
+ if (context.reauthenticating) {
+ throw new error_1.MongoRuntimeError('Reauthentication already in progress.');
+ }
+ try {
+ context.reauthenticating = true;
+ await this.auth(context);
+ }
+ finally {
+ context.reauthenticating = false;
+ }
+ }
+}
+exports.AuthProvider = AuthProvider;
+//# sourceMappingURL=auth_provider.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/auth_provider.js.map b/node_modules/mongodb/lib/cmap/auth/auth_provider.js.map
new file mode 100644
index 00000000..0542aeda
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/auth_provider.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"auth_provider.js","sourceRoot":"","sources":["../../../src/cmap/auth/auth_provider.ts"],"names":[],"mappings":";;;AACA,uCAAgD;AAKhD;;;GAGG;AACH,MAAa,WAAW;IAetB,YACE,UAAsB,EACtB,WAAyC,EACzC,OAA0B;QAb5B,8CAA8C;QAC9C,qBAAgB,GAAG,KAAK,CAAC;QAcvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAxBD,kCAwBC;AAED;;;GAGG;AACH,MAAsB,YAAY;IAChC;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CACX,YAA+B,EAC/B,YAAyB;QAEzB,OAAO,YAAY,CAAC;IACtB,CAAC;IASD;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,OAAoB;QAC/B,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAC7B,MAAM,IAAI,yBAAiB,CAAC,uCAAuC,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,CAAC;YACH,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAChC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,gBAAgB,GAAG,KAAK,CAAC;QACnC,CAAC;IACH,CAAC;CACF;AApCD,oCAoCC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/aws4.js b/node_modules/mongodb/lib/cmap/auth/aws4.js
new file mode 100644
index 00000000..3a03e97e
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/aws4.js
@@ -0,0 +1,161 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.aws4Sign = aws4Sign;
+const bson_1 = require("../../bson");
+/**
+ * Calculates the SHA-256 hash of a string.
+ *
+ * @param str - String to hash.
+ * @returns Hexadecimal representation of the hash.
+ */
+const getHexSha256 = async (str) => {
+ const data = stringToBuffer(str);
+ const hashBuffer = await crypto.subtle.digest('SHA-256', data);
+ const hashHex = bson_1.ByteUtils.toHex(new Uint8Array(hashBuffer));
+ return hashHex;
+};
+/**
+ * Calculates the HMAC-SHA256 of a string using the provided key.
+ * @param key - Key to use for HMAC calculation. Can be a string or Uint8Array.
+ * @param str - String to calculate HMAC for.
+ * @returns Uint8Array containing the HMAC-SHA256 digest.
+ */
+const getHmacSha256 = async (key, str) => {
+ let keyData;
+ if (typeof key === 'string') {
+ keyData = stringToBuffer(key);
+ }
+ else {
+ keyData = key;
+ }
+ const importedKey = await crypto.subtle.importKey('raw', keyData, { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign']);
+ const strData = stringToBuffer(str);
+ const signature = await crypto.subtle.sign('HMAC', importedKey, strData);
+ const digest = new Uint8Array(signature);
+ return digest;
+};
+/**
+ * Converts header values according to AWS requirements,
+ * From https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-create-signed-request.html#create-canonical-request
+ * For values, you must:
+ - trim any leading or trailing spaces.
+ - convert sequential spaces to a single space.
+ * @param value - Header value to convert.
+ * @returns - Converted header value.
+ */
+const convertHeaderValue = (value) => {
+ return value.toString().trim().replace(/\s+/g, ' ');
+};
+/**
+ * Returns a Uint8Array representation of a string, encoded in UTF-8.
+ * @param str - String to convert.
+ * @returns Uint8Array containing the UTF-8 encoded string.
+ */
+function stringToBuffer(str) {
+ const data = new Uint8Array(bson_1.ByteUtils.utf8ByteLength(str));
+ bson_1.ByteUtils.encodeUTF8Into(data, str, 0);
+ return data;
+}
+/**
+ * This method implements AWS Signature 4 logic for a very specific request format.
+ * The signing logic is described here: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-create-signed-request.html
+ */
+async function aws4Sign(options, credentials) {
+ /**
+ * From the spec: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-create-signed-request.html
+ *
+ * Summary of signing steps
+ * 1. Create a canonical request
+ * Arrange the contents of your request (host, action, headers, etc.) into a standard canonical format. The canonical request is one of the inputs used to create the string to sign.
+ * 2. Create a hash of the canonical request
+ * Hash the canonical request using the same algorithm that you used to create the hash of the payload. The hash of the canonical request is a string of lowercase hexadecimal characters.
+ * 3. Create a string to sign
+ * Create a string to sign with the canonical request and extra information such as the algorithm, request date, credential scope, and the hash of the canonical request.
+ * 4. Derive a signing key
+ * Use the secret access key to derive the key used to sign the request.
+ * 5. Calculate the signature
+ * Perform a keyed hash operation on the string to sign using the derived signing key as the hash key.
+ * 6. Add the signature to the request
+ * Add the calculated signature to an HTTP header or to the query string of the request.
+ */
+ // 1: Create a canonical request
+ // Date – The date and time used to sign the request.
+ const date = options.date;
+ // RequestDateTime – The date and time used in the credential scope. This value is the current UTC time in ISO 8601 format (for example, 20130524T000000Z).
+ const requestDateTime = date.toISOString().replace(/[:-]|\.\d{3}/g, '');
+ // RequestDate – The date used in the credential scope. This value is the current UTC date in YYYYMMDD format (for example, 20130524).
+ const requestDate = requestDateTime.substring(0, 8);
+ // Method – The HTTP request method. For us, this is always 'POST'.
+ const method = options.method;
+ // CanonicalUri – The URI-encoded version of the absolute path component URI, starting with the / that follows the domain name and up to the end of the string
+ // For our requests, this is always '/'
+ const canonicalUri = options.path;
+ // CanonicalQueryString – The URI-encoded query string parameters. For our requests, there are no query string parameters, so this is always an empty string.
+ const canonicalQuerystring = '';
+ // CanonicalHeaders – A list of request headers with their values. Individual header name and value pairs are separated by the newline character ("\n").
+ // All of our known/expected headers are included here, there are no extra headers.
+ const headers = new Headers({
+ 'content-length': convertHeaderValue(options.headers['Content-Length']),
+ 'content-type': convertHeaderValue(options.headers['Content-Type']),
+ host: convertHeaderValue(options.host),
+ 'x-amz-date': convertHeaderValue(requestDateTime),
+ 'x-mongodb-gs2-cb-flag': convertHeaderValue(options.headers['X-MongoDB-GS2-CB-Flag']),
+ 'x-mongodb-server-nonce': convertHeaderValue(options.headers['X-MongoDB-Server-Nonce'])
+ });
+ // If session token is provided, include it in the headers
+ if ('sessionToken' in credentials && credentials.sessionToken) {
+ headers.append('x-amz-security-token', convertHeaderValue(credentials.sessionToken));
+ }
+ // Canonical headers are lowercased and sorted.
+ const canonicalHeaders = Array.from(headers.entries())
+ .map(([key, value]) => `${key.toLowerCase()}:${value}`)
+ .sort()
+ .join('\n');
+ const canonicalHeaderNames = Array.from(headers.keys()).map(header => header.toLowerCase());
+ // SignedHeaders – An alphabetically sorted, semicolon-separated list of lowercase request header names.
+ const signedHeaders = canonicalHeaderNames.sort().join(';');
+ // HashedPayload – A string created using the payload in the body of the HTTP request as input to a hash function. This string uses lowercase hexadecimal characters.
+ const hashedPayload = await getHexSha256(options.body);
+ // CanonicalRequest – A string that includes the above elements, separated by newline characters.
+ const canonicalRequest = [
+ method,
+ canonicalUri,
+ canonicalQuerystring,
+ canonicalHeaders + '\n',
+ signedHeaders,
+ hashedPayload
+ ].join('\n');
+ // 2. Create a hash of the canonical request
+ // HashedCanonicalRequest – A string created by using the canonical request as input to a hash function.
+ const hashedCanonicalRequest = await getHexSha256(canonicalRequest);
+ // 3. Create a string to sign
+ // Algorithm – The algorithm used to create the hash of the canonical request. For SigV4, use AWS4-HMAC-SHA256.
+ const algorithm = 'AWS4-HMAC-SHA256';
+ // CredentialScope – The credential scope, which restricts the resulting signature to the specified Region and service.
+ // Has the following format: YYYYMMDD/region/service/aws4_request.
+ const credentialScope = `${requestDate}/${options.region}/${options.service}/aws4_request`;
+ // StringToSign – A string that includes the above elements, separated by newline characters.
+ const stringToSign = [algorithm, requestDateTime, credentialScope, hashedCanonicalRequest].join('\n');
+ // 4. Derive a signing key
+ // To derive a signing key for SigV4, perform a succession of keyed hash operations (HMAC) on the request date, Region, and service, with your AWS secret access key as the key for the initial hashing operation.
+ const dateKey = await getHmacSha256('AWS4' + credentials.secretAccessKey, requestDate);
+ const dateRegionKey = await getHmacSha256(dateKey, options.region);
+ const dateRegionServiceKey = await getHmacSha256(dateRegionKey, options.service);
+ const signingKey = await getHmacSha256(dateRegionServiceKey, 'aws4_request');
+ // 5. Calculate the signature
+ const signatureBuffer = await getHmacSha256(signingKey, stringToSign);
+ const signature = bson_1.ByteUtils.toHex(signatureBuffer);
+ // 6. Add the signature to the request
+ // Calculate the Authorization header
+ const authorizationHeader = [
+ 'AWS4-HMAC-SHA256 Credential=' + credentials.accessKeyId + '/' + credentialScope,
+ 'SignedHeaders=' + signedHeaders,
+ 'Signature=' + signature
+ ].join(', ');
+ // Return the calculated headers
+ return {
+ Authorization: authorizationHeader,
+ 'X-Amz-Date': requestDateTime
+ };
+}
+//# sourceMappingURL=aws4.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/aws4.js.map b/node_modules/mongodb/lib/cmap/auth/aws4.js.map
new file mode 100644
index 00000000..3ae9a1cb
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/aws4.js.map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O;QACL,aAAa,EAAE,mBAAmB;QAClC,YAAY,EAAE,eAAe;KAC9B,CAAC;AACJ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js b/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js
new file mode 100644
index 00000000..6277461b
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js
@@ -0,0 +1,103 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AWSSDKCredentialProvider = void 0;
+const process = require("process");
+const deps_1 = require("../../deps");
+const error_1 = require("../../error");
+/** @internal */
+class AWSSDKCredentialProvider {
+ /**
+ * Create the SDK credentials provider.
+ * @param credentialsProvider - The credentials provider.
+ */
+ constructor(credentialsProvider) {
+ if (credentialsProvider) {
+ this._provider = credentialsProvider;
+ }
+ }
+ static get awsSDK() {
+ AWSSDKCredentialProvider._awsSDK ??= (0, deps_1.getAwsCredentialProvider)();
+ return AWSSDKCredentialProvider._awsSDK;
+ }
+ /**
+ * The AWS SDK caches credentials automatically and handles refresh when the credentials have expired.
+ * To ensure this occurs, we need to cache the `provider` returned by the AWS sdk and re-use it when fetching credentials.
+ */
+ get provider() {
+ if ('kModuleError' in AWSSDKCredentialProvider.awsSDK) {
+ throw AWSSDKCredentialProvider.awsSDK.kModuleError;
+ }
+ if (this._provider) {
+ return this._provider;
+ }
+ let { AWS_STS_REGIONAL_ENDPOINTS = '', AWS_REGION = '' } = process.env;
+ AWS_STS_REGIONAL_ENDPOINTS = AWS_STS_REGIONAL_ENDPOINTS.toLowerCase();
+ AWS_REGION = AWS_REGION.toLowerCase();
+ /** The option setting should work only for users who have explicit settings in their environment, the driver should not encode "defaults" */
+ const awsRegionSettingsExist = AWS_REGION.length !== 0 && AWS_STS_REGIONAL_ENDPOINTS.length !== 0;
+ /**
+ * The following regions use the global AWS STS endpoint, sts.amazonaws.com, by default
+ * https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html
+ */
+ const LEGACY_REGIONS = new Set([
+ 'ap-northeast-1',
+ 'ap-south-1',
+ 'ap-southeast-1',
+ 'ap-southeast-2',
+ 'aws-global',
+ 'ca-central-1',
+ 'eu-central-1',
+ 'eu-north-1',
+ 'eu-west-1',
+ 'eu-west-2',
+ 'eu-west-3',
+ 'sa-east-1',
+ 'us-east-1',
+ 'us-east-2',
+ 'us-west-1',
+ 'us-west-2'
+ ]);
+ /**
+ * If AWS_STS_REGIONAL_ENDPOINTS is set to regional, users are opting into the new behavior of respecting the region settings
+ *
+ * If AWS_STS_REGIONAL_ENDPOINTS is set to legacy, then "old" regions need to keep using the global setting.
+ * Technically the SDK gets this wrong, it reaches out to 'sts.us-east-1.amazonaws.com' when it should be 'sts.amazonaws.com'.
+ * That is not our bug to fix here. We leave that up to the SDK.
+ */
+ const useRegionalSts = AWS_STS_REGIONAL_ENDPOINTS === 'regional' ||
+ (AWS_STS_REGIONAL_ENDPOINTS === 'legacy' && !LEGACY_REGIONS.has(AWS_REGION));
+ this._provider =
+ awsRegionSettingsExist && useRegionalSts
+ ? AWSSDKCredentialProvider.awsSDK.fromNodeProviderChain({
+ clientConfig: { region: AWS_REGION }
+ })
+ : AWSSDKCredentialProvider.awsSDK.fromNodeProviderChain();
+ return this._provider;
+ }
+ async getCredentials() {
+ /*
+ * Creates a credential provider that will attempt to find credentials from the
+ * following sources (listed in order of precedence):
+ *
+ * - Environment variables exposed via process.env
+ * - SSO credentials from token cache
+ * - Web identity token credentials
+ * - Shared credentials and config ini files
+ * - The EC2/ECS Instance Metadata Service
+ */
+ try {
+ const creds = await this.provider();
+ return {
+ AccessKeyId: creds.accessKeyId,
+ SecretAccessKey: creds.secretAccessKey,
+ Token: creds.sessionToken,
+ Expiration: creds.expiration
+ };
+ }
+ catch (error) {
+ throw new error_1.MongoAWSError(error.message, { cause: error });
+ }
+ }
+}
+exports.AWSSDKCredentialProvider = AWSSDKCredentialProvider;
+//# sourceMappingURL=aws_temporary_credentials.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js.map b/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js.map
new file mode 100644
index 00000000..4f5191dc
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"aws_temporary_credentials.js","sourceRoot":"","sources":["../../../src/cmap/auth/aws_temporary_credentials.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAEnC,qCAA2E;AAC3E,uCAA4C;AAoB5C,gBAAgB;AAChB,MAAa,wBAAwB;IAInC;;;OAGG;IACH,YAAY,mBAA2C;QACrD,IAAI,mBAAmB,EAAE,CAAC;YACxB,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC;QACvC,CAAC;IACH,CAAC;IAED,MAAM,KAAK,MAAM;QACf,wBAAwB,CAAC,OAAO,KAAK,IAAA,+BAAwB,GAAE,CAAC;QAChE,OAAO,wBAAwB,CAAC,OAAO,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,IAAY,QAAQ;QAClB,IAAI,cAAc,IAAI,wBAAwB,CAAC,MAAM,EAAE,CAAC;YACtD,MAAM,wBAAwB,CAAC,MAAM,CAAC,YAAY,CAAC;QACrD,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;QACD,IAAI,EAAE,0BAA0B,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;QACvE,0BAA0B,GAAG,0BAA0B,CAAC,WAAW,EAAE,CAAC;QACtE,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;QAEtC,6IAA6I;QAC7I,MAAM,sBAAsB,GAC1B,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,0BAA0B,CAAC,MAAM,KAAK,CAAC,CAAC;QAErE;;;WAGG;QACH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b/lib/cmap/auth/gssapi.js
new file mode 100644
index 00000000..cb08631b
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/gssapi.js
@@ -0,0 +1,152 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.GSSAPI = exports.GSSAPICanonicalizationValue = void 0;
+exports.performGSSAPICanonicalizeHostName = performGSSAPICanonicalizeHostName;
+exports.resolveCname = resolveCname;
+const dns = require("dns");
+const deps_1 = require("../../deps");
+const error_1 = require("../../error");
+const utils_1 = require("../../utils");
+const auth_provider_1 = require("./auth_provider");
+/** @public */
+exports.GSSAPICanonicalizationValue = Object.freeze({
+ on: true,
+ off: false,
+ none: 'none',
+ forward: 'forward',
+ forwardAndReverse: 'forwardAndReverse'
+});
+async function externalCommand(connection, command) {
+ const response = await connection.command((0, utils_1.ns)('$external.$cmd'), command);
+ return response;
+}
+let krb;
+class GSSAPI extends auth_provider_1.AuthProvider {
+ async auth(authContext) {
+ const { connection, credentials } = authContext;
+ if (credentials == null) {
+ throw new error_1.MongoMissingCredentialsError('Credentials required for GSSAPI authentication');
+ }
+ const { username } = credentials;
+ const client = await makeKerberosClient(authContext);
+ const payload = await client.step('');
+ const saslStartResponse = await externalCommand(connection, saslStart(payload));
+ const negotiatedPayload = await negotiate(client, 10, saslStartResponse.payload);
+ const saslContinueResponse = await externalCommand(connection, saslContinue(negotiatedPayload, saslStartResponse.conversationId));
+ const finalizePayload = await finalize(client, username, saslContinueResponse.payload);
+ await externalCommand(connection, {
+ saslContinue: 1,
+ conversationId: saslContinueResponse.conversationId,
+ payload: finalizePayload
+ });
+ }
+}
+exports.GSSAPI = GSSAPI;
+async function makeKerberosClient({ options: { hostAddress, runtime: { os } }, credentials }) {
+ if (!hostAddress || typeof hostAddress.host !== 'string' || !credentials) {
+ throw new error_1.MongoInvalidArgumentError('Connection must have host and port and credentials defined.');
+ }
+ loadKrb();
+ if ('kModuleError' in krb) {
+ throw krb['kModuleError'];
+ }
+ const { initializeClient } = krb;
+ const { username, password } = credentials;
+ const mechanismProperties = credentials.mechanismProperties;
+ const serviceName = mechanismProperties.SERVICE_NAME ?? 'mongodb';
+ const host = await performGSSAPICanonicalizeHostName(hostAddress.host, mechanismProperties);
+ const initOptions = {};
+ if (password != null) {
+ // TODO(NODE-5139): These do not match the typescript options in initializeClient
+ Object.assign(initOptions, { user: username, password: password });
+ }
+ const spnHost = mechanismProperties.SERVICE_HOST ?? host;
+ let spn = `${serviceName}${os.platform() === 'win32' ? '/' : '@'}${spnHost}`;
+ if ('SERVICE_REALM' in mechanismProperties) {
+ spn = `${spn}@${mechanismProperties.SERVICE_REALM}`;
+ }
+ return await initializeClient(spn, initOptions);
+}
+function saslStart(payload) {
+ return {
+ saslStart: 1,
+ mechanism: 'GSSAPI',
+ payload,
+ autoAuthorize: 1
+ };
+}
+function saslContinue(payload, conversationId) {
+ return {
+ saslContinue: 1,
+ conversationId,
+ payload
+ };
+}
+async function negotiate(client, retries, payload) {
+ try {
+ const response = await client.step(payload);
+ return response || '';
+ }
+ catch (error) {
+ if (retries === 0) {
+ // Retries exhausted, raise error
+ throw error;
+ }
+ // Adjust number of retries and call step again
+ return await negotiate(client, retries - 1, payload);
+ }
+}
+async function finalize(client, user, payload) {
+ // GSS Client Unwrap
+ const response = await client.unwrap(payload);
+ return await client.wrap(response || '', { user });
+}
+async function performGSSAPICanonicalizeHostName(host, mechanismProperties) {
+ const mode = mechanismProperties.CANONICALIZE_HOST_NAME;
+ if (!mode || mode === exports.GSSAPICanonicalizationValue.none) {
+ return host;
+ }
+ // If forward and reverse or true
+ if (mode === exports.GSSAPICanonicalizationValue.on ||
+ mode === exports.GSSAPICanonicalizationValue.forwardAndReverse) {
+ // Perform the lookup of the ip address.
+ const { address } = await dns.promises.lookup(host);
+ try {
+ // Perform a reverse ptr lookup on the ip address.
+ const results = await dns.promises.resolve(address, 'PTR');
+ // If the ptr did not error but had no results, return the host.
+ return results.length > 0 ? results[0] : host;
+ }
+ catch {
+ // This can error as ptr records may not exist for all ips. In this case
+ // fallback to a cname lookup as dns.lookup() does not return the
+ // cname.
+ return await resolveCname(host);
+ }
+ }
+ else {
+ // The case for forward is just to resolve the cname as dns.lookup()
+ // will not return it.
+ return await resolveCname(host);
+ }
+}
+async function resolveCname(host) {
+ // Attempt to resolve the host name
+ try {
+ const results = await dns.promises.resolve(host, 'CNAME');
+ // Get the first resolved host id
+ return results.length > 0 ? results[0] : host;
+ }
+ catch {
+ return host;
+ }
+}
+/**
+ * Load the Kerberos library.
+ */
+function loadKrb() {
+ if (!krb) {
+ krb = (0, deps_1.getKerberos)();
+ }
+}
+//# sourceMappingURL=gssapi.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/gssapi.js.map b/node_modules/mongodb/lib/cmap/auth/gssapi.js.map
new file mode 100644
index 00000000..9e9c3372
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/gssapi.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"gssapi.js","sourceRoot":"","sources":["../../../src/cmap/auth/gssapi.ts"],"names":[],"mappings":";;;AAwJA,8EAiCC;AAED,oCASC;AApMD,2BAA2B;AAE3B,qCAA6E;AAC7E,uCAAsF;AACtF,uCAAiC;AAEjC,mDAAiE;AAEjE,cAAc;AACD,QAAA,2BAA2B,GAAG,MAAM,CAAC,MAAM,CAAC;IACvD,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,mBAAmB;CAC9B,CAAC,CAAC;AAaZ,KAAK,UAAU,eAAe,CAC5B,UAAsB,EACtB,OAAuE;IAEvE,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,IAAA,UAAE,EAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAC;IACzE,OAAO,QAAuD,CAAC;AACjE,CAAC;AAED,IAAI,GAAa,CAAC;AAElB,MAAa,MAAO,SAAQ,4BAAY;IAC7B,K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,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEpD,IAAI,CAAC;YACH,kDAAkD;YAClD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC3D,gEAAgE;YAChE,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChD,CAAC;QAAC,MAAM,CAAC;YACP,wEAAwE;YACxE,iEAAiE;YACjE,SAAS;YACT,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;SAAM,CAAC;QACN,oEAAoE;QACpE,sBAAsB;QACtB,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,YAAY,CAAC,IAAY;IAC7C,mCAAmC;IACnC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1D,iCAAiC;QACjC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,OAAO;IACd,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,GAAG,IAAA,kBAAW,GAAE,CAAC;IACtB,CAAC;AACH,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js b/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js
new file mode 100644
index 00000000..b8e86c11
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js
@@ -0,0 +1,169 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongoCredentials = exports.DEFAULT_ALLOWED_HOSTS = void 0;
+const error_1 = require("../../error");
+const gssapi_1 = require("./gssapi");
+const providers_1 = require("./providers");
+/**
+ * @see https://github.com/mongodb/specifications/blob/master/source/auth/auth.md
+ */
+function getDefaultAuthMechanism(hello) {
+ if (hello) {
+ // If hello contains saslSupportedMechs, use scram-sha-256
+ // if it is available, else scram-sha-1
+ if (Array.isArray(hello.saslSupportedMechs)) {
+ return hello.saslSupportedMechs.includes(providers_1.AuthMechanism.MONGODB_SCRAM_SHA256)
+ ? providers_1.AuthMechanism.MONGODB_SCRAM_SHA256
+ : providers_1.AuthMechanism.MONGODB_SCRAM_SHA1;
+ }
+ }
+ // Default auth mechanism for 4.0 and higher.
+ return providers_1.AuthMechanism.MONGODB_SCRAM_SHA256;
+}
+const ALLOWED_ENVIRONMENT_NAMES = [
+ 'test',
+ 'azure',
+ 'gcp',
+ 'k8s'
+];
+const ALLOWED_HOSTS_ERROR = 'Auth mechanism property ALLOWED_HOSTS must be an array of strings.';
+/** @internal */
+exports.DEFAULT_ALLOWED_HOSTS = [
+ '*.mongodb.net',
+ '*.mongodb-qa.net',
+ '*.mongodb-dev.net',
+ '*.mongodbgov.net',
+ 'localhost',
+ '127.0.0.1',
+ '::1',
+ '*.mongo.com'
+];
+/** Error for when the token audience is missing in the environment. */
+const TOKEN_RESOURCE_MISSING_ERROR = 'TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is azure or gcp.';
+/**
+ * A representation of the credentials used by MongoDB
+ * @public
+ */
+class MongoCredentials {
+ constructor(options) {
+ this.username = options.username ?? '';
+ this.password = options.password;
+ this.source = options.source;
+ if (!this.source && options.db) {
+ this.source = options.db;
+ }
+ this.mechanism = options.mechanism || providers_1.AuthMechanism.MONGODB_DEFAULT;
+ this.mechanismProperties = options.mechanismProperties || {};
+ if (this.mechanism === providers_1.AuthMechanism.MONGODB_OIDC && !this.mechanismProperties.ALLOWED_HOSTS) {
+ this.mechanismProperties = {
+ ...this.mechanismProperties,
+ ALLOWED_HOSTS: exports.DEFAULT_ALLOWED_HOSTS
+ };
+ }
+ Object.freeze(this.mechanismProperties);
+ Object.freeze(this);
+ }
+ /** Determines if two MongoCredentials objects are equivalent */
+ equals(other) {
+ return (this.mechanism === other.mechanism &&
+ this.username === other.username &&
+ this.password === other.password &&
+ this.source === other.source);
+ }
+ /**
+ * If the authentication mechanism is set to "default", resolves the authMechanism
+ * based on the server version and server supported sasl mechanisms.
+ *
+ * @param hello - A hello response from the server
+ */
+ resolveAuthMechanism(hello) {
+ // If the mechanism is not "default", then it does not need to be resolved
+ if (this.mechanism.match(/DEFAULT/i)) {
+ return new MongoCredentials({
+ username: this.username,
+ password: this.password,
+ source: this.source,
+ mechanism: getDefaultAuthMechanism(hello),
+ mechanismProperties: this.mechanismProperties
+ });
+ }
+ return this;
+ }
+ validate() {
+ if ((this.mechanism === providers_1.AuthMechanism.MONGODB_GSSAPI ||
+ this.mechanism === providers_1.AuthMechanism.MONGODB_PLAIN ||
+ this.mechanism === providers_1.AuthMechanism.MONGODB_SCRAM_SHA1 ||
+ this.mechanism === providers_1.AuthMechanism.MONGODB_SCRAM_SHA256) &&
+ !this.username) {
+ throw new error_1.MongoMissingCredentialsError(`Username required for mechanism '${this.mechanism}'`);
+ }
+ if (this.mechanism === providers_1.AuthMechanism.MONGODB_OIDC) {
+ if (this.username &&
+ this.mechanismProperties.ENVIRONMENT &&
+ this.mechanismProperties.ENVIRONMENT !== 'azure') {
+ throw new error_1.MongoInvalidArgumentError(`username and ENVIRONMENT '${this.mechanismProperties.ENVIRONMENT}' may not be used together for mechanism '${this.mechanism}'.`);
+ }
+ if (this.username && this.password) {
+ throw new error_1.MongoInvalidArgumentError(`No password is allowed in ENVIRONMENT '${this.mechanismProperties.ENVIRONMENT}' for '${this.mechanism}'.`);
+ }
+ if ((this.mechanismProperties.ENVIRONMENT === 'azure' ||
+ this.mechanismProperties.ENVIRONMENT === 'gcp') &&
+ !this.mechanismProperties.TOKEN_RESOURCE) {
+ throw new error_1.MongoInvalidArgumentError(TOKEN_RESOURCE_MISSING_ERROR);
+ }
+ if (this.mechanismProperties.ENVIRONMENT &&
+ !ALLOWED_ENVIRONMENT_NAMES.includes(this.mechanismProperties.ENVIRONMENT)) {
+ throw new error_1.MongoInvalidArgumentError(`Currently only a ENVIRONMENT in ${ALLOWED_ENVIRONMENT_NAMES.join(',')} is supported for mechanism '${this.mechanism}'.`);
+ }
+ if (!this.mechanismProperties.ENVIRONMENT &&
+ !this.mechanismProperties.OIDC_CALLBACK &&
+ !this.mechanismProperties.OIDC_HUMAN_CALLBACK) {
+ throw new error_1.MongoInvalidArgumentError(`Either a ENVIRONMENT, OIDC_CALLBACK, or OIDC_HUMAN_CALLBACK must be specified for mechanism '${this.mechanism}'.`);
+ }
+ if (this.mechanismProperties.ALLOWED_HOSTS) {
+ const hosts = this.mechanismProperties.ALLOWED_HOSTS;
+ if (!Array.isArray(hosts)) {
+ throw new error_1.MongoInvalidArgumentError(ALLOWED_HOSTS_ERROR);
+ }
+ for (const host of hosts) {
+ if (typeof host !== 'string') {
+ throw new error_1.MongoInvalidArgumentError(ALLOWED_HOSTS_ERROR);
+ }
+ }
+ }
+ }
+ if (providers_1.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(this.mechanism)) {
+ if (this.source != null && this.source !== '$external') {
+ // TODO(NODE-3485): Replace this with a MongoAuthValidationError
+ throw new error_1.MongoAPIError(`Invalid source '${this.source}' for mechanism '${this.mechanism}' specified.`);
+ }
+ }
+ if (this.mechanism === providers_1.AuthMechanism.MONGODB_PLAIN && this.source == null) {
+ // TODO(NODE-3485): Replace this with a MongoAuthValidationError
+ throw new error_1.MongoAPIError('PLAIN Authentication Mechanism needs an auth source');
+ }
+ if (this.mechanism === providers_1.AuthMechanism.MONGODB_X509 && this.password != null) {
+ if (this.password === '') {
+ Reflect.set(this, 'password', undefined);
+ return;
+ }
+ // TODO(NODE-3485): Replace this with a MongoAuthValidationError
+ throw new error_1.MongoAPIError(`Password not allowed for mechanism MONGODB-X509`);
+ }
+ const canonicalization = this.mechanismProperties.CANONICALIZE_HOST_NAME ?? false;
+ if (!Object.values(gssapi_1.GSSAPICanonicalizationValue).includes(canonicalization)) {
+ throw new error_1.MongoAPIError(`Invalid CANONICALIZE_HOST_NAME value: ${canonicalization}`);
+ }
+ }
+ static merge(creds, options) {
+ return new MongoCredentials({
+ username: options.username ?? creds?.username ?? '',
+ password: options.password ?? creds?.password ?? '',
+ mechanism: options.mechanism ?? creds?.mechanism ?? providers_1.AuthMechanism.MONGODB_DEFAULT,
+ mechanismProperties: options.mechanismProperties ?? creds?.mechanismProperties ?? {},
+ source: options.source ?? options.db ?? creds?.source ?? 'admin'
+ });
+ }
+}
+exports.MongoCredentials = MongoCredentials;
+//# sourceMappingURL=mongo_credentials.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js.map b/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js.map
new file mode 100644
index 00000000..880a48b2
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"mongo_credentials.js","sourceRoot":"","sources":["../../../src/cmap/auth/mongo_credentials.ts"],"names":[],"mappings":";;;AAGA,uCAIqB;AAErB,qCAAuD;AAEvD,2CAA0E;AAE1E;;GAEG;AACH,SAAS,uBAAuB,CAAC,KAAsB;IACrD,IAAI,KAAK,EAAE,CAAC;QACV,0DAA0D;QAC1D,uCAAuC;QACvC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,yBAAa,CAAC,oBAAoB,CAAC;gBAC1E,CAAC,CAAC,yBAAa,CAAC,oBAAoB;gBACpC,CAAC,CAAC,yBAAa,CAAC,kBAAkB,CAAC;QACv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AC;QAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,sBAAsB,IAAI,KAAK,CAAC;QAClF,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,oCAA2B,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC3E,MAAM,IAAI,qBAAa,CAAC,yCAAyC,gBAAgB,EAAE,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CACV,KAAmC,EACnC,OAAyC;QAEzC,OAAO,IAAI,gBAAgB,CAAC;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK,EAAE,QAAQ,IAAI,EAAE;YACnD,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK,EAAE,QAAQ,IAAI,EAAE;YACnD,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,KAAK,EAAE,SAAS,IAAI,yBAAa,CAAC,eAAe;YACjF,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,KAAK,EAAE,mBAAmB,IAAI,EAAE;YACpF,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,EAAE,IAAI,KAAK,EAAE,MAAM,IAAI,OAAO;SACjE,CAAC,CAAC;IACL,CAAC;CACF;AA/KD,4CA+KC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js b/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js
new file mode 100644
index 00000000..5abfc7aa
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js
@@ -0,0 +1,129 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongoDBAWS = void 0;
+const bson_1 = require("../../bson");
+const BSON = require("../../bson");
+const error_1 = require("../../error");
+const utils_1 = require("../../utils");
+const auth_provider_1 = require("./auth_provider");
+const aws_temporary_credentials_1 = require("./aws_temporary_credentials");
+const aws4_1 = require("./aws4");
+const mongo_credentials_1 = require("./mongo_credentials");
+const providers_1 = require("./providers");
+const ASCII_N = 110;
+const bsonOptions = {
+ useBigInt64: false,
+ promoteLongs: true,
+ promoteValues: true,
+ promoteBuffers: false,
+ bsonRegExp: false
+};
+class MongoDBAWS extends auth_provider_1.AuthProvider {
+ constructor(credentialProvider) {
+ super();
+ this.credentialFetcher = new aws_temporary_credentials_1.AWSSDKCredentialProvider(credentialProvider);
+ }
+ async auth(authContext) {
+ const { connection } = authContext;
+ if (!authContext.credentials) {
+ throw new error_1.MongoMissingCredentialsError('AuthContext must provide credentials.');
+ }
+ if ((0, utils_1.maxWireVersion)(connection) < 9) {
+ throw new error_1.MongoCompatibilityError('MONGODB-AWS authentication requires MongoDB version 4.4 or later');
+ }
+ authContext.credentials = await makeTempCredentials(authContext.credentials, this.credentialFetcher);
+ const { credentials } = authContext;
+ const accessKeyId = credentials.username;
+ const secretAccessKey = credentials.password;
+ // Allow the user to specify an AWS session token for authentication with temporary credentials.
+ const sessionToken = credentials.mechanismProperties.AWS_SESSION_TOKEN;
+ // If all three defined, include sessionToken, else only include username and pass
+ const awsCredentials = sessionToken
+ ? { accessKeyId, secretAccessKey, sessionToken }
+ : { accessKeyId, secretAccessKey };
+ const db = credentials.source;
+ const nonce = await (0, utils_1.randomBytes)(32);
+ // All messages between MongoDB clients and servers are sent as BSON objects
+ // in the payload field of saslStart and saslContinue.
+ const saslStart = {
+ saslStart: 1,
+ mechanism: 'MONGODB-AWS',
+ payload: BSON.serialize({ r: nonce, p: ASCII_N }, bsonOptions)
+ };
+ const saslStartResponse = await connection.command((0, utils_1.ns)(`${db}.$cmd`), saslStart, undefined);
+ const serverResponse = BSON.deserialize(saslStartResponse.payload.buffer, bsonOptions);
+ const host = serverResponse.h;
+ const serverNonce = serverResponse.s.buffer;
+ if (serverNonce.length !== 64) {
+ // TODO(NODE-3483)
+ throw new error_1.MongoRuntimeError(`Invalid server nonce length ${serverNonce.length}, expected 64`);
+ }
+ if (!bson_1.ByteUtils.equals(serverNonce.subarray(0, nonce.byteLength), nonce)) {
+ // throw because the serverNonce's leading 32 bytes must equal the client nonce's 32 bytes
+ // https://github.com/mongodb/specifications/blob/master/source/auth/auth.md#conversation-5
+ // TODO(NODE-3483)
+ throw new error_1.MongoRuntimeError('Server nonce does not begin with client nonce');
+ }
+ if (host.length < 1 || host.length > 255 || host.indexOf('..') !== -1) {
+ // TODO(NODE-3483)
+ throw new error_1.MongoRuntimeError(`Server returned an invalid host: "${host}"`);
+ }
+ const body = 'Action=GetCallerIdentity&Version=2011-06-15';
+ const headers = await (0, aws4_1.aws4Sign)({
+ method: 'POST',
+ host,
+ region: deriveRegion(serverResponse.h),
+ service: 'sts',
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'Content-Length': body.length,
+ 'X-MongoDB-Server-Nonce': bson_1.ByteUtils.toBase64(serverNonce),
+ 'X-MongoDB-GS2-CB-Flag': 'n'
+ },
+ path: '/',
+ body,
+ date: new Date()
+ }, awsCredentials);
+ const payload = {
+ a: headers.Authorization,
+ d: headers['X-Amz-Date']
+ };
+ if (sessionToken) {
+ payload.t = sessionToken;
+ }
+ const saslContinue = {
+ saslContinue: 1,
+ conversationId: saslStartResponse.conversationId,
+ payload: BSON.serialize(payload, bsonOptions)
+ };
+ await connection.command((0, utils_1.ns)(`${db}.$cmd`), saslContinue, undefined);
+ }
+}
+exports.MongoDBAWS = MongoDBAWS;
+async function makeTempCredentials(credentials, awsCredentialFetcher) {
+ function makeMongoCredentialsFromAWSTemp(creds) {
+ // The AWS session token (creds.Token) may or may not be set.
+ if (!creds.AccessKeyId || !creds.SecretAccessKey) {
+ throw new error_1.MongoMissingCredentialsError('Could not obtain temporary MONGODB-AWS credentials');
+ }
+ return new mongo_credentials_1.MongoCredentials({
+ username: creds.AccessKeyId,
+ password: creds.SecretAccessKey,
+ source: credentials.source,
+ mechanism: providers_1.AuthMechanism.MONGODB_AWS,
+ mechanismProperties: {
+ AWS_SESSION_TOKEN: creds.Token
+ }
+ });
+ }
+ const temporaryCredentials = await awsCredentialFetcher.getCredentials();
+ return makeMongoCredentialsFromAWSTemp(temporaryCredentials);
+}
+function deriveRegion(host) {
+ const parts = host.split('.');
+ if (parts.length === 1 || parts[1] === 'amazonaws') {
+ return 'us-east-1';
+ }
+ return parts[1];
+}
+//# sourceMappingURL=mongodb_aws.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js.map
new file mode 100644
index 00000000..3c76eb88
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"mongodb_aws.js","sourceRoot":"","sources":["../../../src/cmap/auth/mongodb_aws.ts"],"names":[],"mappings":";;;AAAA,qCAA+E;AAC/E,mCAAmC;AACnC,uCAIqB;AACrB,uCAA8D;AAC9D,mDAAiE;AACjE,2EAIqC;AACrC,iCAAkC;AAClC,2DAAuD;AACvD,2CAA4C;AAE5C,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,MAAM,WAAW,GAAyB;IACxC,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,KAAK;IACrB,UAAU,EAAE,KAAK;CAClB,CAAC;AAQF,MAAa,UAAW,SAAQ,4BAAY;IAG1C,YAAY,kBAA0C;QACpD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,iBAAiB,GAAG,IAAI,oDAAwB,CAAC,kBAAkB,CAAC,CAAC;IAC5E,CAAC;IAEQ,KAAK,CAAC,IAAI,CAAC,WAAwB;QAC1C,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QACnC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YAC7B,MAAM,IAAI,oCAA4B,CAAC,uCAAuC,CAAC,CAAC;QAClF,CAAC;QAED,IAAI,IAAA,sBAAc,EAAC,UAAU,CAA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AAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC;QACnD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js
new file mode 100644
index 00000000..27cecbb7
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js
@@ -0,0 +1,73 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongoDBOIDC = exports.OIDC_WORKFLOWS = exports.OIDC_VERSION = void 0;
+const error_1 = require("../../error");
+const auth_provider_1 = require("./auth_provider");
+const automated_callback_workflow_1 = require("./mongodb_oidc/automated_callback_workflow");
+const azure_machine_workflow_1 = require("./mongodb_oidc/azure_machine_workflow");
+const gcp_machine_workflow_1 = require("./mongodb_oidc/gcp_machine_workflow");
+const k8s_machine_workflow_1 = require("./mongodb_oidc/k8s_machine_workflow");
+const token_cache_1 = require("./mongodb_oidc/token_cache");
+const token_machine_workflow_1 = require("./mongodb_oidc/token_machine_workflow");
+/** Error when credentials are missing. */
+const MISSING_CREDENTIALS_ERROR = 'AuthContext must provide credentials.';
+/** The current version of OIDC implementation. */
+exports.OIDC_VERSION = 1;
+/** @internal */
+exports.OIDC_WORKFLOWS = new Map();
+exports.OIDC_WORKFLOWS.set('test', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), token_machine_workflow_1.tokenMachineCallback));
+exports.OIDC_WORKFLOWS.set('azure', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), azure_machine_workflow_1.azureCallback));
+exports.OIDC_WORKFLOWS.set('gcp', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), gcp_machine_workflow_1.gcpCallback));
+exports.OIDC_WORKFLOWS.set('k8s', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), k8s_machine_workflow_1.k8sCallback));
+/**
+ * OIDC auth provider.
+ */
+class MongoDBOIDC extends auth_provider_1.AuthProvider {
+ /**
+ * Instantiate the auth provider.
+ */
+ constructor(workflow) {
+ super();
+ if (!workflow) {
+ throw new error_1.MongoInvalidArgumentError('No workflow provided to the OIDC auth provider.');
+ }
+ this.workflow = workflow;
+ }
+ /**
+ * Authenticate using OIDC
+ */
+ async auth(authContext) {
+ const { connection, reauthenticating, response } = authContext;
+ if (response?.speculativeAuthenticate?.done && !reauthenticating) {
+ return;
+ }
+ const credentials = getCredentials(authContext);
+ if (reauthenticating) {
+ await this.workflow.reauthenticate(connection, credentials);
+ }
+ else {
+ await this.workflow.execute(connection, credentials, response);
+ }
+ }
+ /**
+ * Add the speculative auth for the initial handshake.
+ */
+ async prepare(handshakeDoc, authContext) {
+ const { connection } = authContext;
+ const credentials = getCredentials(authContext);
+ const result = await this.workflow.speculativeAuth(connection, credentials);
+ return { ...handshakeDoc, ...result };
+ }
+}
+exports.MongoDBOIDC = MongoDBOIDC;
+/**
+ * Get credentials from the auth context, throwing if they do not exist.
+ */
+function getCredentials(authContext) {
+ const { credentials } = authContext;
+ if (!credentials) {
+ throw new error_1.MongoMissingCredentialsError(MISSING_CREDENTIALS_ERROR);
+ }
+ return credentials;
+}
+//# sourceMappingURL=mongodb_oidc.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js.map
new file mode 100644
index 00000000..d3756c11
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"mongodb_oidc.js","sourceRoot":"","sources":["../../../src/cmap/auth/mongodb_oidc.ts"],"names":[],"mappings":";;;AACA,uCAAsF;AAGtF,mDAAiE;AAEjE,4FAAuF;A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AAE,CAAC;YACjE,OAAO;QACT,CAAC;QACD,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAED;;OAEG;IACM,KAAK,CAAC,OAAO,CACpB,YAA+B,EAC/B,WAAwB;QAExB,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QACnC,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAC5E,OAAO,EAAE,GAAG,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;IACxC,CAAC;CACF;AA1CD,kCA0CC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,WAAwB;IAC9C,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;IACpC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,oCAA4B,CAAC,yBAAyB,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js
new file mode 100644
index 00000000..8e5f4f3e
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js
@@ -0,0 +1,84 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AutomatedCallbackWorkflow = void 0;
+const error_1 = require("../../../error");
+const timeout_1 = require("../../../timeout");
+const mongodb_oidc_1 = require("../mongodb_oidc");
+const callback_workflow_1 = require("./callback_workflow");
+/**
+ * Class implementing behaviour for the non human callback workflow.
+ * @internal
+ */
+class AutomatedCallbackWorkflow extends callback_workflow_1.CallbackWorkflow {
+ /**
+ * Instantiate the human callback workflow.
+ */
+ constructor(cache, callback) {
+ super(cache, callback);
+ }
+ /**
+ * Execute the OIDC callback workflow.
+ */
+ async execute(connection, credentials) {
+ // If there is a cached access token, try to authenticate with it. If
+ // authentication fails with an Authentication error (18),
+ // invalidate the access token, fetch a new access token, and try
+ // to authenticate again.
+ // If the server fails for any other reason, do not clear the cache.
+ if (this.cache.hasAccessToken) {
+ const token = this.cache.getAccessToken();
+ if (!connection.accessToken) {
+ connection.accessToken = token;
+ }
+ try {
+ return await this.finishAuthentication(connection, credentials, token);
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoError &&
+ error.code === error_1.MONGODB_ERROR_CODES.AuthenticationFailed) {
+ this.cache.removeAccessToken();
+ return await this.execute(connection, credentials);
+ }
+ else {
+ throw error;
+ }
+ }
+ }
+ const response = await this.fetchAccessToken(credentials);
+ this.cache.put(response);
+ connection.accessToken = response.accessToken;
+ await this.finishAuthentication(connection, credentials, response.accessToken);
+ }
+ /**
+ * Fetches the access token using the callback.
+ */
+ async fetchAccessToken(credentials) {
+ const controller = new AbortController();
+ const params = {
+ timeoutContext: controller.signal,
+ version: mongodb_oidc_1.OIDC_VERSION
+ };
+ if (credentials.username) {
+ params.username = credentials.username;
+ }
+ if (credentials.mechanismProperties.TOKEN_RESOURCE) {
+ params.tokenAudience = credentials.mechanismProperties.TOKEN_RESOURCE;
+ }
+ const timeout = timeout_1.Timeout.expires(callback_workflow_1.AUTOMATED_TIMEOUT_MS);
+ try {
+ return await Promise.race([this.executeAndValidateCallback(params), timeout]);
+ }
+ catch (error) {
+ if (timeout_1.TimeoutError.is(error)) {
+ controller.abort();
+ throw new error_1.MongoOIDCError(`OIDC callback timed out after ${callback_workflow_1.AUTOMATED_TIMEOUT_MS}ms.`);
+ }
+ throw error;
+ }
+ finally {
+ timeout.clear();
+ }
+ }
+}
+exports.AutomatedCallbackWorkflow = AutomatedCallbackWorkflow;
+//# sourceMappingURL=automated_callback_workflow.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js.map
new file mode 100644
index 00000000..40b3ab0f
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"automated_callback_workflow.js","sourceRoot":"","sources":["../../../../src/cmap/auth/mongodb_oidc/automated_callback_workflow.ts"],"names":[],"mappings":";;;AAAA,0CAAiF;AACjF,8CAAyD;AAGzD,kDAKyB;AACzB,2DAA6E;AAG7E;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,oCAAgB;IAC7D;;OAEG;IACH,YAAY,KAAiB,EAAE,QAA8B;QAC3D,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,UAAsB,EAAE,WAA6B;QACjE,qEAAqE;QACrE,0DAA0D;QAC1D,iEAAiE;QACjE,yBAAyB;QACzB,oEAAoE;QACpE,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;YAC1C,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;gBAC5B,UAAU,CAAC,WAAW,GAAG,KAAK,CAAC;YACjC,CAAC;YACD,IAAI,CAAC;gBACH,OAAO,MAAM,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;YACzE,CAAC;YAAC,OAAO,KAAK,EAAE,C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E,OAAO,CAAC,CAAC,CAAC;QAChF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,sBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,UAAU,CAAC,KAAK,EAAE,CAAC;gBACnB,MAAM,IAAI,sBAAc,CAAC,iCAAiC,wCAAoB,KAAK,CAAC,CAAC;YACvF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;CACF;AAtED,8DAsEC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js
new file mode 100644
index 00000000..d829e6bc
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js
@@ -0,0 +1,62 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.azureCallback = void 0;
+const azure_1 = require("../../../client-side-encryption/providers/azure");
+const error_1 = require("../../../error");
+const utils_1 = require("../../../utils");
+/** Azure request headers. */
+const AZURE_HEADERS = Object.freeze({ Metadata: 'true', Accept: 'application/json' });
+/** Invalid endpoint result error. */
+const ENDPOINT_RESULT_ERROR = 'Azure endpoint did not return a value with only access_token and expires_in properties';
+/** Error for when the token audience is missing in the environment. */
+const TOKEN_RESOURCE_MISSING_ERROR = 'TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is azure.';
+/**
+ * The callback function to be used in the automated callback workflow.
+ * @param params - The OIDC callback parameters.
+ * @returns The OIDC response.
+ */
+const azureCallback = async (params) => {
+ const tokenAudience = params.tokenAudience;
+ const username = params.username;
+ if (!tokenAudience) {
+ throw new error_1.MongoAzureError(TOKEN_RESOURCE_MISSING_ERROR);
+ }
+ const response = await getAzureTokenData(tokenAudience, username);
+ if (!isEndpointResultValid(response)) {
+ throw new error_1.MongoAzureError(ENDPOINT_RESULT_ERROR);
+ }
+ return response;
+};
+exports.azureCallback = azureCallback;
+/**
+ * Hit the Azure endpoint to get the token data.
+ */
+async function getAzureTokenData(tokenAudience, username) {
+ const url = new URL(azure_1.AZURE_BASE_URL);
+ (0, azure_1.addAzureParams)(url, tokenAudience, username);
+ const response = await (0, utils_1.get)(url, {
+ headers: AZURE_HEADERS
+ });
+ if (response.status !== 200) {
+ throw new error_1.MongoAzureError(`Status code ${response.status} returned from the Azure endpoint. Response body: ${response.body}`);
+ }
+ const result = JSON.parse(response.body);
+ return {
+ accessToken: result.access_token,
+ expiresInSeconds: Number(result.expires_in)
+ };
+}
+/**
+ * Determines if a result returned from the endpoint is valid.
+ * This means the result is not nullish, contains the access_token required field
+ * and the expires_in required field.
+ */
+function isEndpointResultValid(token) {
+ if (token == null || typeof token !== 'object')
+ return false;
+ return ('accessToken' in token &&
+ typeof token.accessToken === 'string' &&
+ 'expiresInSeconds' in token &&
+ typeof token.expiresInSeconds === 'number');
+}
+//# sourceMappingURL=azure_machine_workflow.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js.map
new file mode 100644
index 00000000..bbd7f300
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"azure_machine_workflow.js","sourceRoot":"","sources":["../../../../src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts"],"names":[],"mappings":";;;AAAA,2EAAiG;AACjG,0CAAiD;AACjD,0CAAqC;AAGrC,6BAA6B;AAC7B,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAEtF,qCAAqC;AACrC,MAAM,qBAAqB,GACzB,wF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C,MAAM,CAAC,UAAU,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,qBAAqB,CAC5B,KAAc;IAEd,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7D,OAAO,CACL,aAAa,IAAI,KAAK;QACtB,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;QACrC,kBAAkB,IAAI,KAAK;QAC3B,OAAO,KAAK,CAAC,gBAAgB,KAAK,QAAQ,CAC3C,CAAC;AACJ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js
new file mode 100644
index 00000000..97c3eff2
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js
@@ -0,0 +1,141 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CallbackWorkflow = exports.AUTOMATED_TIMEOUT_MS = exports.HUMAN_TIMEOUT_MS = void 0;
+const promises_1 = require("timers/promises");
+const error_1 = require("../../../error");
+const utils_1 = require("../../../utils");
+const command_builders_1 = require("./command_builders");
+/** 5 minutes in milliseconds */
+exports.HUMAN_TIMEOUT_MS = 300000;
+/** 1 minute in milliseconds */
+exports.AUTOMATED_TIMEOUT_MS = 60000;
+/** Properties allowed on results of callbacks. */
+const RESULT_PROPERTIES = ['accessToken', 'expiresInSeconds', 'refreshToken'];
+/** Error message when the callback result is invalid. */
+const CALLBACK_RESULT_ERROR = 'User provided OIDC callbacks must return a valid object with an accessToken.';
+/** The time to throttle callback calls. */
+const THROTTLE_MS = 100;
+/**
+ * OIDC implementation of a callback based workflow.
+ * @internal
+ */
+class CallbackWorkflow {
+ /**
+ * Instantiate the callback workflow.
+ */
+ constructor(cache, callback) {
+ this.cache = cache;
+ this.callback = this.withLock(callback);
+ this.lastExecutionTime = Date.now() - THROTTLE_MS;
+ }
+ /**
+ * Get the document to add for speculative authentication. This also needs
+ * to add a db field from the credentials source.
+ */
+ async speculativeAuth(connection, credentials) {
+ // Check if the Client Cache has an access token.
+ // If it does, cache the access token in the Connection Cache and send a JwtStepRequest
+ // with the cached access token in the speculative authentication SASL payload.
+ if (this.cache.hasAccessToken) {
+ const accessToken = this.cache.getAccessToken();
+ connection.accessToken = accessToken;
+ const document = (0, command_builders_1.finishCommandDocument)(accessToken);
+ document.db = credentials.source;
+ return { speculativeAuthenticate: document };
+ }
+ return {};
+ }
+ /**
+ * Reauthenticate the callback workflow. For this we invalidated the access token
+ * in the cache and run the authentication steps again. No initial handshake needs
+ * to be sent.
+ */
+ async reauthenticate(connection, credentials) {
+ if (this.cache.hasAccessToken) {
+ // Reauthentication implies the token has expired.
+ if (connection.accessToken === this.cache.getAccessToken()) {
+ // If connection's access token is the same as the cache's, remove
+ // the token from the cache and connection.
+ this.cache.removeAccessToken();
+ delete connection.accessToken;
+ }
+ else {
+ // If the connection's access token is different from the cache's, set
+ // the cache's token on the connection and do not remove from the
+ // cache.
+ connection.accessToken = this.cache.getAccessToken();
+ }
+ }
+ await this.execute(connection, credentials);
+ }
+ /**
+ * Starts the callback authentication process. If there is a speculative
+ * authentication document from the initial handshake, then we will use that
+ * value to get the issuer, otherwise we will send the saslStart command.
+ */
+ async startAuthentication(connection, credentials, response) {
+ let result;
+ if (response?.speculativeAuthenticate) {
+ result = response.speculativeAuthenticate;
+ }
+ else {
+ result = await connection.command((0, utils_1.ns)(credentials.source), (0, command_builders_1.startCommandDocument)(credentials), undefined);
+ }
+ return result;
+ }
+ /**
+ * Finishes the callback authentication process.
+ */
+ async finishAuthentication(connection, credentials, token, conversationId) {
+ await connection.command((0, utils_1.ns)(credentials.source), (0, command_builders_1.finishCommandDocument)(token, conversationId), undefined);
+ }
+ /**
+ * Executes the callback and validates the output.
+ */
+ async executeAndValidateCallback(params) {
+ const result = await this.callback(params);
+ // Validate that the result returned by the callback is acceptable. If it is not
+ // we must clear the token result from the cache.
+ if (isCallbackResultInvalid(result)) {
+ throw new error_1.MongoMissingCredentialsError(CALLBACK_RESULT_ERROR);
+ }
+ return result;
+ }
+ /**
+ * Ensure the callback is only executed one at a time and throttles the calls
+ * to every 100ms.
+ */
+ withLock(callback) {
+ let lock = Promise.resolve();
+ return async (params) => {
+ // We do this to ensure that we would never return the result of the
+ // previous lock, only the current callback's value would get returned.
+ await lock;
+ lock = lock
+ .catch(() => null)
+ .then(async () => {
+ const difference = Date.now() - this.lastExecutionTime;
+ if (difference <= THROTTLE_MS) {
+ await (0, promises_1.setTimeout)(THROTTLE_MS - difference, { signal: params.timeoutContext });
+ }
+ this.lastExecutionTime = Date.now();
+ return await callback(params);
+ });
+ return await lock;
+ };
+ }
+}
+exports.CallbackWorkflow = CallbackWorkflow;
+/**
+ * Determines if a result returned from a request or refresh callback
+ * function is invalid. This means the result is nullish, doesn't contain
+ * the accessToken required field, and does not contain extra fields.
+ */
+function isCallbackResultInvalid(tokenResult) {
+ if (tokenResult == null || typeof tokenResult !== 'object')
+ return true;
+ if (!('accessToken' in tokenResult))
+ return true;
+ return !Object.getOwnPropertyNames(tokenResult).every(prop => RESULT_PROPERTIES.includes(prop));
+}
+//# sourceMappingURL=callback_workflow.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js.map
new file mode 100644
index 00000000..45013d10
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"callback_workflow.js","sourceRoot":"","sources":["../../../../src/cmap/auth/mongodb_oidc/callback_workflow.ts"],"names":[],"mappings":";;;AAAA,8CAA6C;AAG7C,0CAA8D;AAC9D,0CAAoC;AASpC,yDAAiF;AAGjF,gCAAgC;AACnB,QAAA,gBAAgB,GAAG,MAAM,CAAC;AACvC,+BA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,CAAC,CAAC;AAClG,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.js
new file mode 100644
index 00000000..2ea96d2a
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.js
@@ -0,0 +1,44 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.finishCommandDocument = finishCommandDocument;
+exports.startCommandDocument = startCommandDocument;
+const bson_1 = require("../../../bson");
+const providers_1 = require("../providers");
+/**
+ * Generate the finishing command document for authentication. Will be a
+ * saslStart or saslContinue depending on the presence of a conversation id.
+ */
+function finishCommandDocument(token, conversationId) {
+ if (conversationId != null) {
+ return {
+ saslContinue: 1,
+ conversationId: conversationId,
+ payload: new bson_1.Binary(bson_1.BSON.serialize({ jwt: token }))
+ };
+ }
+ // saslContinue requires a conversationId in the command to be valid so in this
+ // case the server allows "step two" to actually be a saslStart with the token
+ // as the jwt since the use of the cached value has no correlating conversating
+ // on the particular connection.
+ return {
+ saslStart: 1,
+ mechanism: providers_1.AuthMechanism.MONGODB_OIDC,
+ payload: new bson_1.Binary(bson_1.BSON.serialize({ jwt: token }))
+ };
+}
+/**
+ * Generate the saslStart command document.
+ */
+function startCommandDocument(credentials) {
+ const payload = {};
+ if (credentials.username) {
+ payload.n = credentials.username;
+ }
+ return {
+ saslStart: 1,
+ autoAuthorize: 1,
+ mechanism: providers_1.AuthMechanism.MONGODB_OIDC,
+ payload: new bson_1.Binary(bson_1.BSON.serialize(payload))
+ };
+}
+//# sourceMappingURL=command_builders.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.js.map
new file mode 100644
index 00000000..c2de30c9
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"command_builders.js","sourceRoot":"","sources":["../../../../src/cmap/auth/mongodb_oidc/command_builders.ts"],"names":[],"mappings":";;AAmBA,sDAiBC;AAKD,oDAWC;AApDD,wCAA4D;AAE5D,4CAA6C;AAa7C;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,KAAa,EAAE,cAAuB;IAC1E,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;QAC3B,OAAO;YACL,YAAY,EAAE,CAAC;YACf,cAAc,EAAE,cAAc;YAC9B,OAAO,EAAE,IAAI,aAAM,CAAC,WAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;SACpD,CAAC;IACJ,CAAC;IACD,+EAA+E;IAC/E,8EAA8E;IAC9E,+EAA+E;IAC/E,gCAAgC;IAChC,OAAO;QACL,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,yBAAa,CAAC,YAAY;QACrC,OAAO,EAAE,IAAI,aAAM,CAAC,WAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;KACpD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,WAA6B;IAChE,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,CAAC,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC;IACnC,CAAC;IACD,OAAO;QACL,SAAS,EAAE,CAAC;QACZ,aAAa,EAAE,CAAC;QAChB,SAAS,EAAE,yBAAa,CAAC,YAAY;QACrC,OAAO,EAAE,IAAI,aAAM,CAAC,WAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;KAC7C,CAAC;AACJ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js
new file mode 100644
index 00000000..c4a90b52
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js
@@ -0,0 +1,39 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.gcpCallback = void 0;
+const error_1 = require("../../../error");
+const utils_1 = require("../../../utils");
+/** GCP base URL. */
+const GCP_BASE_URL = 'http://metadata/computeMetadata/v1/instance/service-accounts/default/identity';
+/** GCP request headers. */
+const GCP_HEADERS = Object.freeze({ 'Metadata-Flavor': 'Google' });
+/** Error for when the token audience is missing in the environment. */
+const TOKEN_RESOURCE_MISSING_ERROR = 'TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is gcp.';
+/**
+ * The callback function to be used in the automated callback workflow.
+ * @param params - The OIDC callback parameters.
+ * @returns The OIDC response.
+ */
+const gcpCallback = async (params) => {
+ const tokenAudience = params.tokenAudience;
+ if (!tokenAudience) {
+ throw new error_1.MongoGCPError(TOKEN_RESOURCE_MISSING_ERROR);
+ }
+ return await getGcpTokenData(tokenAudience);
+};
+exports.gcpCallback = gcpCallback;
+/**
+ * Hit the GCP endpoint to get the token data.
+ */
+async function getGcpTokenData(tokenAudience) {
+ const url = new URL(GCP_BASE_URL);
+ url.searchParams.append('audience', tokenAudience);
+ const response = await (0, utils_1.get)(url, {
+ headers: GCP_HEADERS
+ });
+ if (response.status !== 200) {
+ throw new error_1.MongoGCPError(`Status code ${response.status} returned from the GCP endpoint. Response body: ${response.body}`);
+ }
+ return { accessToken: response.body };
+}
+//# sourceMappingURL=gcp_machine_workflow.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js.map
new file mode 100644
index 00000000..f55f8ef2
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"gcp_machine_workflow.js","sourceRoot":"","sources":["../../../../src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts"],"names":[],"mappings":";;;AAAA,0CAA+C;AAC/C,0CAAqC;AAGrC,oBAAoB;AACpB,MAAM,YAAY,GAChB,+EAA+E,CAAC;AAElF,2BAA2B;AAC3B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,CAAC;AAEnE,uEAAuE;AACvE,MAAM,4BAA4B,GAChC,sFAAsF,CAAC;AAEzF;;;;GAIG;AACI,MAAM,WAAW,GAAyB,KAAK,EACpD,MAA0B,EACH,EAAE;IACzB,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;IAC3C,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,qBAAa,CAAC,4BAA4B,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,MAAM,eAAe,CAAC,aAAa,CAAC,CAAC;AAC9C,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB;AAEF;;GAEG;AACH,KAAK,UAAU,eAAe,CAAC,aAAqB;IAClD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;IAClC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,MAAM,IAAA,WAAG,EAAC,GAAG,EAAE;QAC9B,OAAO,EAAE,WAAW;KACrB,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,MAAM,IAAI,qBAAa,CACrB,eAAe,QAAQ,CAAC,MAAM,mDAAmD,QAAQ,CAAC,IAAI,EAAE,CACjG,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;AACxC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js
new file mode 100644
index 00000000..dc0556e2
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js
@@ -0,0 +1,122 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.HumanCallbackWorkflow = void 0;
+const bson_1 = require("../../../bson");
+const error_1 = require("../../../error");
+const timeout_1 = require("../../../timeout");
+const mongodb_oidc_1 = require("../mongodb_oidc");
+const callback_workflow_1 = require("./callback_workflow");
+/**
+ * Class implementing behaviour for the non human callback workflow.
+ * @internal
+ */
+class HumanCallbackWorkflow extends callback_workflow_1.CallbackWorkflow {
+ /**
+ * Instantiate the human callback workflow.
+ */
+ constructor(cache, callback) {
+ super(cache, callback);
+ }
+ /**
+ * Execute the OIDC human callback workflow.
+ */
+ async execute(connection, credentials) {
+ // Check if the Client Cache has an access token.
+ // If it does, cache the access token in the Connection Cache and perform a One-Step SASL conversation
+ // using the access token. If the server returns an Authentication error (18),
+ // invalidate the access token token from the Client Cache, clear the Connection Cache,
+ // and restart the authentication flow. Raise any other errors to the user. On success, exit the algorithm.
+ if (this.cache.hasAccessToken) {
+ const token = this.cache.getAccessToken();
+ connection.accessToken = token;
+ try {
+ return await this.finishAuthentication(connection, credentials, token);
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoError &&
+ error.code === error_1.MONGODB_ERROR_CODES.AuthenticationFailed) {
+ this.cache.removeAccessToken();
+ delete connection.accessToken;
+ return await this.execute(connection, credentials);
+ }
+ else {
+ throw error;
+ }
+ }
+ }
+ // Check if the Client Cache has a refresh token.
+ // If it does, call the OIDC Human Callback with the cached refresh token and IdpInfo to get a
+ // new access token. Cache the new access token in the Client Cache and Connection Cache.
+ // Perform a One-Step SASL conversation using the new access token. If the the server returns
+ // an Authentication error (18), clear the refresh token, invalidate the access token from the
+ // Client Cache, clear the Connection Cache, and restart the authentication flow. Raise any other
+ // errors to the user. On success, exit the algorithm.
+ if (this.cache.hasRefreshToken) {
+ const refreshToken = this.cache.getRefreshToken();
+ const result = await this.fetchAccessToken(this.cache.getIdpInfo(), credentials, refreshToken);
+ this.cache.put(result);
+ connection.accessToken = result.accessToken;
+ try {
+ return await this.finishAuthentication(connection, credentials, result.accessToken);
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoError &&
+ error.code === error_1.MONGODB_ERROR_CODES.AuthenticationFailed) {
+ this.cache.removeRefreshToken();
+ delete connection.accessToken;
+ return await this.execute(connection, credentials);
+ }
+ else {
+ throw error;
+ }
+ }
+ }
+ // Start a new Two-Step SASL conversation.
+ // Run a PrincipalStepRequest to get the IdpInfo.
+ // Call the OIDC Human Callback with the new IdpInfo to get a new access token and optional refresh
+ // token. Drivers MUST NOT pass a cached refresh token to the callback when performing
+ // a new Two-Step conversation. Cache the new IdpInfo and refresh token in the Client Cache and the
+ // new access token in the Client Cache and Connection Cache.
+ // Attempt to authenticate using a JwtStepRequest with the new access token. Raise any errors to the user.
+ const startResponse = await this.startAuthentication(connection, credentials);
+ const conversationId = startResponse.conversationId;
+ const idpInfo = bson_1.BSON.deserialize(startResponse.payload.buffer);
+ const callbackResponse = await this.fetchAccessToken(idpInfo, credentials);
+ this.cache.put(callbackResponse, idpInfo);
+ connection.accessToken = callbackResponse.accessToken;
+ return await this.finishAuthentication(connection, credentials, callbackResponse.accessToken, conversationId);
+ }
+ /**
+ * Fetches an access token using the callback.
+ */
+ async fetchAccessToken(idpInfo, credentials, refreshToken) {
+ const controller = new AbortController();
+ const params = {
+ timeoutContext: controller.signal,
+ version: mongodb_oidc_1.OIDC_VERSION,
+ idpInfo: idpInfo
+ };
+ if (credentials.username) {
+ params.username = credentials.username;
+ }
+ if (refreshToken) {
+ params.refreshToken = refreshToken;
+ }
+ const timeout = timeout_1.Timeout.expires(callback_workflow_1.HUMAN_TIMEOUT_MS);
+ try {
+ return await Promise.race([this.executeAndValidateCallback(params), timeout]);
+ }
+ catch (error) {
+ if (timeout_1.TimeoutError.is(error)) {
+ controller.abort();
+ throw new error_1.MongoOIDCError(`OIDC callback timed out after ${callback_workflow_1.HUMAN_TIMEOUT_MS}ms.`);
+ }
+ throw error;
+ }
+ finally {
+ timeout.clear();
+ }
+ }
+}
+exports.HumanCallbackWorkflow = HumanCallbackWorkflow;
+//# sourceMappingURL=human_callback_workflow.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js.map
new file mode 100644
index 00000000..4e64bc67
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"human_callback_workflow.js","sourceRoot":"","sources":["../../../../src/cmap/auth/mongodb_oidc/human_callback_workflow.ts"],"names":[],"mappings":";;;AAAA,wCAAqC;AACrC,0CAAiF;AACjF,8CAAyD;AAGzD,kDAMyB;AACzB,2DAAyE;AAGzE;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,oCAAgB;IACzD;;OAEG;IACH,YAAY,KAAiB,EAAE,QAA8B;QAC3D,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,UAAsB,EAAE,WAA6B;QACjE,iDAAiD;QACjD,sGAAsG;QACtG,8EAA8E;QAC9E,uFAAuF;QACvF,2GAA2G;QAC3G,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;YAC1C,UAAU,CAAC,WAAW,GAAG,KAAK,CAAC;YAC/B,IAAI,CAAC;gBACH,OAAO,MAAM,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;YACzE,CAAC;YAAC,OAAO,KAAK,EAAE,C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AAO,CAAC,OAAO,CAAC,oCAAgB,CAAC,CAAC;QAClD,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QAChF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,sBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,UAAU,CAAC,KAAK,EAAE,CAAC;gBACnB,MAAM,IAAI,sBAAc,CAAC,iCAAiC,oCAAgB,KAAK,CAAC,CAAC;YACnF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;CACF;AAzHD,sDAyHC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js
new file mode 100644
index 00000000..e0c8e63a
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js
@@ -0,0 +1,32 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.k8sCallback = void 0;
+const promises_1 = require("fs/promises");
+const process = require("process");
+/** The fallback file name */
+const FALLBACK_FILENAME = '/var/run/secrets/kubernetes.io/serviceaccount/token';
+/** The azure environment variable for the file name. */
+const AZURE_FILENAME = 'AZURE_FEDERATED_TOKEN_FILE';
+/** The AWS environment variable for the file name. */
+const AWS_FILENAME = 'AWS_WEB_IDENTITY_TOKEN_FILE';
+/**
+ * The callback function to be used in the automated callback workflow.
+ * @param params - The OIDC callback parameters.
+ * @returns The OIDC response.
+ */
+const k8sCallback = async () => {
+ let filename;
+ if (process.env[AZURE_FILENAME]) {
+ filename = process.env[AZURE_FILENAME];
+ }
+ else if (process.env[AWS_FILENAME]) {
+ filename = process.env[AWS_FILENAME];
+ }
+ else {
+ filename = FALLBACK_FILENAME;
+ }
+ const token = await (0, promises_1.readFile)(filename, 'utf8');
+ return { accessToken: token };
+};
+exports.k8sCallback = k8sCallback;
+//# sourceMappingURL=k8s_machine_workflow.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js.map
new file mode 100644
index 00000000..a49bcb68
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"k8s_machine_workflow.js","sourceRoot":"","sources":["../../../../src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AACvC,mCAAmC;AAInC,6BAA6B;AAC7B,MAAM,iBAAiB,GAAG,qDAAqD,CAAC;AAEhF,wDAAwD;AACxD,MAAM,cAAc,GAAG,4BAA4B,CAAC;AAEpD,sDAAsD;AACtD,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAEnD;;;;GAIG;AACI,MAAM,WAAW,GAAyB,KAAK,IAA2B,EAAE;IACjF,IAAI,QAAgB,CAAC;IACrB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACzC,CAAC;SAAM,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QACrC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,iBAAiB,CAAC;IAC/B,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAChC,CAAC,CAAC;AAXW,QAAA,WAAW,eAWtB"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.js
new file mode 100644
index 00000000..dcf061cc
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.js
@@ -0,0 +1,52 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.TokenCache = void 0;
+const error_1 = require("../../../error");
+class MongoOIDCError extends error_1.MongoDriverError {
+}
+/** @internal */
+class TokenCache {
+ get hasAccessToken() {
+ return !!this.accessToken;
+ }
+ get hasRefreshToken() {
+ return !!this.refreshToken;
+ }
+ get hasIdpInfo() {
+ return !!this.idpInfo;
+ }
+ getAccessToken() {
+ if (!this.accessToken) {
+ throw new MongoOIDCError('Attempted to get an access token when none exists.');
+ }
+ return this.accessToken;
+ }
+ getRefreshToken() {
+ if (!this.refreshToken) {
+ throw new MongoOIDCError('Attempted to get a refresh token when none exists.');
+ }
+ return this.refreshToken;
+ }
+ getIdpInfo() {
+ if (!this.idpInfo) {
+ throw new MongoOIDCError('Attempted to get IDP information when none exists.');
+ }
+ return this.idpInfo;
+ }
+ put(response, idpInfo) {
+ this.accessToken = response.accessToken;
+ this.refreshToken = response.refreshToken;
+ this.expiresInSeconds = response.expiresInSeconds;
+ if (idpInfo) {
+ this.idpInfo = idpInfo;
+ }
+ }
+ removeAccessToken() {
+ this.accessToken = undefined;
+ }
+ removeRefreshToken() {
+ this.refreshToken = undefined;
+ }
+}
+exports.TokenCache = TokenCache;
+//# sourceMappingURL=token_cache.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.js.map
new file mode 100644
index 00000000..cc6e98c0
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"token_cache.js","sourceRoot":"","sources":["../../../../src/cmap/auth/mongodb_oidc/token_cache.ts"],"names":[],"mappings":";;;AAAA,0CAAkD;AAGlD,MAAM,cAAe,SAAQ,wBAAgB;CAAG;AAEhD,gBAAgB;AAChB,MAAa,UAAU;IAMrB,IAAI,cAAc;QAChB,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,cAAc,CAAC,oDAAoD,CAAC,CAAC;QACjF,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,MAAM,IAAI,cAAc,CAAC,oDAAoD,CAAC,CAAC;QACjF,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,cAAc,CAAC,oDAAoD,CAAC,CAAC;QACjF,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,GAAG,CAAC,QAAsB,EAAE,OAAiB;QAC3C,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,gBAAgB,CAAC;QAClD,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;IACH,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAChC,CAAC;CACF;AAvDD,gCAuDC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js
new file mode 100644
index 00000000..ba06d04c
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js
@@ -0,0 +1,23 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.tokenMachineCallback = void 0;
+const fs = require("fs");
+const process = require("process");
+const error_1 = require("../../../error");
+/** Error for when the token is missing in the environment. */
+const TOKEN_MISSING_ERROR = 'OIDC_TOKEN_FILE must be set in the environment.';
+/**
+ * The callback function to be used in the automated callback workflow.
+ * @param params - The OIDC callback parameters.
+ * @returns The OIDC response.
+ */
+const tokenMachineCallback = async () => {
+ const tokenFile = process.env.OIDC_TOKEN_FILE;
+ if (!tokenFile) {
+ throw new error_1.MongoAWSError(TOKEN_MISSING_ERROR);
+ }
+ const token = await fs.promises.readFile(tokenFile, 'utf8');
+ return { accessToken: token };
+};
+exports.tokenMachineCallback = tokenMachineCallback;
+//# sourceMappingURL=token_machine_workflow.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js.map b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js.map
new file mode 100644
index 00000000..19c7fb03
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"token_machine_workflow.js","sourceRoot":"","sources":["../../../../src/cmap/auth/mongodb_oidc/token_machine_workflow.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,mCAAmC;AAEnC,0CAA+C;AAG/C,8DAA8D;AAC9D,MAAM,mBAAmB,GAAG,iDAAiD,CAAC;AAE9E;;;;GAIG;AACI,MAAM,oBAAoB,GAAyB,KAAK,IAA2B,EAAE;IAC1F,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,qBAAa,CAAC,mBAAmB,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC5D,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAChC,CAAC,CAAC;AAPW,QAAA,oBAAoB,wBAO/B"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/plain.js b/node_modules/mongodb/lib/cmap/auth/plain.js
new file mode 100644
index 00000000..c34eab9f
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/plain.js
@@ -0,0 +1,26 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Plain = void 0;
+const bson_1 = require("../../bson");
+const error_1 = require("../../error");
+const utils_1 = require("../../utils");
+const auth_provider_1 = require("./auth_provider");
+class Plain extends auth_provider_1.AuthProvider {
+ async auth(authContext) {
+ const { connection, credentials } = authContext;
+ if (!credentials) {
+ throw new error_1.MongoMissingCredentialsError('AuthContext must provide credentials.');
+ }
+ const { username, password } = credentials;
+ const payload = new bson_1.Binary(bson_1.ByteUtils.fromUTF8(`\x00${username}\x00${password}`));
+ const command = {
+ saslStart: 1,
+ mechanism: 'PLAIN',
+ payload: payload,
+ autoAuthorize: 1
+ };
+ await connection.command((0, utils_1.ns)('$external.$cmd'), command, undefined);
+ }
+}
+exports.Plain = Plain;
+//# sourceMappingURL=plain.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/plain.js.map b/node_modules/mongodb/lib/cmap/auth/plain.js.map
new file mode 100644
index 00000000..e039d08f
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/plain.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"plain.js","sourceRoot":"","sources":["../../../src/cmap/auth/plain.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAC/C,uCAA2D;AAC3D,uCAAiC;AACjC,mDAAiE;AAEjE,MAAa,KAAM,SAAQ,4BAAY;IAC5B,KAAK,CAAC,IAAI,CAAC,WAAwB;QAC1C,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;QAChD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,oCAA4B,CAAC,uCAAuC,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;QAE3C,MAAM,OAAO,GAAG,IAAI,aAAM,CAAC,gBAAS,CAAC,QAAQ,CAAC,OAAO,QAAQ,OAAO,QAAQ,EAAE,CAAC,CAAC,CAAC;QACjF,MAAM,OAAO,GAAG;YACd,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,OAAO;YAClB,OAAO,EAAE,OAAO;YAChB,aAAa,EAAE,CAAC;SACjB,CAAC;QAEF,MAAM,UAAU,CAAC,OAAO,CAAC,IAAA,UAAE,EAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;CACF;AAnBD,sBAmBC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/providers.js b/node_modules/mongodb/lib/cmap/auth/providers.js
new file mode 100644
index 00000000..4402e39d
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/providers.js
@@ -0,0 +1,22 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AUTH_MECHS_AUTH_SRC_EXTERNAL = exports.AuthMechanism = void 0;
+/** @public */
+exports.AuthMechanism = Object.freeze({
+ MONGODB_AWS: 'MONGODB-AWS',
+ MONGODB_DEFAULT: 'DEFAULT',
+ MONGODB_GSSAPI: 'GSSAPI',
+ MONGODB_PLAIN: 'PLAIN',
+ MONGODB_SCRAM_SHA1: 'SCRAM-SHA-1',
+ MONGODB_SCRAM_SHA256: 'SCRAM-SHA-256',
+ MONGODB_X509: 'MONGODB-X509',
+ MONGODB_OIDC: 'MONGODB-OIDC'
+});
+/** @internal */
+exports.AUTH_MECHS_AUTH_SRC_EXTERNAL = new Set([
+ exports.AuthMechanism.MONGODB_GSSAPI,
+ exports.AuthMechanism.MONGODB_AWS,
+ exports.AuthMechanism.MONGODB_OIDC,
+ exports.AuthMechanism.MONGODB_X509
+]);
+//# sourceMappingURL=providers.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/providers.js.map b/node_modules/mongodb/lib/cmap/auth/providers.js.map
new file mode 100644
index 00000000..d697c911
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/providers.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../src/cmap/auth/providers.ts"],"names":[],"mappings":";;;AAAA,cAAc;AACD,QAAA,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,aAAa;IAC1B,eAAe,EAAE,SAAS;IAC1B,cAAc,EAAE,QAAQ;IACxB,aAAa,EAAE,OAAO;IACtB,kBAAkB,EAAE,aAAa;IACjC,oBAAoB,EAAE,eAAe;IACrC,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;CACpB,CAAC,CAAC;AAKZ,gBAAgB;AACH,QAAA,4BAA4B,GAAG,IAAI,GAAG,CAAgB;IACjE,qBAAa,CAAC,cAAc;IAC5B,qBAAa,CAAC,WAAW;IACzB,qBAAa,CAAC,YAAY;IAC1B,qBAAa,CAAC,YAAY;CAC3B,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/scram.js b/node_modules/mongodb/lib/cmap/auth/scram.js
new file mode 100644
index 00000000..afa3835c
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/scram.js
@@ -0,0 +1,267 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ScramSHA256 = exports.ScramSHA1 = void 0;
+const saslprep_1 = require("@mongodb-js/saslprep");
+const bson_1 = require("../../bson");
+const error_1 = require("../../error");
+const utils_1 = require("../../utils");
+const auth_provider_1 = require("./auth_provider");
+const providers_1 = require("./providers");
+class ScramSHA extends auth_provider_1.AuthProvider {
+ constructor(cryptoMethod) {
+ super();
+ this.cryptoMethod = cryptoMethod || 'sha1';
+ }
+ async prepare(handshakeDoc, authContext) {
+ const cryptoMethod = this.cryptoMethod;
+ const credentials = authContext.credentials;
+ if (!credentials) {
+ throw new error_1.MongoMissingCredentialsError('AuthContext must provide credentials.');
+ }
+ const nonce = await (0, utils_1.randomBytes)(24);
+ // store the nonce for later use
+ authContext.nonce = nonce;
+ const request = {
+ ...handshakeDoc,
+ speculativeAuthenticate: {
+ ...makeFirstMessage(cryptoMethod, credentials, nonce),
+ db: credentials.source
+ }
+ };
+ return request;
+ }
+ async auth(authContext) {
+ const { reauthenticating, response } = authContext;
+ if (response?.speculativeAuthenticate && !reauthenticating) {
+ return await continueScramConversation(this.cryptoMethod, response.speculativeAuthenticate, authContext);
+ }
+ return await executeScram(this.cryptoMethod, authContext);
+ }
+}
+function cleanUsername(username) {
+ return username.replace('=', '=3D').replace(',', '=2C');
+}
+function clientFirstMessageBare(username, nonce) {
+ // NOTE: This is done b/c Javascript uses UTF-16, but the server is hashing in UTF-8.
+ // Since the username is not sasl-prep-d, we need to do this here.
+ return bson_1.ByteUtils.concat([
+ bson_1.ByteUtils.fromUTF8('n='),
+ bson_1.ByteUtils.fromUTF8(username),
+ bson_1.ByteUtils.fromUTF8(',r='),
+ bson_1.ByteUtils.fromUTF8(bson_1.ByteUtils.toBase64(nonce))
+ ]);
+}
+function makeFirstMessage(cryptoMethod, credentials, nonce) {
+ const username = cleanUsername(credentials.username);
+ const mechanism = cryptoMethod === 'sha1' ? providers_1.AuthMechanism.MONGODB_SCRAM_SHA1 : providers_1.AuthMechanism.MONGODB_SCRAM_SHA256;
+ // NOTE: This is done b/c Javascript uses UTF-16, but the server is hashing in UTF-8.
+ // Since the username is not sasl-prep-d, we need to do this here.
+ return {
+ saslStart: 1,
+ mechanism,
+ payload: new bson_1.Binary(bson_1.ByteUtils.concat([bson_1.ByteUtils.fromUTF8('n,,'), clientFirstMessageBare(username, nonce)])),
+ autoAuthorize: 1,
+ options: { skipEmptyExchange: true }
+ };
+}
+async function executeScram(cryptoMethod, authContext) {
+ const { connection, credentials } = authContext;
+ if (!credentials) {
+ throw new error_1.MongoMissingCredentialsError('AuthContext must provide credentials.');
+ }
+ if (!authContext.nonce) {
+ throw new error_1.MongoInvalidArgumentError('AuthContext must contain a valid nonce property');
+ }
+ const nonce = authContext.nonce;
+ const db = credentials.source;
+ const saslStartCmd = makeFirstMessage(cryptoMethod, credentials, nonce);
+ const response = await connection.command((0, utils_1.ns)(`${db}.$cmd`), saslStartCmd, undefined);
+ await continueScramConversation(cryptoMethod, response, authContext);
+}
+async function continueScramConversation(cryptoMethod, response, authContext) {
+ const connection = authContext.connection;
+ const credentials = authContext.credentials;
+ if (!credentials) {
+ throw new error_1.MongoMissingCredentialsError('AuthContext must provide credentials.');
+ }
+ if (!authContext.nonce) {
+ throw new error_1.MongoInvalidArgumentError('Unable to continue SCRAM without valid nonce');
+ }
+ const nonce = authContext.nonce;
+ const db = credentials.source;
+ const username = cleanUsername(credentials.username);
+ const password = credentials.password;
+ const processedPassword = cryptoMethod === 'sha256' ? (0, saslprep_1.saslprep)(password) : passwordDigest(username, password);
+ const payload = bson_1.ByteUtils.isUint8Array(response.payload)
+ ? new bson_1.Binary(response.payload)
+ : response.payload;
+ const dict = parsePayload(payload);
+ const iterations = parseInt(dict.i, 10);
+ if (iterations && iterations < 4096) {
+ // TODO(NODE-3483)
+ throw new error_1.MongoRuntimeError(`Server returned an invalid iteration count ${iterations}`);
+ }
+ const salt = dict.s;
+ const rnonce = dict.r;
+ if (rnonce.startsWith('nonce')) {
+ // TODO(NODE-3483)
+ throw new error_1.MongoRuntimeError(`Server returned an invalid nonce: ${rnonce}`);
+ }
+ // Set up start of proof
+ const withoutProof = `c=biws,r=${rnonce}`;
+ const saltedPassword = await HI(processedPassword, bson_1.ByteUtils.fromBase64(salt), iterations, cryptoMethod);
+ const clientKey = await HMAC(cryptoMethod, saltedPassword, 'Client Key');
+ const serverKey = await HMAC(cryptoMethod, saltedPassword, 'Server Key');
+ const storedKey = await H(cryptoMethod, clientKey);
+ const authMessage = [
+ clientFirstMessageBare(username, nonce),
+ payload.toString('utf8'),
+ withoutProof
+ ].join(',');
+ const clientSignature = await HMAC(cryptoMethod, storedKey, authMessage);
+ const clientProof = `p=${xor(clientKey, clientSignature)}`;
+ const clientFinal = [withoutProof, clientProof].join(',');
+ const serverSignature = await HMAC(cryptoMethod, serverKey, authMessage);
+ const saslContinueCmd = {
+ saslContinue: 1,
+ conversationId: response.conversationId,
+ payload: new bson_1.Binary(bson_1.ByteUtils.fromUTF8(clientFinal))
+ };
+ const r = await connection.command((0, utils_1.ns)(`${db}.$cmd`), saslContinueCmd, undefined);
+ const parsedResponse = parsePayload(r.payload);
+ if (!compareDigest(bson_1.ByteUtils.fromBase64(parsedResponse.v), serverSignature)) {
+ throw new error_1.MongoRuntimeError('Server returned an invalid signature');
+ }
+ if (r.done !== false) {
+ // If the server sends r.done === true we can save one RTT
+ return;
+ }
+ const retrySaslContinueCmd = {
+ saslContinue: 1,
+ conversationId: r.conversationId,
+ payload: bson_1.ByteUtils.allocate(0)
+ };
+ await connection.command((0, utils_1.ns)(`${db}.$cmd`), retrySaslContinueCmd, undefined);
+}
+function parsePayload(payload) {
+ const payloadStr = payload.toString('utf8');
+ const dict = {};
+ const parts = payloadStr.split(',');
+ for (let i = 0; i < parts.length; i++) {
+ const valueParts = (parts[i].match(/^([^=]*)=(.*)$/) ?? []).slice(1);
+ dict[valueParts[0]] = valueParts[1];
+ }
+ return dict;
+}
+function passwordDigest(username, password) {
+ if (typeof username !== 'string') {
+ throw new error_1.MongoInvalidArgumentError('Username must be a string');
+ }
+ if (typeof password !== 'string') {
+ throw new error_1.MongoInvalidArgumentError('Password must be a string');
+ }
+ if (password.length === 0) {
+ throw new error_1.MongoInvalidArgumentError('Password cannot be empty');
+ }
+ let nodeCrypto;
+ try {
+ // TODO: NODE-7424 - remove dependency on 'crypto' for SCRAM-SHA-1 authentication
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ nodeCrypto = require('crypto');
+ }
+ catch (e) {
+ throw new error_1.MongoRuntimeError('Node.js crypto module is required for SCRAM-SHA-1 authentication', {
+ cause: e
+ });
+ }
+ try {
+ const md5 = nodeCrypto.createHash('md5');
+ md5.update(`${username}:mongo:${password}`, 'utf8');
+ return md5.digest('hex');
+ }
+ catch (err) {
+ if (nodeCrypto.getFips()) {
+ // This error is (slightly) more helpful than what comes from OpenSSL directly, e.g.
+ // 'Error: error:060800C8:digital envelope routines:EVP_DigestInit_ex:disabled for FIPS'
+ throw new Error('Auth mechanism SCRAM-SHA-1 is not supported in FIPS mode');
+ }
+ throw err;
+ }
+}
+// XOR two buffers
+function xor(a, b) {
+ const length = Math.max(a.length, b.length);
+ const res = [];
+ for (let i = 0; i < length; i += 1) {
+ res.push(a[i] ^ b[i]);
+ }
+ return bson_1.ByteUtils.toBase64(bson_1.ByteUtils.fromNumberArray(res));
+}
+async function H(method, text) {
+ const buffer = await crypto.subtle.digest(method === 'sha256' ? 'SHA-256' : 'SHA-1', text);
+ return new Uint8Array(buffer);
+}
+async function HMAC(method, key, text) {
+ const keyBuffer = bson_1.ByteUtils.toLocalBufferType(key);
+ const cryptoKey = await crypto.subtle.importKey('raw', keyBuffer, { name: 'HMAC', hash: { name: method === 'sha256' ? 'SHA-256' : 'SHA-1' } }, false, ['sign', 'verify']);
+ const textData = typeof text === 'string' ? new TextEncoder().encode(text) : text;
+ const textBuffer = bson_1.ByteUtils.toLocalBufferType(textData);
+ const signature = await crypto.subtle.sign('HMAC', cryptoKey, textBuffer);
+ return new Uint8Array(signature);
+}
+let _hiCache = {};
+let _hiCacheCount = 0;
+function _hiCachePurge() {
+ _hiCache = {};
+ _hiCacheCount = 0;
+}
+const hiLengthMap = {
+ sha256: 32,
+ sha1: 20
+};
+async function HI(data, salt, iterations, cryptoMethod) {
+ // omit the work if already generated
+ const key = [data, bson_1.ByteUtils.toBase64(salt), iterations].join('_');
+ if (_hiCache[key] != null) {
+ return _hiCache[key];
+ }
+ const keyMaterial = await crypto.subtle.importKey('raw', new TextEncoder().encode(data), { name: 'PBKDF2' }, false, ['deriveBits']);
+ const params = {
+ name: 'PBKDF2',
+ salt: salt,
+ iterations: iterations,
+ hash: { name: cryptoMethod === 'sha256' ? 'SHA-256' : 'SHA-1' }
+ };
+ const derivedBits = await crypto.subtle.deriveBits(params, keyMaterial, hiLengthMap[cryptoMethod] * 8);
+ const saltedData = new Uint8Array(derivedBits);
+ // cache a copy to speed up the next lookup, but prevent unbounded cache growth
+ if (_hiCacheCount >= 200) {
+ _hiCachePurge();
+ }
+ _hiCache[key] = saltedData;
+ _hiCacheCount += 1;
+ return saltedData;
+}
+function compareDigest(lhs, rhs) {
+ if (lhs.length !== rhs.length) {
+ return false;
+ }
+ let result = 0;
+ for (let i = 0; i < lhs.length; i++) {
+ result |= lhs[i] ^ rhs[i];
+ }
+ return result === 0;
+}
+class ScramSHA1 extends ScramSHA {
+ constructor() {
+ super('sha1');
+ }
+}
+exports.ScramSHA1 = ScramSHA1;
+class ScramSHA256 extends ScramSHA {
+ constructor() {
+ super('sha256');
+ }
+}
+exports.ScramSHA256 = ScramSHA256;
+//# sourceMappingURL=scram.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/scram.js.map b/node_modules/mongodb/lib/cmap/auth/scram.js.map
new file mode 100644
index 00000000..30014566
---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U,CAAC;IAC3B,aAAa,IAAI,CAAC,CAAC;IACnB,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,aAAa,CAAC,GAAe,EAAE,GAAe;IACrD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,MAAa,SAAU,SAAQ,QAAQ;IACrC;QACE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;CACF;AAJD,8BAIC;AAED,MAAa,WAAY,SAAQ,QAAQ;IACvC;QACE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC;CACF;AAJD,kCAIC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/x509.js b/node_modules/mongodb/lib/cmap/auth/x509.js
new file mode 100644
index 00000000..6f431c49
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/x509.js
@@ -0,0 +1,36 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.X509 = void 0;
+const error_1 = require("../../error");
+const utils_1 = require("../../utils");
+const auth_provider_1 = require("./auth_provider");
+class X509 extends auth_provider_1.AuthProvider {
+ async prepare(handshakeDoc, authContext) {
+ const { credentials } = authContext;
+ if (!credentials) {
+ throw new error_1.MongoMissingCredentialsError('AuthContext must provide credentials.');
+ }
+ return { ...handshakeDoc, speculativeAuthenticate: x509AuthenticateCommand(credentials) };
+ }
+ async auth(authContext) {
+ const connection = authContext.connection;
+ const credentials = authContext.credentials;
+ if (!credentials) {
+ throw new error_1.MongoMissingCredentialsError('AuthContext must provide credentials.');
+ }
+ const response = authContext.response;
+ if (response?.speculativeAuthenticate) {
+ return;
+ }
+ await connection.command((0, utils_1.ns)('$external.$cmd'), x509AuthenticateCommand(credentials), undefined);
+ }
+}
+exports.X509 = X509;
+function x509AuthenticateCommand(credentials) {
+ const command = { authenticate: 1, mechanism: 'MONGODB-X509' };
+ if (credentials.username) {
+ command.user = credentials.username;
+ }
+ return command;
+}
+//# sourceMappingURL=x509.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/auth/x509.js.map b/node_modules/mongodb/lib/cmap/auth/x509.js.map
new file mode 100644
index 00000000..bdaf1966
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/auth/x509.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"x509.js","sourceRoot":"","sources":["../../../src/cmap/auth/x509.ts"],"names":[],"mappings":";;;AACA,uCAA2D;AAC3D,uCAAiC;AAEjC,mDAAiE;AAGjE,MAAa,IAAK,SAAQ,4BAAY;IAC3B,KAAK,CAAC,OAAO,CACpB,YAA+B,EAC/B,WAAwB;QAExB,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;QACpC,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,oCAA4B,CAAC,uCAAuC,CAAC,CAAC;QAClF,CAAC;QACD,OAAO,EAAE,GAAG,YAAY,EAAE,uBAAuB,EAAE,uBAAuB,CAAC,WAAW,CAAC,EAAE,CAAC;IAC5F,CAAC;IAEQ,KAAK,CAAC,IAAI,CAAC,WAAwB;QAC1C,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;QAC1C,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;QAC5C,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,oCAA4B,CAAC,uCAAuC,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;QAEtC,IAAI,QAAQ,EAAE,uBAAuB,EAAE,CAAC;YACtC,OAAO;QACT,CAAC;QAED,MAAM,UAAU,CAAC,OAAO,CAAC,IAAA,UAAE,EAAC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAC;IAClG,CAAC;CACF;AA1BD,oBA0BC;AAED,SAAS,uBAAuB,CAAC,WAA6B;IAC5D,MAAM,OAAO,GAAa,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;IACzE,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC;IACtC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/command_monitoring_events.js b/node_modules/mongodb/lib/cmap/command_monitoring_events.js
new file mode 100644
index 00000000..b6f4d56b
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/command_monitoring_events.js
@@ -0,0 +1,223 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.SENSITIVE_COMMANDS = exports.CommandFailedEvent = exports.CommandSucceededEvent = exports.CommandStartedEvent = void 0;
+const constants_1 = require("../constants");
+const utils_1 = require("../utils");
+const commands_1 = require("./commands");
+/**
+ * An event indicating the start of a given command
+ * @public
+ * @category Event
+ */
+class CommandStartedEvent {
+ /**
+ * Create a started event
+ *
+ * @internal
+ * @param pool - the pool that originated the command
+ * @param command - the command
+ */
+ constructor(connection, command, serverConnectionId) {
+ /** @internal */
+ this.name = constants_1.COMMAND_STARTED;
+ const cmd = extractCommand(command);
+ const commandName = extractCommandName(cmd);
+ const { address, connectionId, serviceId } = extractConnectionDetails(connection);
+ // TODO: remove in major revision, this is not spec behavior
+ if (exports.SENSITIVE_COMMANDS.has(commandName)) {
+ this.commandObj = {};
+ this.commandObj[commandName] = true;
+ }
+ this.address = address;
+ this.connectionId = connectionId;
+ this.serviceId = serviceId;
+ this.requestId = command.requestId;
+ this.databaseName = command.databaseName;
+ this.commandName = commandName;
+ this.command = maybeRedact(commandName, cmd, cmd);
+ this.serverConnectionId = serverConnectionId;
+ }
+ /* @internal */
+ get hasServiceId() {
+ return !!this.serviceId;
+ }
+}
+exports.CommandStartedEvent = CommandStartedEvent;
+/**
+ * An event indicating the success of a given command
+ * @public
+ * @category Event
+ */
+class CommandSucceededEvent {
+ /**
+ * Create a succeeded event
+ *
+ * @internal
+ * @param pool - the pool that originated the command
+ * @param command - the command
+ * @param reply - the reply for this command from the server
+ * @param started - a high resolution tuple timestamp of when the command was first sent, to calculate duration
+ */
+ constructor(connection, command, reply, started, serverConnectionId) {
+ /** @internal */
+ this.name = constants_1.COMMAND_SUCCEEDED;
+ const cmd = extractCommand(command);
+ const commandName = extractCommandName(cmd);
+ const { address, connectionId, serviceId } = extractConnectionDetails(connection);
+ this.address = address;
+ this.connectionId = connectionId;
+ this.serviceId = serviceId;
+ this.requestId = command.requestId;
+ this.commandName = commandName;
+ this.duration = (0, utils_1.calculateDurationInMs)(started);
+ this.reply = maybeRedact(commandName, cmd, extractReply(reply));
+ this.serverConnectionId = serverConnectionId;
+ this.databaseName = command.databaseName;
+ }
+ /* @internal */
+ get hasServiceId() {
+ return !!this.serviceId;
+ }
+}
+exports.CommandSucceededEvent = CommandSucceededEvent;
+/**
+ * An event indicating the failure of a given command
+ * @public
+ * @category Event
+ */
+class CommandFailedEvent {
+ /**
+ * Create a failure event
+ *
+ * @internal
+ * @param pool - the pool that originated the command
+ * @param command - the command
+ * @param error - the generated error or a server error response
+ * @param started - a high resolution tuple timestamp of when the command was first sent, to calculate duration
+ */
+ constructor(connection, command, error, started, serverConnectionId) {
+ /** @internal */
+ this.name = constants_1.COMMAND_FAILED;
+ const cmd = extractCommand(command);
+ const commandName = extractCommandName(cmd);
+ const { address, connectionId, serviceId } = extractConnectionDetails(connection);
+ this.address = address;
+ this.connectionId = connectionId;
+ this.serviceId = serviceId;
+ this.requestId = command.requestId;
+ this.commandName = commandName;
+ this.duration = (0, utils_1.calculateDurationInMs)(started);
+ this.failure = maybeRedact(commandName, cmd, error);
+ this.serverConnectionId = serverConnectionId;
+ this.databaseName = command.databaseName;
+ }
+ /* @internal */
+ get hasServiceId() {
+ return !!this.serviceId;
+ }
+}
+exports.CommandFailedEvent = CommandFailedEvent;
+/**
+ * Commands that we want to redact because of the sensitive nature of their contents
+ * @internal
+ */
+exports.SENSITIVE_COMMANDS = new Set([
+ 'authenticate',
+ 'saslStart',
+ 'saslContinue',
+ 'getnonce',
+ 'createUser',
+ 'updateUser',
+ 'copydbgetnonce',
+ 'copydbsaslstart',
+ 'copydb'
+]);
+const HELLO_COMMANDS = new Set(['hello', constants_1.LEGACY_HELLO_COMMAND, constants_1.LEGACY_HELLO_COMMAND_CAMEL_CASE]);
+// helper methods
+const extractCommandName = (commandDoc) => Object.keys(commandDoc)[0];
+const collectionName = (command) => command.ns.split('.')[1];
+const maybeRedact = (commandName, commandDoc, result) => exports.SENSITIVE_COMMANDS.has(commandName) ||
+ (HELLO_COMMANDS.has(commandName) && commandDoc.speculativeAuthenticate)
+ ? {}
+ : result;
+const LEGACY_FIND_QUERY_MAP = {
+ $query: 'filter',
+ $orderby: 'sort',
+ $hint: 'hint',
+ $comment: 'comment',
+ $maxScan: 'maxScan',
+ $max: 'max',
+ $min: 'min',
+ $returnKey: 'returnKey',
+ $showDiskLoc: 'showRecordId',
+ $maxTimeMS: 'maxTimeMS',
+ $snapshot: 'snapshot'
+};
+const LEGACY_FIND_OPTIONS_MAP = {
+ numberToSkip: 'skip',
+ numberToReturn: 'batchSize',
+ returnFieldSelector: 'projection'
+};
+/** Extract the actual command from the query, possibly up-converting if it's a legacy format */
+function extractCommand(command) {
+ if (command instanceof commands_1.OpMsgRequest) {
+ const cmd = { ...command.command };
+ // For OP_MSG with payload type 1 we need to pull the documents
+ // array out of the document sequence for monitoring.
+ if (cmd.ops instanceof commands_1.DocumentSequence) {
+ cmd.ops = cmd.ops.documents;
+ }
+ if (cmd.nsInfo instanceof commands_1.DocumentSequence) {
+ cmd.nsInfo = cmd.nsInfo.documents;
+ }
+ return cmd;
+ }
+ if (command.query?.$query) {
+ let result;
+ if (command.ns === 'admin.$cmd') {
+ // up-convert legacy command
+ result = Object.assign({}, command.query.$query);
+ }
+ else {
+ // up-convert legacy find command
+ result = { find: collectionName(command) };
+ Object.keys(LEGACY_FIND_QUERY_MAP).forEach(key => {
+ if (command.query[key] != null) {
+ result[LEGACY_FIND_QUERY_MAP[key]] = { ...command.query[key] };
+ }
+ });
+ }
+ Object.keys(LEGACY_FIND_OPTIONS_MAP).forEach(key => {
+ const legacyKey = key;
+ if (command[legacyKey] != null) {
+ result[LEGACY_FIND_OPTIONS_MAP[legacyKey]] = command[legacyKey];
+ }
+ });
+ return result;
+ }
+ let clonedQuery = {};
+ const clonedCommand = { ...command };
+ if (command.query) {
+ clonedQuery = { ...command.query };
+ clonedCommand.query = clonedQuery;
+ }
+ return command.query ? clonedQuery : clonedCommand;
+}
+function extractReply(reply) {
+ if (!reply) {
+ return reply;
+ }
+ return reply.result ? reply.result : reply;
+}
+function extractConnectionDetails(connection) {
+ let connectionId;
+ if ('id' in connection) {
+ connectionId = connection.id;
+ }
+ return {
+ address: connection.address,
+ serviceId: connection.serviceId,
+ connectionId
+ };
+}
+//# sourceMappingURL=command_monitoring_events.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/command_monitoring_events.js.map b/node_modules/mongodb/lib/cmap/command_monitoring_events.js.map
new file mode 100644
index 00000000..f7aabb54
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/command_monitoring_events.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"command_monitoring_events.js","sourceRoot":"","sources":["../../src/cmap/command_monitoring_events.ts"],"names":[],"mappings":";;;AACA,4CAMsB;AACtB,oCAAiD;AACjD,yCAKoB;AAGpB;;;;GAIG;AACH,MAAa,mBAAmB;I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AE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7C,CAAC;AAED,SAAS,wBAAwB,CAAC,UAAsB;IACtD,IAAI,YAAY,CAAC;IACjB,IAAI,IAAI,IAAI,UAAU,EAAE,CAAC;QACvB,YAAY,GAAG,UAAU,CAAC,EAAE,CAAC;IAC/B,CAAC;IACD,OAAO;QACL,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,YAAY;KACb,CAAC;AACJ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/commands.js b/node_modules/mongodb/lib/cmap/commands.js
new file mode 100644
index 00000000..d07b941e
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/commands.js
@@ -0,0 +1,542 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.OpCompressedRequest = exports.OpMsgResponse = exports.OpMsgRequest = exports.DocumentSequence = exports.OpReply = exports.OpQueryRequest = void 0;
+const bson_1 = require("../bson");
+const error_1 = require("../error");
+const compression_1 = require("./wire_protocol/compression");
+const constants_1 = require("./wire_protocol/constants");
+// Incrementing request id
+let _requestId = 0;
+// Query flags
+const OPTS_TAILABLE_CURSOR = 2;
+const OPTS_SECONDARY = 4;
+const OPTS_OPLOG_REPLAY = 8;
+const OPTS_NO_CURSOR_TIMEOUT = 16;
+const OPTS_AWAIT_DATA = 32;
+const OPTS_EXHAUST = 64;
+const OPTS_PARTIAL = 128;
+// Response flags
+const CURSOR_NOT_FOUND = 1;
+const QUERY_FAILURE = 2;
+const SHARD_CONFIG_STALE = 4;
+const AWAIT_CAPABLE = 8;
+const encodeUTF8Into = bson_1.ByteUtils.encodeUTF8Into;
+/** @internal */
+class OpQueryRequest {
+ constructor(databaseName, query, options) {
+ /** moreToCome is an OP_MSG only concept */
+ this.moreToCome = false;
+ // Basic options needed to be passed in
+ // TODO(NODE-3483): Replace with MongoCommandError
+ const ns = `${databaseName}.$cmd`;
+ if (typeof databaseName !== 'string') {
+ throw new error_1.MongoRuntimeError('Database name must be a string for a query');
+ }
+ // TODO(NODE-3483): Replace with MongoCommandError
+ if (query == null)
+ throw new error_1.MongoRuntimeError('A query document must be specified for query');
+ // Validate that we are not passing 0x00 in the collection name
+ if (ns.indexOf('\x00') !== -1) {
+ // TODO(NODE-3483): Use MongoNamespace static method
+ throw new error_1.MongoRuntimeError('Namespace cannot contain a null character');
+ }
+ // Basic optionsa
+ this.databaseName = databaseName;
+ this.query = query;
+ this.ns = ns;
+ // Additional options
+ this.numberToSkip = options.numberToSkip || 0;
+ this.numberToReturn = options.numberToReturn || 0;
+ this.returnFieldSelector = options.returnFieldSelector || undefined;
+ this.requestId = options.requestId ?? OpQueryRequest.getRequestId();
+ // special case for pre-3.2 find commands, delete ASAP
+ this.pre32Limit = options.pre32Limit;
+ // Serialization option
+ this.serializeFunctions =
+ typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ this.ignoreUndefined =
+ typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : false;
+ this.maxBsonSize = options.maxBsonSize || 1024 * 1024 * 16;
+ this.checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ this.batchSize = this.numberToReturn;
+ // Flags
+ this.tailable = false;
+ this.secondaryOk = typeof options.secondaryOk === 'boolean' ? options.secondaryOk : false;
+ this.oplogReplay = false;
+ this.noCursorTimeout = false;
+ this.awaitData = false;
+ this.exhaust = false;
+ this.partial = false;
+ }
+ /** Assign next request Id. */
+ incRequestId() {
+ this.requestId = _requestId++;
+ }
+ /** Peek next request Id. */
+ nextRequestId() {
+ return _requestId + 1;
+ }
+ /** Increment then return next request Id. */
+ static getRequestId() {
+ return ++_requestId;
+ }
+ // Uses a single allocated buffer for the process, avoiding multiple memory allocations
+ toBin() {
+ const buffers = [];
+ let projection = null;
+ // Set up the flags
+ let flags = 0;
+ if (this.tailable) {
+ flags |= OPTS_TAILABLE_CURSOR;
+ }
+ if (this.secondaryOk) {
+ flags |= OPTS_SECONDARY;
+ }
+ if (this.oplogReplay) {
+ flags |= OPTS_OPLOG_REPLAY;
+ }
+ if (this.noCursorTimeout) {
+ flags |= OPTS_NO_CURSOR_TIMEOUT;
+ }
+ if (this.awaitData) {
+ flags |= OPTS_AWAIT_DATA;
+ }
+ if (this.exhaust) {
+ flags |= OPTS_EXHAUST;
+ }
+ if (this.partial) {
+ flags |= OPTS_PARTIAL;
+ }
+ // If batchSize is different to this.numberToReturn
+ if (this.batchSize !== this.numberToReturn)
+ this.numberToReturn = this.batchSize;
+ // Allocate write protocol header buffer
+ const header = bson_1.ByteUtils.allocate(4 * 4 + // Header
+ 4 + // Flags
+ bson_1.ByteUtils.utf8ByteLength(this.ns) +
+ 1 + // namespace
+ 4 + // numberToSkip
+ 4 // numberToReturn
+ );
+ // Add header to buffers
+ buffers.push(header);
+ // Serialize the query
+ const query = bson_1.BSON.serialize(this.query, {
+ checkKeys: this.checkKeys,
+ serializeFunctions: this.serializeFunctions,
+ ignoreUndefined: this.ignoreUndefined
+ });
+ // Add query document
+ buffers.push(query);
+ if (this.returnFieldSelector && Object.keys(this.returnFieldSelector).length > 0) {
+ // Serialize the projection document
+ projection = bson_1.BSON.serialize(this.returnFieldSelector, {
+ checkKeys: this.checkKeys,
+ serializeFunctions: this.serializeFunctions,
+ ignoreUndefined: this.ignoreUndefined
+ });
+ // Add projection document
+ buffers.push(projection);
+ }
+ // Total message size
+ const totalLength = header.length + query.length + (projection ? projection.length : 0);
+ // Set up the index
+ let index = 4;
+ // Write total document length
+ header[3] = (totalLength >> 24) & 0xff;
+ header[2] = (totalLength >> 16) & 0xff;
+ header[1] = (totalLength >> 8) & 0xff;
+ header[0] = totalLength & 0xff;
+ // Write header information requestId
+ header[index + 3] = (this.requestId >> 24) & 0xff;
+ header[index + 2] = (this.requestId >> 16) & 0xff;
+ header[index + 1] = (this.requestId >> 8) & 0xff;
+ header[index] = this.requestId & 0xff;
+ index = index + 4;
+ // Write header information responseTo
+ header[index + 3] = (0 >> 24) & 0xff;
+ header[index + 2] = (0 >> 16) & 0xff;
+ header[index + 1] = (0 >> 8) & 0xff;
+ header[index] = 0 & 0xff;
+ index = index + 4;
+ // Write header information OP_QUERY
+ header[index + 3] = (constants_1.OP_QUERY >> 24) & 0xff;
+ header[index + 2] = (constants_1.OP_QUERY >> 16) & 0xff;
+ header[index + 1] = (constants_1.OP_QUERY >> 8) & 0xff;
+ header[index] = constants_1.OP_QUERY & 0xff;
+ index = index + 4;
+ // Write header information flags
+ header[index + 3] = (flags >> 24) & 0xff;
+ header[index + 2] = (flags >> 16) & 0xff;
+ header[index + 1] = (flags >> 8) & 0xff;
+ header[index] = flags & 0xff;
+ index = index + 4;
+ // Write collection name
+ index = index + encodeUTF8Into(header, this.ns, index) + 1;
+ header[index - 1] = 0;
+ // Write header information flags numberToSkip
+ header[index + 3] = (this.numberToSkip >> 24) & 0xff;
+ header[index + 2] = (this.numberToSkip >> 16) & 0xff;
+ header[index + 1] = (this.numberToSkip >> 8) & 0xff;
+ header[index] = this.numberToSkip & 0xff;
+ index = index + 4;
+ // Write header information flags numberToReturn
+ header[index + 3] = (this.numberToReturn >> 24) & 0xff;
+ header[index + 2] = (this.numberToReturn >> 16) & 0xff;
+ header[index + 1] = (this.numberToReturn >> 8) & 0xff;
+ header[index] = this.numberToReturn & 0xff;
+ index = index + 4;
+ // Return the buffers
+ return buffers;
+ }
+}
+exports.OpQueryRequest = OpQueryRequest;
+/** @internal */
+class OpReply {
+ constructor(message, msgHeader, msgBody, opts) {
+ this.index = 0;
+ this.sections = [];
+ /** moreToCome is an OP_MSG only concept */
+ this.moreToCome = false;
+ this.parsed = false;
+ this.raw = message;
+ this.data = msgBody;
+ this.opts = opts ?? {
+ useBigInt64: false,
+ promoteLongs: true,
+ promoteValues: true,
+ promoteBuffers: false,
+ bsonRegExp: false
+ };
+ // Read the message header
+ this.length = msgHeader.length;
+ this.requestId = msgHeader.requestId;
+ this.responseTo = msgHeader.responseTo;
+ this.opCode = msgHeader.opCode;
+ this.fromCompressed = msgHeader.fromCompressed;
+ // Flag values
+ this.useBigInt64 = typeof this.opts.useBigInt64 === 'boolean' ? this.opts.useBigInt64 : false;
+ this.promoteLongs = typeof this.opts.promoteLongs === 'boolean' ? this.opts.promoteLongs : true;
+ this.promoteValues =
+ typeof this.opts.promoteValues === 'boolean' ? this.opts.promoteValues : true;
+ this.promoteBuffers =
+ typeof this.opts.promoteBuffers === 'boolean' ? this.opts.promoteBuffers : false;
+ this.bsonRegExp = typeof this.opts.bsonRegExp === 'boolean' ? this.opts.bsonRegExp : false;
+ }
+ isParsed() {
+ return this.parsed;
+ }
+ parse() {
+ // Don't parse again if not needed
+ if (this.parsed)
+ return this.sections[0];
+ // Position within OP_REPLY at which documents start
+ // (See https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/#wire-op-reply)
+ this.index = 20;
+ // Read the message body
+ this.responseFlags = (0, bson_1.readInt32LE)(this.data, 0);
+ this.cursorId = new bson_1.BSON.Long((0, bson_1.readInt32LE)(this.data, 4), (0, bson_1.readInt32LE)(this.data, 8));
+ this.startingFrom = (0, bson_1.readInt32LE)(this.data, 12);
+ this.numberReturned = (0, bson_1.readInt32LE)(this.data, 16);
+ if (this.numberReturned < 0 || this.numberReturned > 2 ** 32 - 1) {
+ throw new RangeError(`OP_REPLY numberReturned is an invalid array length ${this.numberReturned}`);
+ }
+ this.cursorNotFound = (this.responseFlags & CURSOR_NOT_FOUND) !== 0;
+ this.queryFailure = (this.responseFlags & QUERY_FAILURE) !== 0;
+ this.shardConfigStale = (this.responseFlags & SHARD_CONFIG_STALE) !== 0;
+ this.awaitCapable = (this.responseFlags & AWAIT_CAPABLE) !== 0;
+ // Parse Body
+ for (let i = 0; i < this.numberReturned; i++) {
+ const bsonSize = this.data[this.index] |
+ (this.data[this.index + 1] << 8) |
+ (this.data[this.index + 2] << 16) |
+ (this.data[this.index + 3] << 24);
+ const section = this.data.subarray(this.index, this.index + bsonSize);
+ this.sections.push(section);
+ // Adjust the index
+ this.index = this.index + bsonSize;
+ }
+ // Set parsed
+ this.parsed = true;
+ return this.sections[0];
+ }
+}
+exports.OpReply = OpReply;
+// Msg Flags
+const OPTS_CHECKSUM_PRESENT = 1;
+const OPTS_MORE_TO_COME = 2;
+const OPTS_EXHAUST_ALLOWED = 1 << 16;
+/** @internal */
+class DocumentSequence {
+ /**
+ * Create a new document sequence for the provided field.
+ * @param field - The field it will replace.
+ */
+ constructor(field, documents) {
+ this.field = field;
+ this.documents = [];
+ this.chunks = [];
+ this.serializedDocumentsLength = 0;
+ // Document sequences starts with type 1 at the first byte.
+ // Field strings must always be UTF-8.
+ const buffer = bson_1.ByteUtils.allocateUnsafe(1 + 4 + this.field.length + 1);
+ buffer[0] = 1;
+ // Third part is the field name at offset 5 with trailing null byte.
+ encodeUTF8Into(buffer, `${this.field}\0`, 5);
+ this.chunks.push(buffer);
+ this.header = buffer;
+ if (documents) {
+ for (const doc of documents) {
+ this.push(doc, bson_1.BSON.serialize(doc));
+ }
+ }
+ }
+ /**
+ * Push a document to the document sequence. Will serialize the document
+ * as well and return the current serialized length of all documents.
+ * @param document - The document to add.
+ * @param buffer - The serialized document in raw BSON.
+ * @returns The new total document sequence length.
+ */
+ push(document, buffer) {
+ this.serializedDocumentsLength += buffer.length;
+ // Push the document.
+ this.documents.push(document);
+ // Push the document raw bson.
+ this.chunks.push(buffer);
+ // Write the new length.
+ if (this.header) {
+ bson_1.NumberUtils.setInt32LE(this.header, 1, 4 + this.field.length + 1 + this.serializedDocumentsLength);
+ }
+ return this.serializedDocumentsLength + this.header.length;
+ }
+ /**
+ * Get the fully serialized bytes for the document sequence section.
+ * @returns The section bytes.
+ */
+ toBin() {
+ return bson_1.ByteUtils.concat(this.chunks);
+ }
+}
+exports.DocumentSequence = DocumentSequence;
+/** @internal */
+class OpMsgRequest {
+ constructor(databaseName, command, options) {
+ // Basic options needed to be passed in
+ if (command == null)
+ throw new error_1.MongoInvalidArgumentError('Query document must be specified for query');
+ // Basic optionsa
+ this.databaseName = databaseName;
+ this.command = command;
+ this.command.$db = databaseName;
+ // Ensure empty options
+ this.options = options ?? {};
+ // Additional options
+ this.requestId = options.requestId ? options.requestId : OpMsgRequest.getRequestId();
+ // Serialization option
+ this.serializeFunctions =
+ typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
+ this.ignoreUndefined =
+ typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : false;
+ this.checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
+ this.maxBsonSize = options.maxBsonSize || 1024 * 1024 * 16;
+ // flags
+ this.checksumPresent = false;
+ this.moreToCome = options.moreToCome ?? command.writeConcern?.w === 0;
+ this.exhaustAllowed =
+ typeof options.exhaustAllowed === 'boolean' ? options.exhaustAllowed : false;
+ }
+ toBin() {
+ const buffers = [];
+ let flags = 0;
+ if (this.checksumPresent) {
+ flags |= OPTS_CHECKSUM_PRESENT;
+ }
+ if (this.moreToCome) {
+ flags |= OPTS_MORE_TO_COME;
+ }
+ if (this.exhaustAllowed) {
+ flags |= OPTS_EXHAUST_ALLOWED;
+ }
+ const header = bson_1.ByteUtils.allocate(4 * 4 + // Header
+ 4 // Flags
+ );
+ buffers.push(header);
+ let totalLength = header.length;
+ const command = this.command;
+ totalLength += this.makeSections(buffers, command);
+ bson_1.NumberUtils.setInt32LE(header, 0, totalLength); // messageLength
+ bson_1.NumberUtils.setInt32LE(header, 4, this.requestId); // requestID
+ bson_1.NumberUtils.setInt32LE(header, 8, 0); // responseTo
+ bson_1.NumberUtils.setInt32LE(header, 12, constants_1.OP_MSG); // opCode
+ // The OP_MSG spec calls out that flags is uint32:
+ // https://github.com/mongodb/specifications/blob/master/source/message/OP_MSG.md#op_msg-1
+ (0, bson_1.setUint32LE)(header, 16, flags); // flags
+ return buffers;
+ }
+ /**
+ * Add the sections to the OP_MSG request's buffers and returns the length.
+ */
+ makeSections(buffers, document) {
+ const sequencesBuffer = this.extractDocumentSequences(document);
+ const payloadTypeBuffer = bson_1.ByteUtils.allocateUnsafe(1);
+ payloadTypeBuffer[0] = 0;
+ const documentBuffer = this.serializeBson(document);
+ // First section, type 0
+ buffers.push(payloadTypeBuffer);
+ buffers.push(documentBuffer);
+ // Subsequent sections, type 1
+ buffers.push(sequencesBuffer);
+ return payloadTypeBuffer.length + documentBuffer.length + sequencesBuffer.length;
+ }
+ /**
+ * Extracts the document sequences from the command document and returns
+ * a buffer to be added as multiple sections after the initial type 0
+ * section in the message.
+ */
+ extractDocumentSequences(document) {
+ // Pull out any field in the command document that's value is a document sequence.
+ const chunks = [];
+ for (const [key, value] of Object.entries(document)) {
+ if (value instanceof DocumentSequence) {
+ chunks.push(value.toBin());
+ // Why are we removing the field from the command? This is because it needs to be
+ // removed in the OP_MSG request first section, and DocumentSequence is not a
+ // BSON type and is specific to the MongoDB wire protocol so there's nothing
+ // our BSON serializer can do about this. Since DocumentSequence is not exposed
+ // in the public API and only used internally, we are never mutating an original
+ // command provided by the user, just our own, and it's cheaper to delete from
+ // our own command than copying it.
+ delete document[key];
+ }
+ }
+ if (chunks.length > 0) {
+ return bson_1.ByteUtils.concat(chunks);
+ }
+ // If we have no document sequences we return an empty buffer for nothing to add
+ // to the payload.
+ return bson_1.ByteUtils.allocate(0);
+ }
+ serializeBson(document) {
+ return bson_1.BSON.serialize(document, {
+ checkKeys: this.checkKeys,
+ serializeFunctions: this.serializeFunctions,
+ ignoreUndefined: this.ignoreUndefined
+ });
+ }
+ static getRequestId() {
+ _requestId = (_requestId + 1) & 0x7fffffff;
+ return _requestId;
+ }
+}
+exports.OpMsgRequest = OpMsgRequest;
+/** @internal */
+class OpMsgResponse {
+ constructor(message, msgHeader, msgBody, opts) {
+ this.index = 0;
+ this.sections = [];
+ this.parsed = false;
+ this.raw = message;
+ this.data = msgBody;
+ this.opts = opts ?? {
+ useBigInt64: false,
+ promoteLongs: true,
+ promoteValues: true,
+ promoteBuffers: false,
+ bsonRegExp: false
+ };
+ // Read the message header
+ this.length = msgHeader.length;
+ this.requestId = msgHeader.requestId;
+ this.responseTo = msgHeader.responseTo;
+ this.opCode = msgHeader.opCode;
+ this.fromCompressed = msgHeader.fromCompressed;
+ // Read response flags
+ this.responseFlags = (0, bson_1.readInt32LE)(msgBody, 0);
+ this.checksumPresent = (this.responseFlags & OPTS_CHECKSUM_PRESENT) !== 0;
+ this.moreToCome = (this.responseFlags & OPTS_MORE_TO_COME) !== 0;
+ this.exhaustAllowed = (this.responseFlags & OPTS_EXHAUST_ALLOWED) !== 0;
+ this.useBigInt64 = typeof this.opts.useBigInt64 === 'boolean' ? this.opts.useBigInt64 : false;
+ this.promoteLongs = typeof this.opts.promoteLongs === 'boolean' ? this.opts.promoteLongs : true;
+ this.promoteValues =
+ typeof this.opts.promoteValues === 'boolean' ? this.opts.promoteValues : true;
+ this.promoteBuffers =
+ typeof this.opts.promoteBuffers === 'boolean' ? this.opts.promoteBuffers : false;
+ this.bsonRegExp = typeof this.opts.bsonRegExp === 'boolean' ? this.opts.bsonRegExp : false;
+ }
+ isParsed() {
+ return this.parsed;
+ }
+ parse() {
+ // Don't parse again if not needed
+ if (this.parsed)
+ return this.sections[0];
+ this.index = 4;
+ while (this.index < this.data.length) {
+ const payloadType = this.data[this.index++];
+ if (payloadType === 0) {
+ // BSON spec specifies that this is a 32-bit signed integer: https://bsonspec.org/spec.html#:~:text=%3A%3A%3D-,int32,-e_list%20unsigned_byte(0
+ // While allowing negative sizes seems odd, in practice we never expect a negative size. Also, the server's 16mb limit for BSON documents leaves plenty
+ // of room in an int32 to store a document of the max BSON size that the server supports
+ const bsonSize = (0, bson_1.readInt32LE)(this.data, this.index);
+ const bin = this.data.subarray(this.index, this.index + bsonSize);
+ this.sections.push(bin);
+ this.index += bsonSize;
+ }
+ else if (payloadType === 1) {
+ // It was decided that no driver makes use of payload type 1
+ // TODO(NODE-3483): Replace with MongoDeprecationError
+ throw new error_1.MongoRuntimeError('OP_MSG Payload Type 1 detected unsupported protocol');
+ }
+ }
+ this.parsed = true;
+ return this.sections[0];
+ }
+}
+exports.OpMsgResponse = OpMsgResponse;
+const MESSAGE_HEADER_SIZE = 16;
+const COMPRESSION_DETAILS_SIZE = 9; // originalOpcode + uncompressedSize, compressorID
+/**
+ * @internal
+ *
+ * An OP_COMPRESSED request wraps either an OP_QUERY or OP_MSG message.
+ */
+class OpCompressedRequest {
+ constructor(command, options) {
+ this.command = command;
+ this.options = {
+ zlibCompressionLevel: options.zlibCompressionLevel,
+ agreedCompressor: options.agreedCompressor
+ };
+ }
+ // Return whether a command contains an uncompressible command term
+ // Will return true if command contains no uncompressible command terms
+ static canCompress(command) {
+ const commandDoc = command instanceof OpMsgRequest ? command.command : command.query;
+ const commandName = Object.keys(commandDoc)[0];
+ return !compression_1.uncompressibleCommands.has(commandName);
+ }
+ async toBin() {
+ const concatenatedOriginalCommandBuffer = bson_1.ByteUtils.concat(this.command.toBin());
+ // otherwise, compress the message
+ const messageToBeCompressed = concatenatedOriginalCommandBuffer.slice(MESSAGE_HEADER_SIZE);
+ // Extract information needed for OP_COMPRESSED from the uncompressed message
+ const originalCommandOpCode = (0, bson_1.readInt32LE)(concatenatedOriginalCommandBuffer, 12);
+ // Compress the message body
+ const compressedMessage = await (0, compression_1.compress)(this.options, messageToBeCompressed);
+ // Create the msgHeader of OP_COMPRESSED
+ const msgHeader = bson_1.ByteUtils.allocate(MESSAGE_HEADER_SIZE);
+ bson_1.NumberUtils.setInt32LE(msgHeader, 0, MESSAGE_HEADER_SIZE + COMPRESSION_DETAILS_SIZE + compressedMessage.length); // messageLength
+ bson_1.NumberUtils.setInt32LE(msgHeader, 4, this.command.requestId); // requestID
+ bson_1.NumberUtils.setInt32LE(msgHeader, 8, 0); // responseTo (zero)
+ bson_1.NumberUtils.setInt32LE(msgHeader, 12, constants_1.OP_COMPRESSED); // opCode
+ // Create the compression details of OP_COMPRESSED
+ const compressionDetails = bson_1.ByteUtils.allocate(COMPRESSION_DETAILS_SIZE);
+ bson_1.NumberUtils.setInt32LE(compressionDetails, 0, originalCommandOpCode); // originalOpcode
+ bson_1.NumberUtils.setInt32LE(compressionDetails, 4, messageToBeCompressed.length); // Size of the uncompressed compressedMessage, excluding the MsgHeader
+ compressionDetails[8] = compression_1.Compressor[this.options.agreedCompressor]; // compressorID
+ return [msgHeader, compressionDetails, compressedMessage];
+ }
+}
+exports.OpCompressedRequest = OpCompressedRequest;
+//# sourceMappingURL=commands.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/commands.js.map b/node_modules/mongodb/lib/cmap/commands.js.map
new file mode 100644
index 00000000..74f07c02
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/commands.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/cmap/commands.ts"],"names":[],"mappings":";;;AAAA,kCASiB;AACjB,oCAAwE;AAIxE,6DAKqC;AACrC,yDAA4E;AAE5E,0BAA0B;AAC1B,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,cAAc;AACd,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,iBAAiB;AACjB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,MAAM,cAAc,GAAG,gBAAS,CAAC,cAAc,CAAC;AAwBhD,gBAAgB;AAChB,MAAa,cAAc;IAwBzB,YAAY,YAAoB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nJ,kBAAkB,CAAC,CAAC,CAAC,GAAG,wBAAU,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe;QAClF,OAAO,CAAC,SAAS,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;IAC5D,CAAC;CACF;AA/CD,kDA+CC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/connect.js b/node_modules/mongodb/lib/cmap/connect.js
new file mode 100644
index 00000000..430e9d5e
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/connect.js
@@ -0,0 +1,398 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.LEGAL_TCP_SOCKET_OPTIONS = exports.LEGAL_TLS_SOCKET_OPTIONS = exports.DEFAULT_KEEP_ALIVE_INITIAL_DELAY_MS = void 0;
+exports.connect = connect;
+exports.makeConnection = makeConnection;
+exports.performInitialHandshake = performInitialHandshake;
+exports.prepareHandshakeDocument = prepareHandshakeDocument;
+exports.makeSocket = makeSocket;
+const net = require("net");
+const tls = require("tls");
+const constants_1 = require("../constants");
+const deps_1 = require("../deps");
+const error_1 = require("../error");
+const utils_1 = require("../utils");
+const auth_provider_1 = require("./auth/auth_provider");
+const providers_1 = require("./auth/providers");
+const connection_1 = require("./connection");
+const constants_2 = require("./wire_protocol/constants");
+function applyBackpressureLabels(error) {
+ error.addErrorLabel(error_1.MongoErrorLabel.SystemOverloadedError);
+ error.addErrorLabel(error_1.MongoErrorLabel.RetryableError);
+}
+async function connect(options) {
+ let connection = null;
+ try {
+ const socket = await makeSocket(options);
+ connection = makeConnection(options, socket);
+ await performInitialHandshake(connection, options);
+ return connection;
+ }
+ catch (error) {
+ connection?.destroy();
+ throw error;
+ }
+}
+function makeConnection(options, socket) {
+ let ConnectionType = options.connectionType ?? connection_1.Connection;
+ if (options.autoEncrypter) {
+ ConnectionType = connection_1.CryptoConnection;
+ }
+ return new ConnectionType(socket, options);
+}
+function checkSupportedServer(hello, options) {
+ const maxWireVersion = Number(hello.maxWireVersion);
+ const minWireVersion = Number(hello.minWireVersion);
+ const serverVersionHighEnough = !Number.isNaN(maxWireVersion) && maxWireVersion >= constants_2.MIN_SUPPORTED_WIRE_VERSION;
+ const serverVersionLowEnough = !Number.isNaN(minWireVersion) && minWireVersion <= constants_2.MAX_SUPPORTED_WIRE_VERSION;
+ if (serverVersionHighEnough) {
+ if (serverVersionLowEnough) {
+ return null;
+ }
+ const message = `Server at ${options.hostAddress} reports minimum wire version ${JSON.stringify(hello.minWireVersion)}, but this version of the Node.js Driver requires at most ${constants_2.MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${constants_2.MAX_SUPPORTED_SERVER_VERSION})`;
+ return new error_1.MongoCompatibilityError(message);
+ }
+ const message = `Server at ${options.hostAddress} reports maximum wire version ${JSON.stringify(hello.maxWireVersion) ?? 0}, but this version of the Node.js Driver requires at least ${constants_2.MIN_SUPPORTED_WIRE_VERSION} (MongoDB ${constants_2.MIN_SUPPORTED_SERVER_VERSION})`;
+ return new error_1.MongoCompatibilityError(message);
+}
+async function performInitialHandshake(conn, options) {
+ const credentials = options.credentials;
+ if (credentials) {
+ if (!(credentials.mechanism === providers_1.AuthMechanism.MONGODB_DEFAULT) &&
+ !options.authProviders.getOrCreateProvider(credentials.mechanism, credentials.mechanismProperties)) {
+ throw new error_1.MongoInvalidArgumentError(`AuthMechanism '${credentials.mechanism}' not supported`);
+ }
+ }
+ const authContext = new auth_provider_1.AuthContext(conn, credentials, options);
+ conn.authContext = authContext;
+ // If we encounter an error preparing the handshake document, do NOT apply backpressure labels. Errors
+ // encountered building the handshake document are all client-side, and do not indicate an overloaded server.
+ const handshakeDoc = await prepareHandshakeDocument(authContext);
+ // @ts-expect-error: TODO(NODE-5141): The options need to be filtered properly, Connection options differ from Command options
+ const handshakeOptions = { ...options, raw: false };
+ if (typeof options.connectTimeoutMS === 'number') {
+ // The handshake technically is a monitoring check, so its socket timeout should be connectTimeoutMS
+ handshakeOptions.socketTimeoutMS = options.connectTimeoutMS;
+ }
+ const start = new Date().getTime();
+ const response = await executeHandshake(handshakeDoc, handshakeOptions);
+ if (!('isWritablePrimary' in response)) {
+ // Provide hello-style response document.
+ response.isWritablePrimary = response[constants_1.LEGACY_HELLO_COMMAND];
+ }
+ if (response.helloOk) {
+ conn.helloOk = true;
+ }
+ const supportedServerErr = checkSupportedServer(response, options);
+ if (supportedServerErr) {
+ throw supportedServerErr;
+ }
+ if (options.loadBalanced) {
+ if (!response.serviceId) {
+ throw new error_1.MongoCompatibilityError('Driver attempted to initialize in load balancing mode, ' +
+ 'but the server does not support this mode.');
+ }
+ }
+ // NOTE: This is metadata attached to the connection while porting away from
+ // handshake being done in the `Server` class. Likely, it should be
+ // relocated, or at very least restructured.
+ conn.hello = response;
+ conn.lastHelloMS = new Date().getTime() - start;
+ if (!response.arbiterOnly && credentials) {
+ // store the response on auth context
+ authContext.response = response;
+ const resolvedCredentials = credentials.resolveAuthMechanism(response);
+ const provider = options.authProviders.getOrCreateProvider(resolvedCredentials.mechanism, resolvedCredentials.mechanismProperties);
+ if (!provider) {
+ throw new error_1.MongoInvalidArgumentError(`No AuthProvider for ${resolvedCredentials.mechanism} defined.`);
+ }
+ try {
+ await provider.auth(authContext);
+ }
+ catch (error) {
+ // NOTE: If we encounter an error authenticating a connection, do NOT apply backpressure labels.
+ if (error instanceof error_1.MongoError) {
+ error.addErrorLabel(error_1.MongoErrorLabel.HandshakeError);
+ if ((0, error_1.needsRetryableWriteLabel)(error, response.maxWireVersion, conn.description.type)) {
+ error.addErrorLabel(error_1.MongoErrorLabel.RetryableWriteError);
+ }
+ }
+ throw error;
+ }
+ }
+ // Connection establishment is socket creation (tcp handshake, tls handshake, MongoDB handshake (saslStart, saslContinue))
+ // Once connection is established, command logging can log events (if enabled)
+ conn.established = true;
+ async function executeHandshake(handshakeDoc, handshakeOptions) {
+ try {
+ const handshakeResponse = await conn.command((0, utils_1.ns)('admin.$cmd'), handshakeDoc, handshakeOptions);
+ return handshakeResponse;
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoError) {
+ error.addErrorLabel(error_1.MongoErrorLabel.HandshakeError);
+ }
+ // If we encounter a network error executing the initial handshake, apply backpressure labels.
+ if (error instanceof error_1.MongoNetworkError) {
+ applyBackpressureLabels(error);
+ }
+ throw error;
+ }
+ }
+}
+/**
+ * @internal
+ *
+ * This function is only exposed for testing purposes.
+ */
+async function prepareHandshakeDocument(authContext) {
+ const options = authContext.options;
+ const compressors = options.compressors ? options.compressors : [];
+ const { serverApi } = authContext.connection;
+ const clientMetadata = await options.metadata;
+ const handshakeDoc = {
+ [serverApi?.version || options.loadBalanced === true ? 'hello' : constants_1.LEGACY_HELLO_COMMAND]: 1,
+ backpressure: true,
+ helloOk: true,
+ client: clientMetadata,
+ compression: compressors
+ };
+ if (options.loadBalanced === true) {
+ handshakeDoc.loadBalanced = true;
+ }
+ const credentials = authContext.credentials;
+ if (credentials) {
+ if (credentials.mechanism === providers_1.AuthMechanism.MONGODB_DEFAULT && credentials.username) {
+ handshakeDoc.saslSupportedMechs = `${credentials.source}.${credentials.username}`;
+ const provider = authContext.options.authProviders.getOrCreateProvider(providers_1.AuthMechanism.MONGODB_SCRAM_SHA256, credentials.mechanismProperties);
+ if (!provider) {
+ // This auth mechanism is always present.
+ throw new error_1.MongoInvalidArgumentError(`No AuthProvider for ${providers_1.AuthMechanism.MONGODB_SCRAM_SHA256} defined.`);
+ }
+ return await provider.prepare(handshakeDoc, authContext);
+ }
+ const provider = authContext.options.authProviders.getOrCreateProvider(credentials.mechanism, credentials.mechanismProperties);
+ if (!provider) {
+ throw new error_1.MongoInvalidArgumentError(`No AuthProvider for ${credentials.mechanism} defined.`);
+ }
+ return await provider.prepare(handshakeDoc, authContext);
+ }
+ return handshakeDoc;
+}
+/**
+ * @internal
+ * Default TCP keepAlive initial delay in milliseconds.
+ * Set to half the Azure load balancer idle timeout (240s) to ensure
+ * probes fire well before cloud LBs (Azure, AWS PrivateLink/NLB)
+ * drop idle connections.
+ */
+exports.DEFAULT_KEEP_ALIVE_INITIAL_DELAY_MS = 120_000;
+/** @public */
+exports.LEGAL_TLS_SOCKET_OPTIONS = [
+ 'allowPartialTrustChain',
+ 'ALPNProtocols',
+ 'ca',
+ 'cert',
+ 'checkServerIdentity',
+ 'ciphers',
+ 'crl',
+ 'ecdhCurve',
+ 'key',
+ 'minDHSize',
+ 'passphrase',
+ 'pfx',
+ 'rejectUnauthorized',
+ 'secureContext',
+ 'secureProtocol',
+ 'servername',
+ 'session'
+];
+/** @public */
+exports.LEGAL_TCP_SOCKET_OPTIONS = [
+ 'autoSelectFamily',
+ 'autoSelectFamilyAttemptTimeout',
+ 'keepAliveInitialDelay',
+ 'family',
+ 'hints',
+ 'localAddress',
+ 'localPort',
+ 'lookup'
+];
+function parseConnectOptions(options) {
+ const hostAddress = options.hostAddress;
+ if (!hostAddress)
+ throw new error_1.MongoInvalidArgumentError('Option "hostAddress" is required');
+ const result = {};
+ for (const name of exports.LEGAL_TCP_SOCKET_OPTIONS) {
+ if (options[name] != null) {
+ result[name] = options[name];
+ }
+ }
+ result.keepAliveInitialDelay ??= exports.DEFAULT_KEEP_ALIVE_INITIAL_DELAY_MS;
+ result.keepAlive = true;
+ result.noDelay = options.noDelay ?? true;
+ if (typeof hostAddress.socketPath === 'string') {
+ result.path = hostAddress.socketPath;
+ return result;
+ }
+ else if (typeof hostAddress.host === 'string') {
+ result.host = hostAddress.host;
+ result.port = hostAddress.port;
+ return result;
+ }
+ else {
+ // This should never happen since we set up HostAddresses
+ // But if we don't throw here the socket could hang until timeout
+ // TODO(NODE-3483)
+ throw new error_1.MongoRuntimeError(`Unexpected HostAddress ${JSON.stringify(hostAddress)}`);
+ }
+}
+function parseSslOptions(options) {
+ const result = parseConnectOptions(options);
+ // Merge in valid SSL options
+ for (const name of exports.LEGAL_TLS_SOCKET_OPTIONS) {
+ if (options[name] != null) {
+ result[name] = options[name];
+ }
+ }
+ if (options.existingSocket) {
+ result.socket = options.existingSocket;
+ }
+ // Set default sni servername to be the same as host
+ if (result.servername == null && result.host && !net.isIP(result.host)) {
+ result.servername = result.host;
+ }
+ return result;
+}
+async function makeSocket(options) {
+ const useTLS = options.tls ?? false;
+ const connectTimeoutMS = options.connectTimeoutMS ?? 30000;
+ const existingSocket = options.existingSocket;
+ const keepAliveInitialDelay = options.keepAliveInitialDelay ?? exports.DEFAULT_KEEP_ALIVE_INITIAL_DELAY_MS;
+ const noDelay = options.noDelay ?? true;
+ let socket;
+ if (options.proxyHost != null) {
+ // Currently, only Socks5 is supported.
+ return await makeSocks5Connection({
+ ...options,
+ connectTimeoutMS // Should always be present for Socks5
+ });
+ }
+ if (useTLS) {
+ const tlsSocket = tls.connect(parseSslOptions(options));
+ if (typeof tlsSocket.disableRenegotiation === 'function') {
+ tlsSocket.disableRenegotiation();
+ }
+ socket = tlsSocket;
+ }
+ else if (existingSocket) {
+ // In the TLS case, parseSslOptions() sets options.socket to existingSocket,
+ // so we only need to handle the non-TLS case here (where existingSocket
+ // gives us all we need out of the box).
+ socket = existingSocket;
+ }
+ else {
+ socket = net.createConnection(parseConnectOptions(options));
+ }
+ // Explicit setKeepAlive/setNoDelay are required because tls.connect() silently
+ // ignores these constructor options due to a Node.js bug.
+ // See: https://github.com/nodejs/node/issues/62003
+ // TODO(NODE-7474): remove this fix once the underlying Node.js issue is resolved.
+ socket.setKeepAlive(true, keepAliveInitialDelay);
+ socket.setNoDelay(noDelay);
+ socket.setTimeout(connectTimeoutMS);
+ let cancellationHandler = null;
+ const { promise: connectedSocket, resolve, reject } = (0, utils_1.promiseWithResolvers)();
+ if (existingSocket) {
+ resolve(socket);
+ }
+ else {
+ const start = performance.now();
+ const connectEvent = useTLS ? 'secureConnect' : 'connect';
+ socket
+ .once(connectEvent, () => resolve(socket))
+ .once('error', cause => reject(new error_1.MongoNetworkError(error_1.MongoError.buildErrorMessage(cause), { cause })))
+ .once('timeout', () => {
+ reject(new error_1.MongoNetworkTimeoutError(`Socket '${connectEvent}' timed out after ${(performance.now() - start) | 0}ms (connectTimeoutMS: ${connectTimeoutMS})`));
+ })
+ .once('close', () => reject(new error_1.MongoNetworkError(`Socket closed after ${(performance.now() - start) | 0} during connection establishment`)));
+ if (options.cancellationToken != null) {
+ cancellationHandler = () => reject(new error_1.MongoNetworkError(`Socket connection establishment was cancelled after ${(performance.now() - start) | 0}`));
+ options.cancellationToken.once('cancel', cancellationHandler);
+ }
+ }
+ try {
+ socket = await connectedSocket;
+ return socket;
+ }
+ catch (error) {
+ // If we encounter an error while establishing a socket, apply the backpressure labels to it. We cannot
+ // differentiate between DNS, TLS errors and network errors without refactoring our connection establishment to
+ // handle all three steps separately.
+ applyBackpressureLabels(error);
+ socket.destroy();
+ throw error;
+ }
+ finally {
+ socket.setTimeout(0);
+ if (cancellationHandler != null) {
+ options.cancellationToken?.removeListener('cancel', cancellationHandler);
+ }
+ }
+}
+let socks = null;
+function loadSocks() {
+ if (socks == null) {
+ const socksImport = (0, deps_1.getSocks)();
+ if ('kModuleError' in socksImport) {
+ throw socksImport.kModuleError;
+ }
+ socks = socksImport;
+ }
+ return socks;
+}
+async function makeSocks5Connection(options) {
+ const hostAddress = utils_1.HostAddress.fromHostPort(options.proxyHost ?? '', // proxyHost is guaranteed to set here
+ options.proxyPort ?? 1080);
+ // First, connect to the proxy server itself:
+ const rawSocket = await makeSocket({
+ ...options,
+ hostAddress,
+ tls: false,
+ proxyHost: undefined
+ });
+ const destination = parseConnectOptions(options);
+ if (typeof destination.host !== 'string' || typeof destination.port !== 'number') {
+ throw new error_1.MongoInvalidArgumentError('Can only make Socks5 connections to TCP hosts');
+ }
+ socks ??= loadSocks();
+ let existingSocket;
+ try {
+ // Then, establish the Socks5 proxy connection:
+ const connection = await socks.SocksClient.createConnection({
+ existing_socket: rawSocket,
+ timeout: options.connectTimeoutMS,
+ command: 'connect',
+ destination: {
+ host: destination.host,
+ port: destination.port
+ },
+ proxy: {
+ // host and port are ignored because we pass existing_socket
+ host: 'iLoveJavaScript',
+ port: 0,
+ type: 5,
+ userId: options.proxyUsername || undefined,
+ password: options.proxyPassword || undefined
+ }
+ });
+ existingSocket = connection.socket;
+ }
+ catch (cause) {
+ throw new error_1.MongoNetworkError(error_1.MongoError.buildErrorMessage(cause), { cause });
+ }
+ // Finally, now treat the resulting duplex stream as the
+ // socket over which we send and receive wire protocol messages:
+ return await makeSocket({ ...options, existingSocket, proxyHost: undefined });
+}
+//# sourceMappingURL=connect.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/connect.js.map b/node_modules/mongodb/lib/cmap/connect.js.map
new file mode 100644
index 00000000..df6e3587
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/connect.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/cmap/connect.ts"],"names":[],"mappings":";;;AA0CA,0BAWC;AAED,wCAOC;AA2BD,0DAwHC;AAyBD,4DA+CC;AAgGD,gCAgGC;AAxdD,2BAA2B;AAE3B,2BAA2B;AAG3B,4CAAoD;AACpD,kCAAkD;AAClD,oCASkB;AAClB,oCAAiE;AACjE,wDAAmD;AACnD,gDAAiD;AACjD,6CAKsB;AACtB,yDAKmC;AAKnC,SAAS,uBAAuB,CAAC,KAAiB;IAChD,KAAK,CAAC,aAAa,CAAC,uBAAe,CAAC,qBAAqB,CAAC,CAAC;IAC3D,KAAK,CAAC,aAAa,CAAC,uBAAe,CAAC,cAAc,CAAC,CAAC;AACtD,CAAC;AAEM,KAAK,UAAU,OAAO,CAAC,OAA0B;IACtD,IAAI,UAAU,GAAsB,IAAI,CAAC;IACzC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QACzC,UAAU,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7C,MAAM,uBAAuB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACnD,OAAO,UAAU,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;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O,CAA0B,CAAC;IAC1E,IAAI,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACjF,MAAM,IAAI,iCAAyB,CAAC,+CAA+C,CAAC,CAAC;IACvF,CAAC;IAED,KAAK,KAAK,SAAS,EAAE,CAAC;IAEtB,IAAI,cAAsB,CAAC;IAE3B,IAAI,CAAC;QACH,+CAA+C;QAC/C,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC;YAC1D,eAAe,EAAE,SAAS;YAC1B,OAAO,EAAE,OAAO,CAAC,gBAAgB;YACjC,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE;gBACX,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,IAAI,EAAE,WAAW,CAAC,IAAI;aACvB;YACD,KAAK,EAAE;gBACL,4DAA4D;gBAC5D,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,CAAC;gBACP,IAAI,EAAE,CAAC;gBACP,MAAM,EAAE,OAAO,CAAC,aAAa,IAAI,SAAS;gBAC1C,QAAQ,EAAE,OAAO,CAAC,aAAa,IAAI,SAAS;aAC7C;SACF,CAAC,CAAC;QACH,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,yBAAiB,CAAC,kBAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,wDAAwD;IACxD,gEAAgE;IAChE,OAAO,MAAM,UAAU,CAAC,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;AAChF,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/connection.js b/node_modules/mongodb/lib/cmap/connection.js
new file mode 100644
index 00000000..93404510
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/connection.js
@@ -0,0 +1,574 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CryptoConnection = exports.SizedMessageTransform = exports.Connection = void 0;
+exports.hasSessionSupport = hasSessionSupport;
+const stream_1 = require("stream");
+const timers_1 = require("timers");
+const bson_1 = require("../bson");
+const constants_1 = require("../constants");
+const error_1 = require("../error");
+const mongo_logger_1 = require("../mongo_logger");
+const mongo_types_1 = require("../mongo_types");
+const read_preference_1 = require("../read_preference");
+const common_1 = require("../sdam/common");
+const sessions_1 = require("../sessions");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const command_monitoring_events_1 = require("./command_monitoring_events");
+const commands_1 = require("./commands");
+const stream_description_1 = require("./stream_description");
+const compression_1 = require("./wire_protocol/compression");
+const on_data_1 = require("./wire_protocol/on_data");
+const responses_1 = require("./wire_protocol/responses");
+const shared_1 = require("./wire_protocol/shared");
+/** @internal */
+function hasSessionSupport(conn) {
+ const description = conn.description;
+ return description.logicalSessionTimeoutMinutes != null;
+}
+function streamIdentifier(stream, options) {
+ if (options.proxyHost) {
+ // If proxy options are specified, the properties of `stream` itself
+ // will not accurately reflect what endpoint this is connected to.
+ return options.hostAddress.toString();
+ }
+ const { remoteAddress, remotePort } = stream;
+ if (typeof remoteAddress === 'string' && typeof remotePort === 'number') {
+ return utils_1.HostAddress.fromHostPort(remoteAddress, remotePort).toString();
+ }
+ return bson_1.ByteUtils.toHex((0, utils_1.uuidV4)());
+}
+/** @internal */
+class Connection extends mongo_types_1.TypedEventEmitter {
+ /** @event */
+ static { this.COMMAND_STARTED = constants_1.COMMAND_STARTED; }
+ /** @event */
+ static { this.COMMAND_SUCCEEDED = constants_1.COMMAND_SUCCEEDED; }
+ /** @event */
+ static { this.COMMAND_FAILED = constants_1.COMMAND_FAILED; }
+ /** @event */
+ static { this.CLUSTER_TIME_RECEIVED = constants_1.CLUSTER_TIME_RECEIVED; }
+ /** @event */
+ static { this.CLOSE = constants_1.CLOSE; }
+ /** @event */
+ static { this.PINNED = constants_1.PINNED; }
+ /** @event */
+ static { this.UNPINNED = constants_1.UNPINNED; }
+ constructor(stream, options) {
+ super();
+ this.lastHelloMS = -1;
+ this.helloOk = false;
+ this.delayedTimeoutId = null;
+ /** Indicates that the connection (including underlying TCP socket) has been closed. */
+ this.closed = false;
+ this.clusterTime = null;
+ this.error = null;
+ this.dataEvents = null;
+ this.on('error', utils_1.noop);
+ this.socket = stream;
+ this.id = options.id;
+ this.address = streamIdentifier(stream, options);
+ this.socketTimeoutMS = options.socketTimeoutMS ?? 0;
+ this.monitorCommands = options.monitorCommands;
+ this.serverApi = options.serverApi;
+ this.mongoLogger = options.mongoLogger;
+ this.established = false;
+ this.description = new stream_description_1.StreamDescription(this.address, options);
+ this.generation = options.generation;
+ this.lastUseTime = (0, utils_1.processTimeMS)();
+ this.messageStream = this.socket
+ .on('error', this.onSocketError.bind(this))
+ .pipe(new SizedMessageTransform({ connection: this }))
+ .on('error', this.onTransformError.bind(this));
+ this.socket.on('close', this.onClose.bind(this));
+ this.socket.on('timeout', this.onTimeout.bind(this));
+ this.messageStream.pause();
+ }
+ get hello() {
+ return this.description.hello;
+ }
+ // the `connect` method stores the result of the handshake hello on the connection
+ set hello(response) {
+ this.description.receiveResponse(response);
+ Object.freeze(this.description);
+ }
+ get serviceId() {
+ return this.hello?.serviceId;
+ }
+ get loadBalanced() {
+ return this.description.loadBalanced;
+ }
+ get idleTime() {
+ return (0, utils_1.calculateDurationInMs)(this.lastUseTime);
+ }
+ get hasSessionSupport() {
+ return this.description.logicalSessionTimeoutMinutes != null;
+ }
+ get supportsOpMsg() {
+ return (this.description != null &&
+ // TODO(NODE-6672,NODE-6287): This guard is primarily for maxWireVersion = 0
+ (0, utils_1.maxWireVersion)(this) >= 6 &&
+ !this.description.__nodejs_mock_server__);
+ }
+ get shouldEmitAndLogCommand() {
+ return ((this.monitorCommands ||
+ (this.established &&
+ !this.authContext?.reauthenticating &&
+ this.mongoLogger?.willLog(mongo_logger_1.MongoLoggableComponent.COMMAND, mongo_logger_1.SeverityLevel.DEBUG))) ??
+ false);
+ }
+ markAvailable() {
+ this.lastUseTime = (0, utils_1.processTimeMS)();
+ }
+ onSocketError(cause) {
+ this.onError(new error_1.MongoNetworkError(cause.message, { cause }));
+ }
+ onTransformError(error) {
+ this.onError(error);
+ }
+ onError(error) {
+ this.cleanup(error);
+ }
+ onClose() {
+ const message = `connection ${this.id} to ${this.address} closed`;
+ this.cleanup(new error_1.MongoNetworkError(message));
+ }
+ onTimeout() {
+ this.delayedTimeoutId = (0, timers_1.setTimeout)(() => {
+ const message = `connection ${this.id} to ${this.address} timed out`;
+ const beforeHandshake = this.hello == null;
+ this.cleanup(new error_1.MongoNetworkTimeoutError(message, { beforeHandshake }));
+ }, 1).unref(); // No need for this timer to hold the event loop open
+ }
+ destroy() {
+ if (this.closed) {
+ return;
+ }
+ // load balanced mode requires that these listeners remain on the connection
+ // after cleanup on timeouts, errors or close so we remove them before calling
+ // cleanup.
+ this.removeAllListeners(Connection.PINNED);
+ this.removeAllListeners(Connection.UNPINNED);
+ const message = `connection ${this.id} to ${this.address} closed`;
+ this.cleanup(new error_1.MongoNetworkError(message));
+ }
+ /**
+ * A method that cleans up the connection. When `force` is true, this method
+ * forcibly destroys the socket.
+ *
+ * If an error is provided, any in-flight operations will be closed with the error.
+ *
+ * This method does nothing if the connection is already closed.
+ */
+ cleanup(error) {
+ if (this.closed) {
+ return;
+ }
+ this.socket.destroy();
+ this.error = error;
+ this.dataEvents?.throw(error).then(undefined, utils_1.squashError);
+ this.closed = true;
+ this.emit(Connection.CLOSE);
+ }
+ prepareCommand(db, command, options) {
+ let cmd = { ...command };
+ const readPreference = (0, shared_1.getReadPreference)(options);
+ const session = options?.session;
+ let clusterTime = this.clusterTime;
+ if (this.serverApi) {
+ const { version, strict, deprecationErrors } = this.serverApi;
+ cmd.apiVersion = version;
+ if (strict != null)
+ cmd.apiStrict = strict;
+ if (deprecationErrors != null)
+ cmd.apiDeprecationErrors = deprecationErrors;
+ }
+ if (this.hasSessionSupport && session) {
+ if (session.clusterTime &&
+ clusterTime &&
+ session.clusterTime.clusterTime.greaterThan(clusterTime.clusterTime)) {
+ clusterTime = session.clusterTime;
+ }
+ const sessionError = (0, sessions_1.applySession)(session, cmd, options);
+ if (sessionError)
+ throw sessionError;
+ }
+ else if (session?.explicit) {
+ throw new error_1.MongoCompatibilityError('Current topology does not support sessions');
+ }
+ // if we have a known cluster time, gossip it
+ if (clusterTime) {
+ cmd.$clusterTime = clusterTime;
+ }
+ // For standalone, drivers MUST NOT set $readPreference.
+ if (this.description.type !== common_1.ServerType.Standalone) {
+ if (!(0, shared_1.isSharded)(this) &&
+ !this.description.loadBalanced &&
+ this.supportsOpMsg &&
+ options.directConnection === true &&
+ readPreference?.mode === 'primary') {
+ // For mongos and load balancers with 'primary' mode, drivers MUST NOT set $readPreference.
+ // For all other types with a direct connection, if the read preference is 'primary'
+ // (driver sets 'primary' as default if no read preference is configured),
+ // the $readPreference MUST be set to 'primaryPreferred'
+ // to ensure that any server type can handle the request.
+ cmd.$readPreference = read_preference_1.ReadPreference.primaryPreferred.toJSON();
+ }
+ else if ((0, shared_1.isSharded)(this) && !this.supportsOpMsg && readPreference?.mode !== 'primary') {
+ // When sending a read operation via OP_QUERY and the $readPreference modifier,
+ // the query MUST be provided using the $query modifier.
+ cmd = {
+ $query: cmd,
+ $readPreference: readPreference.toJSON()
+ };
+ }
+ else if (readPreference?.mode !== 'primary') {
+ // For mode 'primary', drivers MUST NOT set $readPreference.
+ // For all other read preference modes (i.e. 'secondary', 'primaryPreferred', ...),
+ // drivers MUST set $readPreference
+ cmd.$readPreference = readPreference.toJSON();
+ }
+ }
+ const commandOptions = {
+ numberToSkip: 0,
+ numberToReturn: -1,
+ checkKeys: false,
+ // This value is not overridable
+ secondaryOk: readPreference.secondaryOk(),
+ ...options
+ };
+ options.timeoutContext?.addMaxTimeMSToCommand(cmd, options);
+ const message = this.supportsOpMsg
+ ? new commands_1.OpMsgRequest(db, cmd, commandOptions)
+ : new commands_1.OpQueryRequest(db, cmd, commandOptions);
+ return message;
+ }
+ async *sendWire(message, options, responseType) {
+ this.throwIfAborted();
+ const timeout = options.socketTimeoutMS ??
+ options?.timeoutContext?.getSocketTimeoutMS() ??
+ this.socketTimeoutMS;
+ this.socket.setTimeout(timeout);
+ try {
+ await this.writeCommand(message, {
+ agreedCompressor: this.description.compressor ?? 'none',
+ zlibCompressionLevel: this.description.zlibCompressionLevel,
+ timeoutContext: options.timeoutContext,
+ signal: options.signal
+ });
+ if (message.moreToCome) {
+ yield responses_1.MongoDBResponse.empty;
+ return;
+ }
+ this.throwIfAborted();
+ if (options.timeoutContext?.csotEnabled() &&
+ options.timeoutContext.minRoundTripTime != null &&
+ options.timeoutContext.remainingTimeMS < options.timeoutContext.minRoundTripTime) {
+ throw new error_1.MongoOperationTimeoutError('Server roundtrip time is greater than the time remaining');
+ }
+ for await (const response of this.readMany(options)) {
+ this.socket.setTimeout(0);
+ const bson = response.parse();
+ const document = (responseType ?? responses_1.MongoDBResponse).make(bson);
+ yield document;
+ this.throwIfAborted();
+ this.socket.setTimeout(timeout);
+ }
+ }
+ finally {
+ this.socket.setTimeout(0);
+ }
+ }
+ async *sendCommand(ns, command, options, responseType) {
+ options?.signal?.throwIfAborted();
+ const message = this.prepareCommand(ns.db, command, options);
+ let started = 0;
+ if (this.shouldEmitAndLogCommand) {
+ started = (0, utils_1.processTimeMS)();
+ this.emitAndLogCommand(this.monitorCommands, Connection.COMMAND_STARTED, message.databaseName, this.established, new command_monitoring_events_1.CommandStartedEvent(this, message, this.description.serverConnectionId));
+ }
+ // If `documentsReturnedIn` not set or raw is not enabled, use input bson options
+ // Otherwise, support raw flag. Raw only works for cursors that hardcode firstBatch/nextBatch fields
+ const bsonOptions = options.documentsReturnedIn == null || !options.raw
+ ? options
+ : {
+ ...options,
+ raw: false,
+ fieldsAsRaw: { [options.documentsReturnedIn]: true }
+ };
+ /** MongoDBResponse instance or subclass */
+ let document = undefined;
+ /** Cached result of a toObject call */
+ let object = undefined;
+ try {
+ this.throwIfAborted();
+ for await (document of this.sendWire(message, options, responseType)) {
+ object = undefined;
+ if (options.session != null) {
+ (0, sessions_1.updateSessionFromResponse)(options.session, document);
+ }
+ if (document.$clusterTime) {
+ this.clusterTime = document.$clusterTime;
+ this.emit(Connection.CLUSTER_TIME_RECEIVED, document.$clusterTime);
+ }
+ if (document.ok === 0) {
+ if (options.timeoutContext?.csotEnabled() && document.isMaxTimeExpiredError) {
+ throw new error_1.MongoOperationTimeoutError('Server reported a timeout error', {
+ cause: new error_1.MongoServerError((object ??= document.toObject(bsonOptions)))
+ });
+ }
+ throw new error_1.MongoServerError((object ??= document.toObject(bsonOptions)));
+ }
+ if (this.shouldEmitAndLogCommand) {
+ this.emitAndLogCommand(this.monitorCommands, Connection.COMMAND_SUCCEEDED, message.databaseName, this.established, new command_monitoring_events_1.CommandSucceededEvent(this, message, message.moreToCome ? { ok: 1 } : (object ??= document.toObject(bsonOptions)), started, this.description.serverConnectionId));
+ }
+ if (responseType == null) {
+ yield (object ??= document.toObject(bsonOptions));
+ }
+ else {
+ yield document;
+ }
+ this.throwIfAborted();
+ }
+ }
+ catch (error) {
+ if (options.session != null && !(error instanceof error_1.MongoServerError)) {
+ (0, sessions_1.updateSessionFromResponse)(options.session, responses_1.MongoDBResponse.empty);
+ }
+ if (this.shouldEmitAndLogCommand) {
+ this.emitAndLogCommand(this.monitorCommands, Connection.COMMAND_FAILED, message.databaseName, this.established, new command_monitoring_events_1.CommandFailedEvent(this, message, error, started, this.description.serverConnectionId));
+ }
+ throw error;
+ }
+ }
+ async command(ns, command, options = {}, responseType) {
+ this.throwIfAborted();
+ options.signal?.throwIfAborted();
+ for await (const document of this.sendCommand(ns, command, options, responseType)) {
+ if (options.timeoutContext?.csotEnabled()) {
+ if (responses_1.MongoDBResponse.is(document)) {
+ if (document.isMaxTimeExpiredError) {
+ throw new error_1.MongoOperationTimeoutError('Server reported a timeout error', {
+ cause: new error_1.MongoServerError(document.toObject())
+ });
+ }
+ }
+ else {
+ if ((Array.isArray(document?.writeErrors) &&
+ document.writeErrors.some(error => error?.code === error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired)) ||
+ document?.writeConcernError?.code === error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired) {
+ throw new error_1.MongoOperationTimeoutError('Server reported a timeout error', {
+ cause: new error_1.MongoServerError(document)
+ });
+ }
+ }
+ }
+ return document;
+ }
+ throw new error_1.MongoUnexpectedServerResponseError('Unable to get response from server');
+ }
+ exhaustCommand(ns, command, options, replyListener) {
+ const exhaustLoop = async () => {
+ this.throwIfAborted();
+ for await (const reply of this.sendCommand(ns, command, options)) {
+ replyListener(undefined, reply);
+ this.throwIfAborted();
+ }
+ throw new error_1.MongoUnexpectedServerResponseError('Server ended moreToCome unexpectedly');
+ };
+ exhaustLoop().then(undefined, replyListener);
+ }
+ throwIfAborted() {
+ if (this.error)
+ throw this.error;
+ }
+ /**
+ * @internal
+ *
+ * Writes an OP_MSG or OP_QUERY request to the socket, optionally compressing the command. This method
+ * waits until the socket's buffer has emptied (the Nodejs socket `drain` event has fired).
+ */
+ async writeCommand(command, options) {
+ const finalCommand = options.agreedCompressor === 'none' || !commands_1.OpCompressedRequest.canCompress(command)
+ ? command
+ : new commands_1.OpCompressedRequest(command, {
+ agreedCompressor: options.agreedCompressor ?? 'none',
+ zlibCompressionLevel: options.zlibCompressionLevel ?? 0
+ });
+ const buffer = bson_1.ByteUtils.concat(await finalCommand.toBin());
+ if (options.timeoutContext?.csotEnabled()) {
+ if (options.timeoutContext.minRoundTripTime != null &&
+ options.timeoutContext.remainingTimeMS < options.timeoutContext.minRoundTripTime) {
+ throw new error_1.MongoOperationTimeoutError('Server roundtrip time is greater than the time remaining');
+ }
+ }
+ try {
+ if (this.socket.write(buffer))
+ return;
+ }
+ catch (writeError) {
+ const networkError = new error_1.MongoNetworkError('unexpected error writing to socket', {
+ cause: writeError
+ });
+ this.onError(networkError);
+ throw networkError;
+ }
+ const drainEvent = (0, utils_1.once)(this.socket, 'drain', options);
+ const timeout = options?.timeoutContext?.timeoutForSocketWrite;
+ const drained = timeout ? Promise.race([drainEvent, timeout]) : drainEvent;
+ try {
+ return await drained;
+ }
+ catch (writeError) {
+ if (timeout_1.TimeoutError.is(writeError)) {
+ const timeoutError = new error_1.MongoOperationTimeoutError('Timed out at socket write');
+ this.onError(timeoutError);
+ throw timeoutError;
+ }
+ else if (writeError === options.signal?.reason) {
+ this.onError(writeError);
+ }
+ throw writeError;
+ }
+ finally {
+ timeout?.clear();
+ }
+ }
+ /**
+ * @internal
+ *
+ * Returns an async generator that yields full wire protocol messages from the underlying socket. This function
+ * yields messages until `moreToCome` is false or not present in a response, or the caller cancels the request
+ * by calling `return` on the generator.
+ *
+ * Note that `for-await` loops call `return` automatically when the loop is exited.
+ */
+ async *readMany(options) {
+ try {
+ this.dataEvents = (0, on_data_1.onData)(this.messageStream, options);
+ this.messageStream.resume();
+ for await (const message of this.dataEvents) {
+ const response = await (0, compression_1.decompressResponse)(message);
+ yield response;
+ if (!response.moreToCome) {
+ return;
+ }
+ }
+ }
+ catch (readError) {
+ if (timeout_1.TimeoutError.is(readError)) {
+ const timeoutError = new error_1.MongoOperationTimeoutError(`Timed out during socket read (${readError.duration}ms)`);
+ this.dataEvents = null;
+ this.onError(timeoutError);
+ throw timeoutError;
+ }
+ else if (readError === options.signal?.reason) {
+ this.onError(readError);
+ }
+ throw readError;
+ }
+ finally {
+ this.dataEvents = null;
+ this.messageStream.pause();
+ }
+ }
+}
+exports.Connection = Connection;
+/** @internal */
+class SizedMessageTransform extends stream_1.Transform {
+ constructor({ connection }) {
+ super({ writableObjectMode: false, readableObjectMode: true });
+ this.bufferPool = new utils_1.BufferPool();
+ this.connection = connection;
+ }
+ _transform(chunk, encoding, callback) {
+ if (this.connection.delayedTimeoutId != null) {
+ (0, timers_1.clearTimeout)(this.connection.delayedTimeoutId);
+ this.connection.delayedTimeoutId = null;
+ }
+ this.bufferPool.append(chunk);
+ while (this.bufferPool.length) {
+ // While there are any bytes in the buffer
+ // Try to fetch a size from the top 4 bytes
+ const sizeOfMessage = this.bufferPool.getInt32();
+ if (sizeOfMessage == null) {
+ // Not even an int32 worth of data. Stop the loop, we need more chunks.
+ break;
+ }
+ if (sizeOfMessage < 0) {
+ // The size in the message has a negative value, this is probably corruption, throw:
+ return callback(new error_1.MongoParseError(`Message size cannot be negative: ${sizeOfMessage}`));
+ }
+ if (sizeOfMessage > this.bufferPool.length) {
+ // We do not have enough bytes to make a sizeOfMessage chunk
+ break;
+ }
+ // Add a message to the stream
+ const message = this.bufferPool.read(sizeOfMessage);
+ if (!this.push(message)) {
+ // We only subscribe to data events so we should never get backpressure
+ // if we do, we do not have the handling for it.
+ return callback(new error_1.MongoRuntimeError(`SizedMessageTransform does not support backpressure`));
+ }
+ }
+ callback();
+ }
+}
+exports.SizedMessageTransform = SizedMessageTransform;
+/** @internal */
+class CryptoConnection extends Connection {
+ constructor(stream, options) {
+ super(stream, options);
+ this.autoEncrypter = options.autoEncrypter;
+ }
+ async command(ns, cmd, options, responseType) {
+ const { autoEncrypter } = this;
+ if (!autoEncrypter) {
+ throw new error_1.MongoRuntimeError('No AutoEncrypter available for encryption');
+ }
+ const serverWireVersion = (0, utils_1.maxWireVersion)(this);
+ if (serverWireVersion === 0) {
+ // This means the initial handshake hasn't happened yet
+ return await super.command(ns, cmd, options, responseType);
+ }
+ // Save sort or indexKeys based on the command being run
+ // the encrypt API serializes our JS objects to BSON to pass to the native code layer
+ // and then deserializes the encrypted result, the protocol level components
+ // of the command (ex. sort) are then converted to JS objects potentially losing
+ // import key order information. These fields are never encrypted so we can save the values
+ // from before the encryption and replace them after encryption has been performed
+ const sort = cmd.find || cmd.findAndModify ? cmd.sort : null;
+ const indexKeys = cmd.createIndexes
+ ? cmd.indexes.map((index) => index.key)
+ : null;
+ const encrypted = await autoEncrypter.encrypt(ns.toString(), cmd, options);
+ // Replace the saved values
+ if (sort != null && (cmd.find || cmd.findAndModify)) {
+ encrypted.sort = sort;
+ }
+ if (indexKeys != null && cmd.createIndexes) {
+ for (const [offset, index] of indexKeys.entries()) {
+ // @ts-expect-error `encrypted` is a generic "command", but we've narrowed for only `createIndexes` commands here
+ encrypted.indexes[offset].key = index;
+ }
+ }
+ const encryptedResponse = await super.command(ns, encrypted, options,
+ // Eventually we want to require `responseType` which means we would satisfy `T` as the return type.
+ // In the meantime, we want encryptedResponse to always be _at least_ a MongoDBResponse if not a more specific subclass
+ // So that we can ensure we have access to the on-demand APIs for decorate response
+ responseType ?? responses_1.MongoDBResponse);
+ const result = await autoEncrypter.decrypt(encryptedResponse.toBytes(), options);
+ const decryptedResponse = responseType?.make(result) ?? (0, bson_1.deserialize)(result, options);
+ if (autoEncrypter[constants_1.kDecorateResult]) {
+ if (responseType == null) {
+ (0, utils_1.decorateDecryptionResult)(decryptedResponse, encryptedResponse.toObject(), true);
+ }
+ else if (decryptedResponse instanceof responses_1.CursorResponse) {
+ decryptedResponse.encryptedResponse = encryptedResponse;
+ }
+ }
+ return decryptedResponse;
+ }
+}
+exports.CryptoConnection = CryptoConnection;
+//# sourceMappingURL=connection.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/connection.js.map b/node_modules/mongodb/lib/cmap/connection.js.map
new file mode 100644
index 00000000..78e201ef
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/connection.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/cmap/connection.ts"],"names":[],"mappings":";;;AAmKA,8CAGC;AAtKD,mCAA0E;AAC1E,mCAAkD;AAElD,kCAOiB;AAEjB,4CASsB;AACtB,oCAUkB;AAGlB,kDAA0F;AAC1F,gDAA2F;AAC3F,wDAA6E;AAE7E,2CAA4C;AAC5C,0CAA0F;AAC1F,wCAA+D;AAC/D,oCAakB;AAIlB,2EAIqC;AACrC,yCAOoB;AAGpB,6DAAwF;AACxF,6DAAsF;AACtF,qD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ACpG,uHAAuH;QACvH,mFAAmF;QACnF,YAAY,IAAI,2BAAe,CAChC,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,iBAAiB,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAEjF,MAAM,iBAAiB,GAAG,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAA,kBAAW,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAErF,IAAI,aAAa,CAAC,2BAAe,CAAC,EAAE,CAAC;YACnC,IAAI,YAAY,IAAI,IAAI,EAAE,CAAC;gBACzB,IAAA,gCAAwB,EAAC,iBAAiB,EAAE,iBAAiB,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;YAClF,CAAC;iBAAM,IAAI,iBAAiB,YAAY,0BAAc,EAAE,CAAC;gBACvD,iBAAiB,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAxFD,4CAwFC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/connection_pool.js b/node_modules/mongodb/lib/cmap/connection_pool.js
new file mode 100644
index 00000000..c74af593
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/connection_pool.js
@@ -0,0 +1,558 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ConnectionPool = exports.PoolState = void 0;
+const timers_1 = require("timers");
+const constants_1 = require("../constants");
+const error_1 = require("../error");
+const mongo_types_1 = require("../mongo_types");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const connect_1 = require("./connect");
+const connection_1 = require("./connection");
+const connection_pool_events_1 = require("./connection_pool_events");
+const errors_1 = require("./errors");
+const metrics_1 = require("./metrics");
+/** @internal */
+exports.PoolState = Object.freeze({
+ paused: 'paused',
+ ready: 'ready',
+ closed: 'closed'
+});
+/**
+ * A pool of connections which dynamically resizes, and emit events related to pool activity
+ * @internal
+ */
+class ConnectionPool extends mongo_types_1.TypedEventEmitter {
+ /**
+ * Emitted when the connection pool is created.
+ * @event
+ */
+ static { this.CONNECTION_POOL_CREATED = constants_1.CONNECTION_POOL_CREATED; }
+ /**
+ * Emitted once when the connection pool is closed
+ * @event
+ */
+ static { this.CONNECTION_POOL_CLOSED = constants_1.CONNECTION_POOL_CLOSED; }
+ /**
+ * Emitted each time the connection pool is cleared and it's generation incremented
+ * @event
+ */
+ static { this.CONNECTION_POOL_CLEARED = constants_1.CONNECTION_POOL_CLEARED; }
+ /**
+ * Emitted each time the connection pool is marked ready
+ * @event
+ */
+ static { this.CONNECTION_POOL_READY = constants_1.CONNECTION_POOL_READY; }
+ /**
+ * Emitted when a connection is created.
+ * @event
+ */
+ static { this.CONNECTION_CREATED = constants_1.CONNECTION_CREATED; }
+ /**
+ * Emitted when a connection becomes established, and is ready to use
+ * @event
+ */
+ static { this.CONNECTION_READY = constants_1.CONNECTION_READY; }
+ /**
+ * Emitted when a connection is closed
+ * @event
+ */
+ static { this.CONNECTION_CLOSED = constants_1.CONNECTION_CLOSED; }
+ /**
+ * Emitted when an attempt to check out a connection begins
+ * @event
+ */
+ static { this.CONNECTION_CHECK_OUT_STARTED = constants_1.CONNECTION_CHECK_OUT_STARTED; }
+ /**
+ * Emitted when an attempt to check out a connection fails
+ * @event
+ */
+ static { this.CONNECTION_CHECK_OUT_FAILED = constants_1.CONNECTION_CHECK_OUT_FAILED; }
+ /**
+ * Emitted each time a connection is successfully checked out of the connection pool
+ * @event
+ */
+ static { this.CONNECTION_CHECKED_OUT = constants_1.CONNECTION_CHECKED_OUT; }
+ /**
+ * Emitted each time a connection is successfully checked into the connection pool
+ * @event
+ */
+ static { this.CONNECTION_CHECKED_IN = constants_1.CONNECTION_CHECKED_IN; }
+ constructor(server, options) {
+ super();
+ this.on('error', utils_1.noop);
+ this.options = Object.freeze({
+ connectionType: connection_1.Connection,
+ ...options,
+ maxPoolSize: options.maxPoolSize ?? 100,
+ minPoolSize: options.minPoolSize ?? 0,
+ maxConnecting: options.maxConnecting ?? 2,
+ maxIdleTimeMS: options.maxIdleTimeMS ?? 0,
+ waitQueueTimeoutMS: options.waitQueueTimeoutMS ?? 0,
+ minPoolSizeCheckFrequencyMS: options.minPoolSizeCheckFrequencyMS ?? 100,
+ autoEncrypter: options.autoEncrypter
+ });
+ if (this.options.minPoolSize > this.options.maxPoolSize) {
+ throw new error_1.MongoInvalidArgumentError('Connection pool minimum size must not be greater than maximum pool size');
+ }
+ this.poolState = exports.PoolState.paused;
+ this.server = server;
+ this.connections = new utils_1.List();
+ this.pending = 0;
+ this.checkedOut = new Set();
+ this.minPoolSizeTimer = undefined;
+ this.generation = 0;
+ this.serviceGenerations = new Map();
+ this.connectionCounter = (0, utils_1.makeCounter)(1);
+ this.cancellationToken = new mongo_types_1.CancellationToken();
+ this.cancellationToken.setMaxListeners(Infinity);
+ this.waitQueue = new utils_1.List();
+ this.metrics = new metrics_1.ConnectionPoolMetrics();
+ this.processingWaitQueue = false;
+ this.mongoLogger = this.server.topology.client?.mongoLogger;
+ this.component = 'connection';
+ queueMicrotask(() => {
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_CREATED, new connection_pool_events_1.ConnectionPoolCreatedEvent(this));
+ });
+ }
+ /** The address of the endpoint the pool is connected to */
+ get address() {
+ return this.options.hostAddress.toString();
+ }
+ /**
+ * Check if the pool has been closed
+ *
+ * TODO(NODE-3263): We can remove this property once shell no longer needs it
+ */
+ get closed() {
+ return this.poolState === exports.PoolState.closed;
+ }
+ /** An integer expressing how many total connections (available + pending + in use) the pool currently has */
+ get totalConnectionCount() {
+ return (this.availableConnectionCount + this.pendingConnectionCount + this.currentCheckedOutCount);
+ }
+ /** An integer expressing how many connections are currently available in the pool. */
+ get availableConnectionCount() {
+ return this.connections.length;
+ }
+ get pendingConnectionCount() {
+ return this.pending;
+ }
+ get currentCheckedOutCount() {
+ return this.checkedOut.size;
+ }
+ get waitQueueSize() {
+ return this.waitQueue.length;
+ }
+ get loadBalanced() {
+ return this.options.loadBalanced;
+ }
+ get serverError() {
+ return this.server.description.error;
+ }
+ /**
+ * This is exposed ONLY for use in mongosh, to enable
+ * killing all connections if a user quits the shell with
+ * operations in progress.
+ *
+ * This property may be removed as a part of NODE-3263.
+ */
+ get checkedOutConnections() {
+ return this.checkedOut;
+ }
+ /**
+ * Get the metrics information for the pool when a wait queue timeout occurs.
+ */
+ waitQueueErrorMetrics() {
+ return this.metrics.info(this.options.maxPoolSize);
+ }
+ /**
+ * Set the pool state to "ready"
+ */
+ ready() {
+ if (this.poolState !== exports.PoolState.paused) {
+ return;
+ }
+ this.poolState = exports.PoolState.ready;
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_READY, new connection_pool_events_1.ConnectionPoolReadyEvent(this));
+ (0, timers_1.clearTimeout)(this.minPoolSizeTimer);
+ this.ensureMinPoolSize();
+ }
+ /**
+ * Check a connection out of this pool. The connection will continue to be tracked, but no reference to it
+ * will be held by the pool. This means that if a connection is checked out it MUST be checked back in or
+ * explicitly destroyed by the new owner.
+ */
+ async checkOut(options) {
+ const checkoutTime = (0, utils_1.processTimeMS)();
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECK_OUT_STARTED, new connection_pool_events_1.ConnectionCheckOutStartedEvent(this));
+ const { promise, resolve, reject } = (0, utils_1.promiseWithResolvers)();
+ const timeout = options.timeoutContext.connectionCheckoutTimeout;
+ const waitQueueMember = {
+ resolve,
+ reject,
+ cancelled: false,
+ checkoutTime
+ };
+ const abortListener = (0, utils_1.addAbortListener)(options.signal, function () {
+ waitQueueMember.cancelled = true;
+ reject(this.reason);
+ });
+ this.waitQueue.push(waitQueueMember);
+ queueMicrotask(() => this.processWaitQueue());
+ try {
+ timeout?.throwIfExpired();
+ return await (timeout ? Promise.race([promise, timeout]) : promise);
+ }
+ catch (error) {
+ if (timeout_1.TimeoutError.is(error)) {
+ timeout?.clear();
+ waitQueueMember.cancelled = true;
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECK_OUT_FAILED, new connection_pool_events_1.ConnectionCheckOutFailedEvent(this, 'timeout', waitQueueMember.checkoutTime));
+ const timeoutError = new errors_1.WaitQueueTimeoutError(this.loadBalanced
+ ? this.waitQueueErrorMetrics()
+ : 'Timed out while checking out a connection from connection pool', this.address);
+ if (options.timeoutContext.csotEnabled()) {
+ throw new error_1.MongoOperationTimeoutError('Timed out during connection checkout', {
+ cause: timeoutError
+ });
+ }
+ throw timeoutError;
+ }
+ throw error;
+ }
+ finally {
+ abortListener?.[utils_1.kDispose]();
+ timeout?.clear();
+ }
+ }
+ /**
+ * Check a connection into the pool.
+ *
+ * @param connection - The connection to check in
+ */
+ checkIn(connection) {
+ if (!this.checkedOut.has(connection)) {
+ return;
+ }
+ const poolClosed = this.closed;
+ const stale = this.connectionIsStale(connection);
+ const willDestroy = !!(poolClosed || stale || connection.closed);
+ if (!willDestroy) {
+ connection.markAvailable();
+ this.connections.unshift(connection);
+ }
+ this.checkedOut.delete(connection);
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECKED_IN, new connection_pool_events_1.ConnectionCheckedInEvent(this, connection));
+ if (willDestroy) {
+ const reason = connection.closed ? 'error' : poolClosed ? 'poolClosed' : 'stale';
+ this.destroyConnection(connection, reason);
+ }
+ queueMicrotask(() => this.processWaitQueue());
+ }
+ /**
+ * Clear the pool
+ *
+ * Pool reset is handled by incrementing the pool's generation count. Any existing connection of a
+ * previous generation will eventually be pruned during subsequent checkouts.
+ */
+ clear(options = {}) {
+ if (this.closed) {
+ return;
+ }
+ // handle load balanced case
+ if (this.loadBalanced) {
+ const { serviceId } = options;
+ if (!serviceId) {
+ throw new error_1.MongoRuntimeError('ConnectionPool.clear() called in load balanced mode with no serviceId.');
+ }
+ const sid = serviceId.toHexString();
+ const generation = this.serviceGenerations.get(sid);
+ // Only need to worry if the generation exists, since it should
+ // always be there but typescript needs the check.
+ if (generation == null) {
+ throw new error_1.MongoRuntimeError('Service generations are required in load balancer mode.');
+ }
+ else {
+ // Increment the generation for the service id.
+ this.serviceGenerations.set(sid, generation + 1);
+ }
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_CLEARED, new connection_pool_events_1.ConnectionPoolClearedEvent(this, { serviceId }));
+ return;
+ }
+ // handle non load-balanced case
+ const interruptInUseConnections = options.interruptInUseConnections ?? false;
+ const oldGeneration = this.generation;
+ this.generation += 1;
+ const alreadyPaused = this.poolState === exports.PoolState.paused;
+ this.poolState = exports.PoolState.paused;
+ this.clearMinPoolSizeTimer();
+ if (!alreadyPaused) {
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_CLEARED, new connection_pool_events_1.ConnectionPoolClearedEvent(this, {
+ interruptInUseConnections
+ }));
+ }
+ if (interruptInUseConnections) {
+ queueMicrotask(() => this.interruptInUseConnections(oldGeneration));
+ }
+ this.processWaitQueue();
+ }
+ /**
+ * Closes all stale in-use connections in the pool with a resumable PoolClearedOnNetworkError.
+ *
+ * Only connections where `connection.generation <= minGeneration` are killed.
+ */
+ interruptInUseConnections(minGeneration) {
+ for (const connection of this.checkedOut) {
+ if (connection.generation <= minGeneration) {
+ connection.onError(new errors_1.PoolClearedOnNetworkError(this));
+ }
+ }
+ }
+ /** For MongoClient.close() procedures */
+ closeCheckedOutConnections() {
+ for (const conn of this.checkedOut) {
+ conn.onError(new error_1.MongoClientClosedError());
+ }
+ }
+ /** Close the pool */
+ close() {
+ if (this.closed) {
+ return;
+ }
+ // immediately cancel any in-flight connections
+ this.cancellationToken.emit('cancel');
+ // end the connection counter
+ if (typeof this.connectionCounter.return === 'function') {
+ this.connectionCounter.return(undefined);
+ }
+ this.poolState = exports.PoolState.closed;
+ this.clearMinPoolSizeTimer();
+ this.processWaitQueue();
+ for (const conn of this.connections) {
+ this.emitAndLog(ConnectionPool.CONNECTION_CLOSED, new connection_pool_events_1.ConnectionClosedEvent(this, conn, 'poolClosed'));
+ conn.destroy();
+ }
+ this.connections.clear();
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_CLOSED, new connection_pool_events_1.ConnectionPoolClosedEvent(this));
+ }
+ /**
+ * @internal
+ * Reauthenticate a connection
+ */
+ async reauthenticate(connection) {
+ const authContext = connection.authContext;
+ if (!authContext) {
+ throw new error_1.MongoRuntimeError('No auth context found on connection.');
+ }
+ const credentials = authContext.credentials;
+ if (!credentials) {
+ throw new error_1.MongoMissingCredentialsError('Connection is missing credentials when asked to reauthenticate');
+ }
+ const resolvedCredentials = credentials.resolveAuthMechanism(connection.hello);
+ const provider = this.server.topology.client.s.authProviders.getOrCreateProvider(resolvedCredentials.mechanism, resolvedCredentials.mechanismProperties);
+ if (!provider) {
+ throw new error_1.MongoMissingCredentialsError(`Reauthenticate failed due to no auth provider for ${credentials.mechanism}`);
+ }
+ await provider.reauth(authContext);
+ return;
+ }
+ /** Clear the min pool size timer */
+ clearMinPoolSizeTimer() {
+ const minPoolSizeTimer = this.minPoolSizeTimer;
+ if (minPoolSizeTimer) {
+ (0, timers_1.clearTimeout)(minPoolSizeTimer);
+ }
+ }
+ destroyConnection(connection, reason) {
+ this.emitAndLog(ConnectionPool.CONNECTION_CLOSED, new connection_pool_events_1.ConnectionClosedEvent(this, connection, reason));
+ // destroy the connection
+ connection.destroy();
+ }
+ connectionIsStale(connection) {
+ const serviceId = connection.serviceId;
+ if (this.loadBalanced && serviceId) {
+ const sid = serviceId.toHexString();
+ const generation = this.serviceGenerations.get(sid);
+ return connection.generation !== generation;
+ }
+ return connection.generation !== this.generation;
+ }
+ connectionIsIdle(connection) {
+ return !!(this.options.maxIdleTimeMS && connection.idleTime > this.options.maxIdleTimeMS);
+ }
+ /**
+ * Destroys a connection if the connection is perished.
+ *
+ * @returns `true` if the connection was destroyed, `false` otherwise.
+ */
+ destroyConnectionIfPerished(connection) {
+ const isStale = this.connectionIsStale(connection);
+ const isIdle = this.connectionIsIdle(connection);
+ if (!isStale && !isIdle && !connection.closed) {
+ return false;
+ }
+ const reason = connection.closed ? 'error' : isStale ? 'stale' : 'idle';
+ this.destroyConnection(connection, reason);
+ return true;
+ }
+ createConnection(callback) {
+ // Note that metadata may have changed on the client but have
+ // been frozen here, so we pull the metadata promise always from the client
+ // no matter what options were set at the construction of the pool.
+ const connectOptions = {
+ ...this.options,
+ id: this.connectionCounter.next().value,
+ generation: this.generation,
+ cancellationToken: this.cancellationToken,
+ mongoLogger: this.mongoLogger,
+ authProviders: this.server.topology.client.s.authProviders,
+ metadata: this.server.topology.client.options.metadata
+ };
+ this.pending++;
+ // This is our version of a "virtual" no-I/O connection as the spec requires
+ const connectionCreatedTime = (0, utils_1.processTimeMS)();
+ this.emitAndLog(ConnectionPool.CONNECTION_CREATED, new connection_pool_events_1.ConnectionCreatedEvent(this, { id: connectOptions.id }));
+ (0, connect_1.connect)(connectOptions).then(connection => {
+ // The pool might have closed since we started trying to create a connection
+ if (this.poolState !== exports.PoolState.ready) {
+ this.pending--;
+ connection.destroy();
+ callback(this.closed ? new errors_1.PoolClosedError(this) : new errors_1.PoolClearedError(this));
+ return;
+ }
+ // forward all events from the connection to the pool
+ for (const event of [...constants_1.APM_EVENTS, connection_1.Connection.CLUSTER_TIME_RECEIVED]) {
+ connection.on(event, (e) => this.emit(event, e));
+ }
+ if (this.loadBalanced) {
+ connection.on(connection_1.Connection.PINNED, pinType => this.metrics.markPinned(pinType));
+ connection.on(connection_1.Connection.UNPINNED, pinType => this.metrics.markUnpinned(pinType));
+ const serviceId = connection.serviceId;
+ if (serviceId) {
+ let generation;
+ const sid = serviceId.toHexString();
+ if ((generation = this.serviceGenerations.get(sid))) {
+ connection.generation = generation;
+ }
+ else {
+ this.serviceGenerations.set(sid, 0);
+ connection.generation = 0;
+ }
+ }
+ }
+ connection.markAvailable();
+ this.emitAndLog(ConnectionPool.CONNECTION_READY, new connection_pool_events_1.ConnectionReadyEvent(this, connection, connectionCreatedTime));
+ this.pending--;
+ callback(undefined, connection);
+ }, error => {
+ this.pending--;
+ this.server.handleError(error);
+ this.emitAndLog(ConnectionPool.CONNECTION_CLOSED, new connection_pool_events_1.ConnectionClosedEvent(this, { id: connectOptions.id, serviceId: undefined }, 'error',
+ // TODO(NODE-5192): Remove this cast
+ error));
+ if (error instanceof error_1.MongoNetworkError || error instanceof error_1.MongoServerError) {
+ error.connectionGeneration = connectOptions.generation;
+ }
+ callback(error ?? new error_1.MongoRuntimeError('Connection creation failed without error'));
+ });
+ }
+ ensureMinPoolSize() {
+ const minPoolSize = this.options.minPoolSize;
+ if (this.poolState !== exports.PoolState.ready) {
+ return;
+ }
+ this.connections.prune(connection => this.destroyConnectionIfPerished(connection));
+ if (this.totalConnectionCount < minPoolSize &&
+ this.pendingConnectionCount < this.options.maxConnecting) {
+ // NOTE: ensureMinPoolSize should not try to get all the pending
+ // connection permits because that potentially delays the availability of
+ // the connection to a checkout request
+ this.createConnection((err, connection) => {
+ if (!err && connection) {
+ this.connections.push(connection);
+ queueMicrotask(() => this.processWaitQueue());
+ }
+ if (this.poolState === exports.PoolState.ready) {
+ (0, timers_1.clearTimeout)(this.minPoolSizeTimer);
+ this.minPoolSizeTimer = (0, timers_1.setTimeout)(() => this.ensureMinPoolSize(), this.options.minPoolSizeCheckFrequencyMS);
+ }
+ });
+ }
+ else {
+ (0, timers_1.clearTimeout)(this.minPoolSizeTimer);
+ this.minPoolSizeTimer = (0, timers_1.setTimeout)(() => this.ensureMinPoolSize(), this.options.minPoolSizeCheckFrequencyMS);
+ }
+ }
+ processWaitQueue() {
+ if (this.processingWaitQueue) {
+ return;
+ }
+ this.processingWaitQueue = true;
+ while (this.waitQueueSize) {
+ const waitQueueMember = this.waitQueue.first();
+ if (!waitQueueMember) {
+ this.waitQueue.shift();
+ continue;
+ }
+ if (waitQueueMember.cancelled) {
+ this.waitQueue.shift();
+ continue;
+ }
+ if (this.poolState !== exports.PoolState.ready) {
+ const reason = this.closed ? 'poolClosed' : 'connectionError';
+ const error = this.closed ? new errors_1.PoolClosedError(this) : new errors_1.PoolClearedError(this);
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECK_OUT_FAILED, new connection_pool_events_1.ConnectionCheckOutFailedEvent(this, reason, waitQueueMember.checkoutTime, error));
+ this.waitQueue.shift();
+ waitQueueMember.reject(error);
+ continue;
+ }
+ if (!this.availableConnectionCount) {
+ break;
+ }
+ const connection = this.connections.shift();
+ if (!connection) {
+ break;
+ }
+ if (!this.destroyConnectionIfPerished(connection)) {
+ this.checkedOut.add(connection);
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECKED_OUT, new connection_pool_events_1.ConnectionCheckedOutEvent(this, connection, waitQueueMember.checkoutTime));
+ this.waitQueue.shift();
+ waitQueueMember.resolve(connection);
+ }
+ }
+ const { maxPoolSize, maxConnecting } = this.options;
+ while (this.waitQueueSize > 0 &&
+ this.pendingConnectionCount < maxConnecting &&
+ (maxPoolSize === 0 || this.totalConnectionCount < maxPoolSize)) {
+ const waitQueueMember = this.waitQueue.shift();
+ if (!waitQueueMember || waitQueueMember.cancelled) {
+ continue;
+ }
+ this.createConnection((err, connection) => {
+ if (waitQueueMember.cancelled) {
+ if (!err && connection) {
+ this.connections.push(connection);
+ }
+ }
+ else {
+ if (err) {
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECK_OUT_FAILED,
+ // TODO(NODE-5192): Remove this cast
+ new connection_pool_events_1.ConnectionCheckOutFailedEvent(this, 'connectionError', waitQueueMember.checkoutTime, err));
+ waitQueueMember.reject(err);
+ }
+ else if (connection) {
+ this.checkedOut.add(connection);
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECKED_OUT, new connection_pool_events_1.ConnectionCheckedOutEvent(this, connection, waitQueueMember.checkoutTime));
+ waitQueueMember.resolve(connection);
+ }
+ }
+ queueMicrotask(() => this.processWaitQueue());
+ });
+ }
+ this.processingWaitQueue = false;
+ }
+}
+exports.ConnectionPool = ConnectionPool;
+//# sourceMappingURL=connection_pool.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/connection_pool.js.map b/node_modules/mongodb/lib/cmap/connection_pool.js.map
new file mode 100644
index 00000000..0aba478d
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/connection_pool.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"connection_pool.js","sourceRoot":"","sources":["../../src/cmap/connection_pool.ts"],"names":[],"mappings":";;;AAAA,mCAAkD;AAGlD,4CAasB;AACtB,oCAUkB;AAClB,gDAAsF;AAEtF,wCAA+D;AAC/D,oCASkB;AAClB,uCAAoC;AACpC,6CAAyF;AACzF,qEAYkC;AAClC,qCAKkB;AAClB,uCAAkD;AA4BlD,gBAAgB;AACH,QAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACR,CAAC,CAAC;AAmBZ;;;GAGG;AACH,MAAa,cAAe,SAAQ,+BAAuC;IAmBzE;;;OAGG;aACa,4BAAuB,GAAG,mCAAuB,CAAC;IAClE;;;OAGG;aACa,2BAAsB,GAAG,kCAAsB,CAAC;IAChE;;;OAGG;aACa,4BAAuB,GAAG,mCAAuB,CAAC;IAClE;;;OAGG;aACa,0BAAqB,GAAG,iCAAqB,CAAC;IAC9D;;;OAGG;aACa,uBAAkB,GAAG,8BAAkB,CAAC;IACxD;;;OAGG;aACa,qBAAgB,GAAG,4BAAgB,CAAC;IACpD;;;OAGG;aACa,sBAAiB,GAAG,6BAAiB,CAAC;IACtD;;;OAGG;aACa,iCAA4B,GAAG,wCAA4B,CAAC;IAC5E;;;OAGG;aACa,gCAA2B,GAAG,uCAA2B,CAAC;IAC1E;;;OAGG;aACa,2BAAsB,GAAG,kCAAsB,CAAC;IAChE;;;OAGG;aACa,0BAAqB,GAAG,iCAAqB,CAAC;IAE9D,YAAY,MAAc,EAAE,OAA8B;QACxD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,YAAI,CAAC,CAAC;QAEvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;YAC3B,cAAc,EAA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js b/node_modules/mongodb/lib/cmap/connection_pool_events.js
new file mode 100644
index 00000000..d978d0e3
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/connection_pool_events.js
@@ -0,0 +1,190 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ConnectionPoolClearedEvent = exports.ConnectionCheckedInEvent = exports.ConnectionCheckedOutEvent = exports.ConnectionCheckOutFailedEvent = exports.ConnectionCheckOutStartedEvent = exports.ConnectionClosedEvent = exports.ConnectionReadyEvent = exports.ConnectionCreatedEvent = exports.ConnectionPoolClosedEvent = exports.ConnectionPoolReadyEvent = exports.ConnectionPoolCreatedEvent = exports.ConnectionPoolMonitoringEvent = void 0;
+const constants_1 = require("../constants");
+const utils_1 = require("../utils");
+/**
+ * The base export class for all monitoring events published from the connection pool
+ * @public
+ * @category Event
+ */
+class ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool) {
+ this.time = new Date();
+ this.address = pool.address;
+ }
+}
+exports.ConnectionPoolMonitoringEvent = ConnectionPoolMonitoringEvent;
+/**
+ * An event published when a connection pool is created
+ * @public
+ * @category Event
+ */
+class ConnectionPoolCreatedEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_POOL_CREATED;
+ const { maxConnecting, maxPoolSize, minPoolSize, maxIdleTimeMS, waitQueueTimeoutMS } = pool.options;
+ this.options = { maxConnecting, maxPoolSize, minPoolSize, maxIdleTimeMS, waitQueueTimeoutMS };
+ }
+}
+exports.ConnectionPoolCreatedEvent = ConnectionPoolCreatedEvent;
+/**
+ * An event published when a connection pool is ready
+ * @public
+ * @category Event
+ */
+class ConnectionPoolReadyEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_POOL_READY;
+ }
+}
+exports.ConnectionPoolReadyEvent = ConnectionPoolReadyEvent;
+/**
+ * An event published when a connection pool is closed
+ * @public
+ * @category Event
+ */
+class ConnectionPoolClosedEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_POOL_CLOSED;
+ }
+}
+exports.ConnectionPoolClosedEvent = ConnectionPoolClosedEvent;
+/**
+ * An event published when a connection pool creates a new connection
+ * @public
+ * @category Event
+ */
+class ConnectionCreatedEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool, connection) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_CREATED;
+ this.connectionId = connection.id;
+ }
+}
+exports.ConnectionCreatedEvent = ConnectionCreatedEvent;
+/**
+ * An event published when a connection is ready for use
+ * @public
+ * @category Event
+ */
+class ConnectionReadyEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool, connection, connectionCreatedEventTime) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_READY;
+ this.durationMS = (0, utils_1.processTimeMS)() - connectionCreatedEventTime;
+ this.connectionId = connection.id;
+ }
+}
+exports.ConnectionReadyEvent = ConnectionReadyEvent;
+/**
+ * An event published when a connection is closed
+ * @public
+ * @category Event
+ */
+class ConnectionClosedEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool, connection, reason, error) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_CLOSED;
+ this.connectionId = connection.id;
+ this.reason = reason;
+ this.serviceId = connection.serviceId;
+ this.error = error ?? null;
+ }
+}
+exports.ConnectionClosedEvent = ConnectionClosedEvent;
+/**
+ * An event published when a request to check a connection out begins
+ * @public
+ * @category Event
+ */
+class ConnectionCheckOutStartedEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_CHECK_OUT_STARTED;
+ }
+}
+exports.ConnectionCheckOutStartedEvent = ConnectionCheckOutStartedEvent;
+/**
+ * An event published when a request to check a connection out fails
+ * @public
+ * @category Event
+ */
+class ConnectionCheckOutFailedEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool, reason, checkoutTime, error) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_CHECK_OUT_FAILED;
+ this.durationMS = (0, utils_1.processTimeMS)() - checkoutTime;
+ this.reason = reason;
+ this.error = error;
+ }
+}
+exports.ConnectionCheckOutFailedEvent = ConnectionCheckOutFailedEvent;
+/**
+ * An event published when a connection is checked out of the connection pool
+ * @public
+ * @category Event
+ */
+class ConnectionCheckedOutEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool, connection, checkoutTime) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_CHECKED_OUT;
+ this.durationMS = (0, utils_1.processTimeMS)() - checkoutTime;
+ this.connectionId = connection.id;
+ }
+}
+exports.ConnectionCheckedOutEvent = ConnectionCheckedOutEvent;
+/**
+ * An event published when a connection is checked into the connection pool
+ * @public
+ * @category Event
+ */
+class ConnectionCheckedInEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool, connection) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_CHECKED_IN;
+ this.connectionId = connection.id;
+ }
+}
+exports.ConnectionCheckedInEvent = ConnectionCheckedInEvent;
+/**
+ * An event published when a connection pool is cleared
+ * @public
+ * @category Event
+ */
+class ConnectionPoolClearedEvent extends ConnectionPoolMonitoringEvent {
+ /** @internal */
+ constructor(pool, options = {}) {
+ super(pool);
+ /** @internal */
+ this.name = constants_1.CONNECTION_POOL_CLEARED;
+ this.serviceId = options.serviceId;
+ this.interruptInUseConnections = options.interruptInUseConnections;
+ }
+}
+exports.ConnectionPoolClearedEvent = ConnectionPoolClearedEvent;
+//# sourceMappingURL=connection_pool_events.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/connection_pool_events.js.map b/node_modules/mongodb/lib/cmap/connection_pool_events.js.map
new file mode 100644
index 00000000..0bb0d6c0
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/connection_pool_events.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"connection_pool_events.js","sourceRoot":"","sources":["../../src/cmap/connection_pool_events.ts"],"names":[],"mappings":";;;AACA,4CAYsB;AAEtB,oCAAyC;AAIzC;;;;GAIG;AACH,MAAsB,6BAA6B;IAmBjD,gBAAgB;IAChB,YAAY,IAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;CACF;AAxBD,sEAwBC;AAED;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,6BAA6B;IAS3E,gBAAgB;IAChB,YAAY,IAAoB;QAC9B,KAAK,CAAC,IAAI,CAAC,CAAC;QALd,gBAAgB;QAChB,SAAI,GAAG,mCAAuB,CAAC;QAK7B,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAClF,IAAI,CAAC,OAAO,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;IAChG,CAAC;CACF;AAhBD,gEAgBC;AAED;;;;GAIG;AACH,MAAa,wBAAyB,SAAQ,6BAA6B;IAIzE,gBAAgB;IAChB,YAAY,IAAoB;QAC9B,KAAK,CAAC,IAAI,CAAC,CAAC;QALd,gBAAgB;QAChB,SAAI,GAAG,iCAAqB,CAAC;IAK7B,CAAC;CACF;AARD,4DAQC;AAED;;;;GAIG;AACH,MAAa,yBAA0B,SAAQ,6BAA6B;IAI1E,gBAAgB;IAChB,YAAY,IAAoB;QAC9B,KAAK,CAAC,IAAI,CAAC,CAAC;QALd,gBAAgB;QAChB,SAAI,GAAG,kCAAsB,CAAC;IAK9B,CAAC;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B,CAAC;QAQ7B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IACrE,CAAC;CACF;AAjBD,gEAiBC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/errors.js b/node_modules/mongodb/lib/cmap/errors.js
new file mode 100644
index 00000000..59d2ef0f
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/errors.js
@@ -0,0 +1,108 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.WaitQueueTimeoutError = exports.PoolClearedOnNetworkError = exports.PoolClearedError = exports.PoolClosedError = void 0;
+const error_1 = require("../error");
+/**
+ * An error indicating a connection pool is closed
+ * @category Error
+ */
+class PoolClosedError extends error_1.MongoDriverError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(pool) {
+ super('Attempted to check out a connection from closed connection pool');
+ this.address = pool.address;
+ }
+ get name() {
+ return 'MongoPoolClosedError';
+ }
+}
+exports.PoolClosedError = PoolClosedError;
+/**
+ * An error indicating a connection pool is currently paused
+ * @category Error
+ */
+class PoolClearedError extends error_1.MongoNetworkError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(pool, message) {
+ const errorMessage = message
+ ? message
+ : `Connection pool for ${pool.address} was cleared because another operation failed with: "${pool.serverError?.message}"`;
+ super(errorMessage, pool.serverError ? { cause: pool.serverError } : undefined);
+ this.address = pool.address;
+ this.addErrorLabel(error_1.MongoErrorLabel.PoolRequestedRetry);
+ }
+ get name() {
+ return 'MongoPoolClearedError';
+ }
+}
+exports.PoolClearedError = PoolClearedError;
+/**
+ * An error indicating that a connection pool has been cleared after the monitor for that server timed out.
+ * @category Error
+ */
+class PoolClearedOnNetworkError extends PoolClearedError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(pool) {
+ super(pool, `Connection to ${pool.address} interrupted due to server monitor timeout`);
+ }
+ get name() {
+ return 'PoolClearedOnNetworkError';
+ }
+}
+exports.PoolClearedOnNetworkError = PoolClearedOnNetworkError;
+/**
+ * An error thrown when a request to check out a connection times out
+ * @category Error
+ */
+class WaitQueueTimeoutError extends error_1.MongoDriverError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, address) {
+ super(message);
+ this.address = address;
+ }
+ get name() {
+ return 'MongoWaitQueueTimeoutError';
+ }
+}
+exports.WaitQueueTimeoutError = WaitQueueTimeoutError;
+//# sourceMappingURL=errors.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/errors.js.map b/node_modules/mongodb/lib/cmap/errors.js.map
new file mode 100644
index 00000000..e3f0645e
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/errors.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/cmap/errors.ts"],"names":[],"mappings":";;;AAAA,oCAAgF;AAGhF;;;GAGG;AACH,MAAa,eAAgB,SAAQ,wBAAgB;IAInD;;;;;;;;;;QAUI;IACJ,YAAY,IAAoB;QAC9B,KAAK,CAAC,iEAAiE,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,IAAa,IAAI;QACf,OAAO,s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node_modules/mongodb/lib/cmap/handshake/client_metadata.js
new file mode 100644
index 00000000..36a212e5
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/handshake/client_metadata.js
@@ -0,0 +1,241 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.LimitedSizeDocument = void 0;
+exports.isDriverInfoEqual = isDriverInfoEqual;
+exports.makeClientMetadata = makeClientMetadata;
+exports.getFAASEnv = getFAASEnv;
+const process = require("process");
+const bson_1 = require("../../bson");
+const error_1 = require("../../error");
+const utils_1 = require("../../utils");
+// eslint-disable-next-line @typescript-eslint/no-require-imports
+const NODE_DRIVER_VERSION = require('../../../package.json').version;
+/** @internal */
+function isDriverInfoEqual(info1, info2) {
+ /** for equality comparison, we consider "" as unset */
+ const nonEmptyCmp = (s1, s2) => {
+ s1 ||= undefined;
+ s2 ||= undefined;
+ return s1 === s2;
+ };
+ return (nonEmptyCmp(info1.name, info2.name) &&
+ nonEmptyCmp(info1.platform, info2.platform) &&
+ nonEmptyCmp(info1.version, info2.version));
+}
+/** @internal */
+class LimitedSizeDocument {
+ constructor(maxSize) {
+ this.document = new Map();
+ /** BSON overhead: Int32 + Null byte */
+ this.documentSize = 5;
+ this.maxSize = maxSize;
+ }
+ /** Only adds key/value if the bsonByteLength is less than MAX_SIZE */
+ ifItFitsItSits(key, value) {
+ // The BSON byteLength of the new element is the same as serializing it to its own document
+ // subtracting the document size int32 and the null terminator.
+ const newElementSize = bson_1.BSON.serialize(new Map().set(key, value)).byteLength - 5;
+ if (newElementSize + this.documentSize > this.maxSize) {
+ return false;
+ }
+ this.documentSize += newElementSize;
+ this.document.set(key, value);
+ return true;
+ }
+ toObject() {
+ return bson_1.BSON.deserialize(bson_1.BSON.serialize(this.document), {
+ promoteLongs: false,
+ promoteBuffers: false,
+ promoteValues: false,
+ useBigInt64: false
+ });
+ }
+}
+exports.LimitedSizeDocument = LimitedSizeDocument;
+/**
+ * From the specs:
+ * Implementors SHOULD cumulatively update fields in the following order until the document is under the size limit:
+ * 1. Omit fields from `env` except `env.name`.
+ * 2. Omit fields from `os` except `os.type`.
+ * 3. Omit the `env` document entirely.
+ * 4. Truncate `platform`. -- special we do not truncate this field
+ */
+async function makeClientMetadata(driverInfoList, { appName = '', runtime: { os } }) {
+ const metadataDocument = new LimitedSizeDocument(512);
+ // Add app name first, it must be sent
+ if (appName.length > 0) {
+ const name = bson_1.ByteUtils.utf8ByteLength(appName) <= 128
+ ? appName
+ : bson_1.ByteUtils.toUTF8(bson_1.ByteUtils.fromUTF8(appName), 0, 128, false);
+ metadataDocument.ifItFitsItSits('application', { name });
+ }
+ const driverInfo = {
+ name: 'nodejs',
+ version: NODE_DRIVER_VERSION
+ };
+ // This is where we handle additional driver info added after client construction.
+ for (const { name: n = '', version: v = '' } of driverInfoList) {
+ if (n.length > 0) {
+ driverInfo.name = `${driverInfo.name}|${n}`;
+ }
+ if (v.length > 0) {
+ driverInfo.version = `${driverInfo.version}|${v}`;
+ }
+ }
+ if (!metadataDocument.ifItFitsItSits('driver', driverInfo)) {
+ throw new error_1.MongoInvalidArgumentError('Unable to include driverInfo name and version, metadata cannot exceed 512 bytes');
+ }
+ let runtimeInfo = getRuntimeInfo();
+ // This is where we handle additional driver info added after client construction.
+ for (const { platform = '' } of driverInfoList) {
+ if (platform.length > 0) {
+ runtimeInfo = `${runtimeInfo}|${platform}`;
+ }
+ }
+ if (!metadataDocument.ifItFitsItSits('platform', runtimeInfo)) {
+ throw new error_1.MongoInvalidArgumentError('Unable to include driverInfo platform, metadata cannot exceed 512 bytes');
+ }
+ // Note: order matters, os.type is last so it will be removed last if we're at maxSize
+ const osInfo = new Map()
+ .set('name', os.platform())
+ .set('architecture', os.arch())
+ .set('version', os.release())
+ .set('type', os.type());
+ if (!metadataDocument.ifItFitsItSits('os', osInfo)) {
+ for (const key of osInfo.keys()) {
+ osInfo.delete(key);
+ if (osInfo.size === 0)
+ break;
+ if (metadataDocument.ifItFitsItSits('os', osInfo))
+ break;
+ }
+ }
+ const faasEnv = getFAASEnv();
+ if (faasEnv != null) {
+ if (!metadataDocument.ifItFitsItSits('env', faasEnv)) {
+ for (const key of faasEnv.keys()) {
+ faasEnv.delete(key);
+ if (faasEnv.size === 0)
+ break;
+ if (metadataDocument.ifItFitsItSits('env', faasEnv))
+ break;
+ }
+ }
+ }
+ return await addContainerMetadata(metadataDocument.toObject());
+}
+let dockerPromise;
+/** @internal */
+async function getContainerMetadata() {
+ dockerPromise ??= (0, utils_1.fileIsAccessible)('/.dockerenv');
+ const isDocker = await dockerPromise;
+ const { KUBERNETES_SERVICE_HOST = '' } = process.env;
+ const isKubernetes = KUBERNETES_SERVICE_HOST.length > 0 ? true : false;
+ const containerMetadata = {};
+ if (isDocker)
+ containerMetadata.runtime = 'docker';
+ if (isKubernetes)
+ containerMetadata.orchestrator = 'kubernetes';
+ return containerMetadata;
+}
+/**
+ * @internal
+ * Re-add each metadata value.
+ * Attempt to add new env container metadata, but keep old data if it does not fit.
+ */
+async function addContainerMetadata(originalMetadata) {
+ const containerMetadata = await getContainerMetadata();
+ if (Object.keys(containerMetadata).length === 0)
+ return originalMetadata;
+ const extendedMetadata = new LimitedSizeDocument(512);
+ const extendedEnvMetadata = {
+ ...originalMetadata?.env,
+ container: containerMetadata
+ };
+ for (const [key, val] of Object.entries(originalMetadata)) {
+ if (key !== 'env') {
+ extendedMetadata.ifItFitsItSits(key, val);
+ }
+ else {
+ if (!extendedMetadata.ifItFitsItSits('env', extendedEnvMetadata)) {
+ // add in old data if newer / extended metadata does not fit
+ extendedMetadata.ifItFitsItSits('env', val);
+ }
+ }
+ }
+ if (!('env' in originalMetadata)) {
+ extendedMetadata.ifItFitsItSits('env', extendedEnvMetadata);
+ }
+ return extendedMetadata.toObject();
+}
+/**
+ * Collects FaaS metadata.
+ * - `name` MUST be the last key in the Map returned.
+ */
+function getFAASEnv() {
+ const { AWS_EXECUTION_ENV = '', AWS_LAMBDA_RUNTIME_API = '', FUNCTIONS_WORKER_RUNTIME = '', K_SERVICE = '', FUNCTION_NAME = '', VERCEL = '', AWS_LAMBDA_FUNCTION_MEMORY_SIZE = '', AWS_REGION = '', FUNCTION_MEMORY_MB = '', FUNCTION_REGION = '', FUNCTION_TIMEOUT_SEC = '', VERCEL_REGION = '' } = process.env;
+ const isAWSFaaS = AWS_EXECUTION_ENV.startsWith('AWS_Lambda_') || AWS_LAMBDA_RUNTIME_API.length > 0;
+ const isAzureFaaS = FUNCTIONS_WORKER_RUNTIME.length > 0;
+ const isGCPFaaS = K_SERVICE.length > 0 || FUNCTION_NAME.length > 0;
+ const isVercelFaaS = VERCEL.length > 0;
+ // Note: order matters, name must always be the last key
+ const faasEnv = new Map();
+ // When isVercelFaaS is true so is isAWSFaaS; Vercel inherits the AWS env
+ if (isVercelFaaS && !(isAzureFaaS || isGCPFaaS)) {
+ if (VERCEL_REGION.length > 0) {
+ faasEnv.set('region', VERCEL_REGION);
+ }
+ faasEnv.set('name', 'vercel');
+ return faasEnv;
+ }
+ if (isAWSFaaS && !(isAzureFaaS || isGCPFaaS || isVercelFaaS)) {
+ if (AWS_REGION.length > 0) {
+ faasEnv.set('region', AWS_REGION);
+ }
+ if (AWS_LAMBDA_FUNCTION_MEMORY_SIZE.length > 0 &&
+ Number.isInteger(+AWS_LAMBDA_FUNCTION_MEMORY_SIZE)) {
+ faasEnv.set('memory_mb', new bson_1.Int32(AWS_LAMBDA_FUNCTION_MEMORY_SIZE));
+ }
+ faasEnv.set('name', 'aws.lambda');
+ return faasEnv;
+ }
+ if (isAzureFaaS && !(isGCPFaaS || isAWSFaaS || isVercelFaaS)) {
+ faasEnv.set('name', 'azure.func');
+ return faasEnv;
+ }
+ if (isGCPFaaS && !(isAzureFaaS || isAWSFaaS || isVercelFaaS)) {
+ if (FUNCTION_REGION.length > 0) {
+ faasEnv.set('region', FUNCTION_REGION);
+ }
+ if (FUNCTION_MEMORY_MB.length > 0 && Number.isInteger(+FUNCTION_MEMORY_MB)) {
+ faasEnv.set('memory_mb', new bson_1.Int32(FUNCTION_MEMORY_MB));
+ }
+ if (FUNCTION_TIMEOUT_SEC.length > 0 && Number.isInteger(+FUNCTION_TIMEOUT_SEC)) {
+ faasEnv.set('timeout_sec', new bson_1.Int32(FUNCTION_TIMEOUT_SEC));
+ }
+ faasEnv.set('name', 'gcp.func');
+ return faasEnv;
+ }
+ return null;
+}
+/**
+ * @internal
+ * Get current JavaScript runtime platform
+ *
+ * NOTE: The version information fetching is intentionally written defensively
+ * to avoid having a released driver version that becomes incompatible
+ * with a future change to these global objects.
+ */
+function getRuntimeInfo() {
+ const endianness = bson_1.NumberUtils.isBigEndian ? 'BE' : 'LE';
+ if ('Deno' in globalThis) {
+ const version = typeof Deno?.version?.deno === 'string' ? Deno?.version?.deno : '0.0.0-unknown';
+ return `Deno v${version}, ${endianness}`;
+ }
+ if ('Bun' in globalThis) {
+ const version = typeof Bun?.version === 'string' ? Bun?.version : '0.0.0-unknown';
+ return `Bun v${version}, ${endianness}`;
+ }
+ return `Node.js ${process.version}, ${endianness}`;
+}
+//# sourceMappingURL=client_metadata.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/handshake/client_metadata.js.map b/node_modules/mongodb/lib/cmap/handshake/client_metadata.js.map
new file mode 100644
index 00000000..580058e4
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/handshake/client_metadata.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"client_metadata.js","sourceRoot":"","sources":["../../../src/cmap/handshake/client_metadata.ts"],"names":[],"mappings":";;;AAWA,8CAcC;AAkFD,gDA4EC;AA0DD,gCA0EC;AA3TD,mCAAmC;AAEnC,qCAAgF;AAChF,uCAAwD;AAExD,uCAA+C;AAE/C,iEAAiE;AACjE,MAAM,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAErE,gBAAgB;AAChB,SAAgB,iBAAiB,CAAC,KAAiB,EAAE,KAAiB;IACpE,uDAAuD;IACvD,MAAM,WAAW,GAAG,CAAC,EAAsB,EAA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AO,KAAK,UAAU,EAAE,CAAC;IAC3C,CAAC;IAED,IAAI,KAAK,IAAI,UAAU,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,OAAO,GAAG,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QAElF,OAAO,QAAQ,OAAO,KAAK,UAAU,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO,WAAW,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;AACrD,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/metrics.js b/node_modules/mongodb/lib/cmap/metrics.js
new file mode 100644
index 00000000..58d2b2fe
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/metrics.js
@@ -0,0 +1,62 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ConnectionPoolMetrics = void 0;
+/** @internal */
+class ConnectionPoolMetrics {
+ constructor() {
+ this.txnConnections = 0;
+ this.cursorConnections = 0;
+ this.otherConnections = 0;
+ }
+ static { this.TXN = 'txn'; }
+ static { this.CURSOR = 'cursor'; }
+ static { this.OTHER = 'other'; }
+ /**
+ * Mark a connection as pinned for a specific operation.
+ */
+ markPinned(pinType) {
+ if (pinType === ConnectionPoolMetrics.TXN) {
+ this.txnConnections += 1;
+ }
+ else if (pinType === ConnectionPoolMetrics.CURSOR) {
+ this.cursorConnections += 1;
+ }
+ else {
+ this.otherConnections += 1;
+ }
+ }
+ /**
+ * Unmark a connection as pinned for an operation.
+ */
+ markUnpinned(pinType) {
+ if (pinType === ConnectionPoolMetrics.TXN) {
+ this.txnConnections -= 1;
+ }
+ else if (pinType === ConnectionPoolMetrics.CURSOR) {
+ this.cursorConnections -= 1;
+ }
+ else {
+ this.otherConnections -= 1;
+ }
+ }
+ /**
+ * Return information about the cmap metrics as a string.
+ */
+ info(maxPoolSize) {
+ return ('Timed out while checking out a connection from connection pool: ' +
+ `maxPoolSize: ${maxPoolSize}, ` +
+ `connections in use by cursors: ${this.cursorConnections}, ` +
+ `connections in use by transactions: ${this.txnConnections}, ` +
+ `connections in use by other operations: ${this.otherConnections}`);
+ }
+ /**
+ * Reset the metrics to the initial values.
+ */
+ reset() {
+ this.txnConnections = 0;
+ this.cursorConnections = 0;
+ this.otherConnections = 0;
+ }
+}
+exports.ConnectionPoolMetrics = ConnectionPoolMetrics;
+//# sourceMappingURL=metrics.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/metrics.js.map b/node_modules/mongodb/lib/cmap/metrics.js.map
new file mode 100644
index 00000000..9dfe3a98
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/metrics.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/cmap/metrics.ts"],"names":[],"mappings":";;;AAAA,gBAAgB;AAChB,MAAa,qBAAqB;IAAlC;QAKE,mBAAc,GAAG,CAAC,CAAC;QACnB,sBAAiB,GAAG,CAAC,CAAC;QACtB,qBAAgB,GAAG,CAAC,CAAC;IAiDvB,CAAC;aAvDiB,QAAG,GAAG,KAAc,AAAjB,CAAkB;aACrB,WAAM,GAAG,QAAiB,AAApB,CAAqB;aAC3B,UAAK,GAAG,OAAgB,AAAnB,CAAoB;IAMzC;;OAEG;IACH,UAAU,CAAC,OAAe;QACxB,IAAI,OAAO,KAAK,qBAAqB,CAAC,GAAG,EAAE,CAAC;YAC1C,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC;QAC3B,CAAC;aAAM,IAAI,OAAO,KAAK,qBAAqB,CAAC,MAAM,EAAE,CAAC;YACpD,IAAI,CAAC,iBAAiB,IAAI,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,OAAe;QAC1B,IAAI,OAAO,KAAK,qBAAqB,CAAC,GAAG,EAAE,CAAC;YAC1C,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC;QAC3B,CAAC;aAAM,IAAI,OAAO,KAAK,qBAAqB,CAAC,MAAM,EAAE,CAAC;YACpD,IAAI,CAAC,iBAAiB,IAAI,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,WAAmB;QACtB,OAAO,CACL,kEAAkE;YAClE,gBAAgB,WAAW,IAAI;YAC/B,kCAAkC,IAAI,CAAC,iBAAiB,IAAI;YAC5D,uCAAuC,IAAI,CAAC,cAAc,IAAI;YAC9D,2CAA2C,IAAI,CAAC,gBAAgB,EAAE,CACnE,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;IAC5B,CAAC;;AAvDH,sDAwDC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/stream_description.js b/node_modules/mongodb/lib/cmap/stream_description.js
new file mode 100644
index 00000000..1665c6eb
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/stream_description.js
@@ -0,0 +1,70 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.StreamDescription = void 0;
+const bson_1 = require("../bson");
+const common_1 = require("../sdam/common");
+const server_description_1 = require("../sdam/server_description");
+const RESPONSE_FIELDS = [
+ 'minWireVersion',
+ 'maxWireVersion',
+ 'maxBsonObjectSize',
+ 'maxMessageSizeBytes',
+ 'maxWriteBatchSize',
+ 'logicalSessionTimeoutMinutes'
+];
+/** @public */
+class StreamDescription {
+ constructor(address, options) {
+ this.hello = null;
+ this.address = address;
+ this.type = common_1.ServerType.Unknown;
+ this.minWireVersion = undefined;
+ this.maxWireVersion = undefined;
+ this.maxBsonObjectSize = 16777216;
+ this.maxMessageSizeBytes = 48000000;
+ this.maxWriteBatchSize = 100000;
+ this.logicalSessionTimeoutMinutes = options?.logicalSessionTimeoutMinutes;
+ this.loadBalanced = !!options?.loadBalanced;
+ this.compressors =
+ options && options.compressors && Array.isArray(options.compressors)
+ ? options.compressors
+ : [];
+ this.serverConnectionId = null;
+ }
+ receiveResponse(response) {
+ if (response == null) {
+ return;
+ }
+ this.hello = response;
+ this.type = (0, server_description_1.parseServerType)(response);
+ if ('connectionId' in response) {
+ this.serverConnectionId = this.parseServerConnectionID(response.connectionId);
+ }
+ else {
+ this.serverConnectionId = null;
+ }
+ for (const field of RESPONSE_FIELDS) {
+ if (response[field] != null) {
+ this[field] = response[field];
+ }
+ // testing case
+ if ('__nodejs_mock_server__' in response) {
+ this.__nodejs_mock_server__ = response['__nodejs_mock_server__'];
+ }
+ }
+ if (response.compression) {
+ this.compressor = this.compressors.filter(c => response.compression?.includes(c))[0];
+ }
+ }
+ /* @internal */
+ parseServerConnectionID(serverConnectionId) {
+ // Connection ids are always integral, so it's safe to coerce doubles as well as
+ // any integral type.
+ return bson_1.Long.isLong(serverConnectionId)
+ ? serverConnectionId.toBigInt()
+ : // @ts-expect-error: Doubles are coercible to number
+ BigInt(serverConnectionId);
+ }
+}
+exports.StreamDescription = StreamDescription;
+//# sourceMappingURL=stream_description.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/stream_description.js.map b/node_modules/mongodb/lib/cmap/stream_description.js.map
new file mode 100644
index 00000000..09911db4
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/stream_description.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"stream_description.js","sourceRoot":"","sources":["../../src/cmap/stream_description.ts"],"names":[],"mappings":";;;AAAA,kCAA2D;AAC3D,2CAA4C;AAC5C,mEAA6D;AAG7D,MAAM,eAAe,GAAG;IACtB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,qBAAqB;IACrB,mBAAmB;I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MAAM,KAAK,IAAI,eAAe,EAAE,CAAC;YACpC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;gBAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;YAED,eAAe;YACf,IAAI,wBAAwB,IAAI,QAAQ,EAAE,CAAC;gBACzC,IAAI,CAAC,sBAAsB,GAAG,QAAQ,CAAC,wBAAwB,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;YACzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAED,eAAe;IACf,uBAAuB,CAAC,kBAAmD;QACzE,gFAAgF;QAChF,qBAAqB;QACrB,OAAO,WAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;YACpC,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;YAC/B,CAAC,CAAC,oDAAoD;gBACpD,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACjC,CAAC;CACF;AAzED,8CAyEC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/compression.js b/node_modules/mongodb/lib/cmap/wire_protocol/compression.js
new file mode 100644
index 00000000..a23ca509
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/compression.js
@@ -0,0 +1,179 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.uncompressibleCommands = exports.Compressor = void 0;
+exports.compress = compress;
+exports.decompress = decompress;
+exports.compressCommand = compressCommand;
+exports.decompressResponse = decompressResponse;
+const zlib = require("zlib");
+const bson_1 = require("../../bson");
+const constants_1 = require("../../constants");
+const deps_1 = require("../../deps");
+const error_1 = require("../../error");
+const commands_1 = require("../commands");
+const constants_2 = require("./constants");
+/** @public */
+exports.Compressor = Object.freeze({
+ none: 0,
+ snappy: 1,
+ zlib: 2,
+ zstd: 3
+});
+exports.uncompressibleCommands = new Set([
+ constants_1.LEGACY_HELLO_COMMAND,
+ 'saslStart',
+ 'saslContinue',
+ 'getnonce',
+ 'authenticate',
+ 'createUser',
+ 'updateUser',
+ 'copydbSaslStart',
+ 'copydbgetnonce',
+ 'copydb'
+]);
+const ZSTD_COMPRESSION_LEVEL = 3;
+const zlibInflate = (buf) => {
+ return new Promise((resolve, reject) => {
+ zlib.inflate(buf, (error, result) => {
+ if (error)
+ return reject(error);
+ resolve(result);
+ });
+ });
+};
+const zlibDeflate = (buf, options) => {
+ return new Promise((resolve, reject) => {
+ zlib.deflate(buf, options, (error, result) => {
+ if (error)
+ return reject(error);
+ resolve(result);
+ });
+ });
+};
+let zstd;
+let Snappy = null;
+function loadSnappy() {
+ if (Snappy == null) {
+ const snappyImport = (0, deps_1.getSnappy)();
+ if ('kModuleError' in snappyImport) {
+ throw snappyImport.kModuleError;
+ }
+ Snappy = snappyImport;
+ }
+ return Snappy;
+}
+// Facilitate compressing a message using an agreed compressor
+async function compress(options, dataToBeCompressed) {
+ const zlibOptions = {};
+ switch (options.agreedCompressor) {
+ case 'snappy': {
+ Snappy ??= loadSnappy();
+ return await Snappy.compress(dataToBeCompressed);
+ }
+ case 'zstd': {
+ loadZstd();
+ if ('kModuleError' in zstd) {
+ throw zstd['kModuleError'];
+ }
+ return await zstd.compress(dataToBeCompressed, ZSTD_COMPRESSION_LEVEL);
+ }
+ case 'zlib': {
+ if (options.zlibCompressionLevel) {
+ zlibOptions.level = options.zlibCompressionLevel;
+ }
+ return await zlibDeflate(dataToBeCompressed, zlibOptions);
+ }
+ default: {
+ throw new error_1.MongoInvalidArgumentError(`Unknown compressor ${options.agreedCompressor} failed to compress`);
+ }
+ }
+}
+// Decompress a message using the given compressor
+async function decompress(compressorID, compressedData) {
+ if (compressorID !== exports.Compressor.snappy &&
+ compressorID !== exports.Compressor.zstd &&
+ compressorID !== exports.Compressor.zlib &&
+ compressorID !== exports.Compressor.none) {
+ throw new error_1.MongoDecompressionError(`Server sent message compressed using an unsupported compressor. (Received compressor ID ${compressorID})`);
+ }
+ switch (compressorID) {
+ case exports.Compressor.snappy: {
+ Snappy ??= loadSnappy();
+ return await Snappy.uncompress(compressedData, { asBuffer: true });
+ }
+ case exports.Compressor.zstd: {
+ loadZstd();
+ if ('kModuleError' in zstd) {
+ throw zstd['kModuleError'];
+ }
+ return await zstd.decompress(compressedData);
+ }
+ case exports.Compressor.zlib: {
+ return await zlibInflate(compressedData);
+ }
+ default: {
+ return compressedData;
+ }
+ }
+}
+/**
+ * Load ZStandard if it is not already set.
+ */
+function loadZstd() {
+ if (!zstd) {
+ zstd = (0, deps_1.getZstdLibrary)();
+ }
+}
+const MESSAGE_HEADER_SIZE = 16;
+/**
+ * @internal
+ *
+ * Compresses an OP_MSG or OP_QUERY message, if compression is configured. This method
+ * also serializes the command to BSON.
+ */
+async function compressCommand(command, description) {
+ const finalCommand = description.agreedCompressor === 'none' || !commands_1.OpCompressedRequest.canCompress(command)
+ ? command
+ : new commands_1.OpCompressedRequest(command, {
+ agreedCompressor: description.agreedCompressor ?? 'none',
+ zlibCompressionLevel: description.zlibCompressionLevel ?? 0
+ });
+ const data = await finalCommand.toBin();
+ return bson_1.ByteUtils.concat(data);
+}
+/**
+ * @internal
+ *
+ * Decompresses an OP_MSG or OP_QUERY response from the server, if compression is configured.
+ *
+ * This method does not parse the response's BSON.
+ */
+async function decompressResponse(message) {
+ const messageHeader = {
+ length: (0, bson_1.readInt32LE)(message, 0),
+ requestId: (0, bson_1.readInt32LE)(message, 4),
+ responseTo: (0, bson_1.readInt32LE)(message, 8),
+ opCode: (0, bson_1.readInt32LE)(message, 12)
+ };
+ if (messageHeader.opCode !== constants_2.OP_COMPRESSED) {
+ const ResponseType = messageHeader.opCode === constants_2.OP_MSG ? commands_1.OpMsgResponse : commands_1.OpReply;
+ const messageBody = message.subarray(MESSAGE_HEADER_SIZE);
+ return new ResponseType(message, messageHeader, messageBody);
+ }
+ const header = {
+ ...messageHeader,
+ fromCompressed: true,
+ opCode: (0, bson_1.readInt32LE)(message, MESSAGE_HEADER_SIZE),
+ length: (0, bson_1.readInt32LE)(message, MESSAGE_HEADER_SIZE + 4)
+ };
+ const compressorID = message[MESSAGE_HEADER_SIZE + 8];
+ const compressedBuffer = message.slice(MESSAGE_HEADER_SIZE + 9);
+ // recalculate based on wrapped opcode
+ const ResponseType = header.opCode === constants_2.OP_MSG ? commands_1.OpMsgResponse : commands_1.OpReply;
+ const messageBody = await decompress(compressorID, compressedBuffer);
+ if (messageBody.length !== header.length) {
+ throw new error_1.MongoDecompressionError('Message body and message header must be the same length');
+ }
+ return new ResponseType(message, header, messageBody);
+}
+//# sourceMappingURL=compression.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/compression.js.map b/node_modules/mongodb/lib/cmap/wire_protocol/compression.js.map
new file mode 100644
index 00000000..ca716c39
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/compression.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"compression.js","sourceRoot":"","sources":["../../../src/cmap/wire_protocol/compression.ts"],"names":[],"mappings":";;;AA6EA,4BA6BC;AAGD,gCAkCC;AAmBD,0CAaC;AASD,gDA8BC;AAtND,6BAA6B;AAE7B,qCAAoD;AACpD,+CAAuD;AACvD,qCAAuF;AACvF,uCAAiF;AACjF,0CAOqB;AACrB,2CAAoD;AAEpD,cAAc;AACD,QAAA,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;CACC,CAAC,CAAC;AAQC,QAAA,sBAAsB,GAAG,IAAI,GAAG,CAAC;IAC5C,gCAAoB;IACpB,WAAW;IACX,cA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AAC,kBAAO,CAAC;IACxE,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IACrE,IAAI,WAAW,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;QACzC,MAAM,IAAI,+BAAuB,CAAC,yDAAyD,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/constants.js b/node_modules/mongodb/lib/cmap/wire_protocol/constants.js
new file mode 100644
index 00000000..953be814
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/constants.js
@@ -0,0 +1,21 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.OP_MSG = exports.OP_COMPRESSED = exports.OP_DELETE = exports.OP_QUERY = exports.OP_INSERT = exports.OP_UPDATE = exports.OP_REPLY = exports.MIN_SUPPORTED_RAW_DATA_SERVER_VERSION = exports.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION = exports.MIN_SUPPORTED_QE_SERVER_VERSION = exports.MIN_SUPPORTED_QE_WIRE_VERSION = exports.MAX_SUPPORTED_WIRE_VERSION = exports.MIN_SUPPORTED_WIRE_VERSION = exports.MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION = exports.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION = exports.MAX_SUPPORTED_SERVER_VERSION = exports.MIN_SUPPORTED_SERVER_VERSION = void 0;
+exports.MIN_SUPPORTED_SERVER_VERSION = '4.2';
+exports.MAX_SUPPORTED_SERVER_VERSION = '8.2';
+exports.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION = 13;
+exports.MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION = '5.0';
+exports.MIN_SUPPORTED_WIRE_VERSION = 8;
+exports.MAX_SUPPORTED_WIRE_VERSION = 27;
+exports.MIN_SUPPORTED_QE_WIRE_VERSION = 21;
+exports.MIN_SUPPORTED_QE_SERVER_VERSION = '7.0';
+exports.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION = 27;
+exports.MIN_SUPPORTED_RAW_DATA_SERVER_VERSION = '8.2';
+exports.OP_REPLY = 1;
+exports.OP_UPDATE = 2001;
+exports.OP_INSERT = 2002;
+exports.OP_QUERY = 2004;
+exports.OP_DELETE = 2006;
+exports.OP_COMPRESSED = 2012;
+exports.OP_MSG = 2013;
+//# sourceMappingURL=constants.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/constants.js.map b/node_modules/mongodb/lib/cmap/wire_protocol/constants.js.map
new file mode 100644
index 00000000..181ec4d9
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/constants.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/cmap/wire_protocol/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,4BAA4B,GAAG,KAAK,CAAC;AACrC,QAAA,4BAA4B,GAAG,KAAK,CAAC;AACrC,QAAA,yCAAyC,GAAG,EAAE,CAAC;AAC/C,QAAA,2CAA2C,GAAG,KAAK,CAAC;AACpD,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAC/B,QAAA,0BAA0B,GAAG,EAAE,CAAC;AAChC,QAAA,6BAA6B,GAAG,EAAE,CAAC;AACnC,QAAA,+BAA+B,GAAG,KAAK,CAAC;AACxC,QAAA,mCAAmC,GAAG,EAAE,CAAC;AACzC,QAAA,qCAAqC,GAAG,KAAK,CAAC;AAC9C,QAAA,QAAQ,GAAG,CAAC,CAAC;AACb,QAAA,SAAS,GAAG,IAAI,CAAC;AACjB,QAAA,SAAS,GAAG,IAAI,CAAC;AACjB,QAAA,QAAQ,GAAG,IAAI,CAAC;AAChB,QAAA,SAAS,GAAG,IAAI,CAAC;AACjB,QAAA,aAAa,GAAG,IAAI,CAAC;AACrB,QAAA,MAAM,GAAG,IAAI,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js b/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js
new file mode 100644
index 00000000..fb7e8fe3
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js
@@ -0,0 +1,111 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.onData = onData;
+const utils_1 = require("../../utils");
+/**
+ * onData is adapted from Node.js' events.on helper
+ * https://nodejs.org/api/events.html#eventsonemitter-eventname-options
+ *
+ * Returns an AsyncIterator that iterates each 'data' event emitted from emitter.
+ * It will reject upon an error event.
+ */
+function onData(emitter, { timeoutContext, signal }) {
+ signal?.throwIfAborted();
+ // Setup pending events and pending promise lists
+ /**
+ * When the caller has not yet called .next(), we store the
+ * value from the event in this list. Next time they call .next()
+ * we pull the first value out of this list and resolve a promise with it.
+ */
+ const unconsumedEvents = new utils_1.List();
+ /**
+ * When there has not yet been an event, a new promise will be created
+ * and implicitly stored in this list. When an event occurs we take the first
+ * promise in this list and resolve it.
+ */
+ const unconsumedPromises = new utils_1.List();
+ /**
+ * Stored an error created by an error event.
+ * This error will turn into a rejection for the subsequent .next() call
+ */
+ let error = null;
+ /** Set to true only after event listeners have been removed. */
+ let finished = false;
+ const iterator = {
+ next() {
+ // First, we consume all unread events
+ const value = unconsumedEvents.shift();
+ if (value != null) {
+ return Promise.resolve({ value, done: false });
+ }
+ // Then we error, if an error happened
+ // This happens one time if at all, because after 'error'
+ // we stop listening
+ if (error != null) {
+ const p = Promise.reject(error);
+ // Only the first element errors
+ error = null;
+ return p;
+ }
+ // If the iterator is finished, resolve to done
+ if (finished)
+ return closeHandler();
+ // Wait until an event happens
+ const { promise, resolve, reject } = (0, utils_1.promiseWithResolvers)();
+ unconsumedPromises.push({ resolve, reject });
+ return promise;
+ },
+ return() {
+ return closeHandler();
+ },
+ throw(err) {
+ errorHandler(err);
+ return Promise.resolve({ value: undefined, done: true });
+ },
+ [Symbol.asyncIterator]() {
+ return this;
+ },
+ async [Symbol.asyncDispose]() {
+ await closeHandler();
+ }
+ };
+ // Adding event handlers
+ emitter.on('data', eventHandler);
+ emitter.on('error', errorHandler);
+ const abortListener = (0, utils_1.addAbortListener)(signal, function () {
+ errorHandler(this.reason);
+ });
+ const timeoutForSocketRead = timeoutContext?.timeoutForSocketRead;
+ timeoutForSocketRead?.throwIfExpired();
+ timeoutForSocketRead?.then(undefined, errorHandler);
+ return iterator;
+ function eventHandler(value) {
+ const promise = unconsumedPromises.shift();
+ if (promise != null)
+ promise.resolve({ value, done: false });
+ else
+ unconsumedEvents.push(value);
+ }
+ function errorHandler(err) {
+ const promise = unconsumedPromises.shift();
+ if (promise != null)
+ promise.reject(err);
+ else
+ error = err;
+ void closeHandler();
+ }
+ function closeHandler() {
+ // Adding event handlers
+ emitter.off('data', eventHandler);
+ emitter.off('error', errorHandler);
+ abortListener?.[utils_1.kDispose]();
+ finished = true;
+ timeoutForSocketRead?.clear();
+ const doneResult = { value: undefined, done: finished };
+ for (const promise of unconsumedPromises) {
+ promise.resolve(doneResult);
+ }
+ return Promise.resolve(doneResult);
+ }
+}
+//# sourceMappingURL=on_data.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js.map b/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js.map
new file mode 100644
index 00000000..fc2a6f93
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"on_data.js","sourceRoot":"","sources":["../../../src/cmap/wire_protocol/on_data.ts"],"names":[],"mappings":";;AAsBA,wBAoHC;AAtID,uCAAqF;AAWrF;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,OAAqB,EACrB,EAAE,cAAc,EAAE,MAAM,EAAmD;IAE3E,MAAM,EAAE,cAAc,EAAE,CAAC;IAEzB,iDAAiD;IACjD;;;;OAIG;IACH,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AAE,YAAY,CAAC,CAAC;QACnC,aAAa,EAAE,CAAC,gBAAQ,CAAC,EAAE,CAAC;QAC5B,QAAQ,GAAG,IAAI,CAAC;QAChB,oBAAoB,EAAE,KAAK,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAW,CAAC;QAEjE,KAAK,MAAM,OAAO,IAAI,kBAAkB,EAAE,CAAC;YACzC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;AACH,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js b/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js
new file mode 100644
index 00000000..ccfb9836
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js
@@ -0,0 +1,222 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.OnDemandDocument = void 0;
+const bson_1 = require("../../../bson");
+const BSONElementOffset = {
+ type: 0,
+ nameOffset: 1,
+ nameLength: 2,
+ offset: 3,
+ length: 4
+};
+/** @internal */
+class OnDemandDocument {
+ constructor(bson, offset = 0, isArray = false,
+ /** If elements was already calculated */
+ elements) {
+ /**
+ * Maps JS strings to elements and jsValues for speeding up subsequent lookups.
+ * - If `false` then name does not exist in the BSON document
+ * - If `CachedBSONElement` instance name exists
+ * - If `cache[name].value == null` jsValue has not yet been parsed
+ * - Null/Undefined values do not get cached because they are zero-length values.
+ */
+ this.cache = Object.create(null);
+ /** Caches the index of elements that have been named */
+ this.indexFound = Object.create(null);
+ this.bson = bson;
+ this.offset = offset;
+ this.isArray = isArray;
+ this.elements = elements ?? (0, bson_1.parseToElementsToArray)(this.bson, offset);
+ }
+ /** Only supports basic latin strings */
+ isElementName(name, element) {
+ const nameLength = element[BSONElementOffset.nameLength];
+ const nameOffset = element[BSONElementOffset.nameOffset];
+ if (name.length !== nameLength)
+ return false;
+ const nameEnd = nameOffset + nameLength;
+ for (let byteIndex = nameOffset, charIndex = 0; charIndex < name.length && byteIndex < nameEnd; charIndex++, byteIndex++) {
+ if (this.bson[byteIndex] !== name.charCodeAt(charIndex))
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Seeks into the elements array for an element matching the given name.
+ *
+ * @remarks
+ * Caching:
+ * - Caches the existence of a property making subsequent look ups for non-existent properties return immediately
+ * - Caches names mapped to elements to avoid reiterating the array and comparing the name again
+ * - Caches the index at which an element has been found to prevent rechecking against elements already determined to belong to another name
+ *
+ * @param name - a basic latin string name of a BSON element
+ * @returns
+ */
+ getElement(name) {
+ const cachedElement = this.cache[name];
+ if (cachedElement === false)
+ return null;
+ if (cachedElement != null) {
+ return cachedElement;
+ }
+ if (typeof name === 'number') {
+ if (this.isArray) {
+ if (name < this.elements.length) {
+ const element = this.elements[name];
+ const cachedElement = { element, value: undefined };
+ this.cache[name] = cachedElement;
+ this.indexFound[name] = true;
+ return cachedElement;
+ }
+ else {
+ return null;
+ }
+ }
+ else {
+ return null;
+ }
+ }
+ for (let index = 0; index < this.elements.length; index++) {
+ const element = this.elements[index];
+ // skip this element if it has already been associated with a name
+ if (!(index in this.indexFound) && this.isElementName(name, element)) {
+ const cachedElement = { element, value: undefined };
+ this.cache[name] = cachedElement;
+ this.indexFound[index] = true;
+ return cachedElement;
+ }
+ }
+ this.cache[name] = false;
+ return null;
+ }
+ toJSValue(element, as) {
+ const type = element[BSONElementOffset.type];
+ const offset = element[BSONElementOffset.offset];
+ const length = element[BSONElementOffset.length];
+ if (as !== type) {
+ return null;
+ }
+ switch (as) {
+ case bson_1.BSONType.null:
+ case bson_1.BSONType.undefined:
+ return null;
+ case bson_1.BSONType.double:
+ return bson_1.NumberUtils.getFloat64LE(this.bson, offset);
+ case bson_1.BSONType.int:
+ return bson_1.NumberUtils.getInt32LE(this.bson, offset);
+ case bson_1.BSONType.long:
+ return bson_1.NumberUtils.getBigInt64LE(this.bson, offset);
+ case bson_1.BSONType.bool:
+ return Boolean(this.bson[offset]);
+ case bson_1.BSONType.objectId:
+ return new bson_1.ObjectId(this.bson.subarray(offset, offset + 12));
+ case bson_1.BSONType.timestamp:
+ return new bson_1.Timestamp(bson_1.NumberUtils.getBigInt64LE(this.bson, offset));
+ case bson_1.BSONType.string:
+ return bson_1.ByteUtils.toUTF8(this.bson, offset + 4, offset + length - 1, false);
+ case bson_1.BSONType.binData: {
+ const totalBinarySize = bson_1.NumberUtils.getInt32LE(this.bson, offset);
+ const subType = this.bson[offset + 4];
+ if (subType === 2) {
+ const subType2BinarySize = bson_1.NumberUtils.getInt32LE(this.bson, offset + 1 + 4);
+ if (subType2BinarySize < 0)
+ throw new bson_1.BSONError('Negative binary type element size found for subtype 0x02');
+ if (subType2BinarySize > totalBinarySize - 4)
+ throw new bson_1.BSONError('Binary type with subtype 0x02 contains too long binary size');
+ if (subType2BinarySize < totalBinarySize - 4)
+ throw new bson_1.BSONError('Binary type with subtype 0x02 contains too short binary size');
+ return new bson_1.Binary(this.bson.subarray(offset + 1 + 4 + 4, offset + 1 + 4 + 4 + subType2BinarySize), 2);
+ }
+ return new bson_1.Binary(this.bson.subarray(offset + 1 + 4, offset + 1 + 4 + totalBinarySize), subType);
+ }
+ case bson_1.BSONType.date:
+ // Pretend this is correct.
+ return new Date(Number(bson_1.NumberUtils.getBigInt64LE(this.bson, offset)));
+ case bson_1.BSONType.object:
+ return new OnDemandDocument(this.bson, offset);
+ case bson_1.BSONType.array:
+ return new OnDemandDocument(this.bson, offset, true);
+ default:
+ throw new bson_1.BSONError(`Unsupported BSON type: ${as}`);
+ }
+ }
+ /**
+ * Returns the number of elements in this BSON document
+ */
+ size() {
+ return this.elements.length;
+ }
+ /**
+ * Checks for the existence of an element by name.
+ *
+ * @remarks
+ * Uses `getElement` with the expectation that will populate caches such that a `has` call
+ * followed by a `getElement` call will not repeat the cost paid by the first look up.
+ *
+ * @param name - element name
+ */
+ has(name) {
+ const cachedElement = this.cache[name];
+ if (cachedElement === false)
+ return false;
+ if (cachedElement != null)
+ return true;
+ return this.getElement(name) != null;
+ }
+ get(name, as, required) {
+ const element = this.getElement(name);
+ if (element == null) {
+ if (required === true) {
+ throw new bson_1.BSONError(`BSON element "${name}" is missing`);
+ }
+ else {
+ return null;
+ }
+ }
+ if (element.value == null) {
+ const value = this.toJSValue(element.element, as);
+ if (value == null) {
+ if (required === true) {
+ throw new bson_1.BSONError(`BSON element "${name}" is missing`);
+ }
+ else {
+ return null;
+ }
+ }
+ // It is important to never store null
+ element.value = value;
+ }
+ return element.value;
+ }
+ getNumber(name, required) {
+ const maybeBool = this.get(name, bson_1.BSONType.bool);
+ const bool = maybeBool == null ? null : maybeBool ? 1 : 0;
+ const maybeLong = this.get(name, bson_1.BSONType.long);
+ const long = maybeLong == null ? null : Number(maybeLong);
+ const result = bool ?? long ?? this.get(name, bson_1.BSONType.int) ?? this.get(name, bson_1.BSONType.double);
+ if (required === true && result == null) {
+ throw new bson_1.BSONError(`BSON element "${name}" is missing`);
+ }
+ return result;
+ }
+ /**
+ * Deserialize this object, DOES NOT cache result so avoid multiple invocations
+ * @param options - BSON deserialization options
+ */
+ toObject(options) {
+ return (0, bson_1.deserialize)(this.bson, {
+ ...options,
+ index: this.offset,
+ allowObjectSmallerThanBufferSize: true
+ });
+ }
+ /** Returns this document's bytes only */
+ toBytes() {
+ const size = bson_1.NumberUtils.getInt32LE(this.bson, this.offset);
+ return this.bson.subarray(this.offset, this.offset + size);
+ }
+}
+exports.OnDemandDocument = OnDemandDocument;
+//# sourceMappingURL=document.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js.map b/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js.map
new file mode 100644
index 00000000..62bbed98
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../../src/cmap/wire_protocol/on_demand/document.ts"],"names":[],"mappings":";;;AAAA,wCAYuB;AAEvB,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,CAAC;IACP,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACD,CAAC;AA8BX,gBAAgB;AAChB,MAAa,gBAAgB;IAsB3B,YACE,IAAgB,EAChB,MAAM,GAAG,CAAC,EACV,OAAO,GAAG,KAAK;IACf,yCAAyC;IACzC,QAAwB;QA1B1B;;;;;;WAMG;QACc,UAAK,GACpB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,wDAAwD;QACvC,eAAU,GAA4B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAkBzE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,IAAA,6BAAsB,EAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;IAED,wCAAwC;IAChC,aAAa,CAAC,IAAY,EAAE,OAAoB;QACtD,MAAM,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACzD,MAAM,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAEzD,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QAE7C,MAAM,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;QACxC,KACE,IAAI,SAAS,GAAG,UAAU,EAAE,SAAS,GAAG,CAAC,EACzC,SAAS,GAAG,IAAI,CAAC,MAAM,IAAI,SAAS,GAAG,OAAO,EAC9C,SAAS,EAAE,EAA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;QAChD,MAAM,IAAI,GAAG,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAE1D,MAAM,MAAM,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,eAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,eAAQ,CAAC,MAAM,CAAC,CAAC;QAE/F,IAAI,QAAQ,KAAK,IAAI,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACxC,MAAM,IAAI,gBAAS,CAAC,iBAAiB,IAAI,cAAc,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,OAA4C;QAC1D,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,IAAI,EAAE;YAC5B,GAAG,OAAO;YACV,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,gCAAgC,EAAE,IAAI;SACvC,CAAC,CAAC;IACL,CAAC;IAED,yCAAyC;IACzC,OAAO;QACL,MAAM,IAAI,GAAG,kBAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7D,CAAC;CACF;AAhTD,4CAgTC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/responses.js b/node_modules/mongodb/lib/cmap/wire_protocol/responses.js
new file mode 100644
index 00000000..5a5dd188
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/responses.js
@@ -0,0 +1,315 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ClientBulkWriteCursorResponse = exports.ExplainedCursorResponse = exports.CursorResponse = exports.MongoDBResponse = void 0;
+exports.isErrorResponse = isErrorResponse;
+const bson_1 = require("../../bson");
+const error_1 = require("../../error");
+const utils_1 = require("../../utils");
+const document_1 = require("./on_demand/document");
+const BSONElementOffset = {
+ type: 0,
+ nameOffset: 1,
+ nameLength: 2,
+ offset: 3,
+ length: 4
+};
+/**
+ * Accepts a BSON payload and checks for na "ok: 0" element.
+ * This utility is intended to prevent calling response class constructors
+ * that expect the result to be a success and demand certain properties to exist.
+ *
+ * For example, a cursor response always expects a cursor embedded document.
+ * In order to write the class such that the properties reflect that assertion (non-null)
+ * we cannot invoke the subclass constructor if the BSON represents an error.
+ *
+ * @param bytes - BSON document returned from the server
+ */
+function isErrorResponse(bson, elements) {
+ for (let eIdx = 0; eIdx < elements.length; eIdx++) {
+ const element = elements[eIdx];
+ if (element[BSONElementOffset.nameLength] === 2) {
+ const nameOffset = element[BSONElementOffset.nameOffset];
+ // 111 == "o", 107 == "k"
+ if (bson[nameOffset] === 111 && bson[nameOffset + 1] === 107) {
+ const valueOffset = element[BSONElementOffset.offset];
+ const valueLength = element[BSONElementOffset.length];
+ // If any byte in the length of the ok number (works for any type) is non zero,
+ // then it is considered "ok: 1"
+ for (let i = valueOffset; i < valueOffset + valueLength; i++) {
+ if (bson[i] !== 0x00)
+ return false;
+ }
+ return true;
+ }
+ }
+ }
+ return true;
+}
+/** @internal */
+class MongoDBResponse extends document_1.OnDemandDocument {
+ get(name, as, required) {
+ try {
+ return super.get(name, as, required);
+ }
+ catch (cause) {
+ throw new error_1.MongoUnexpectedServerResponseError(cause.message, { cause });
+ }
+ }
+ static is(value) {
+ return value instanceof MongoDBResponse;
+ }
+ static make(bson) {
+ const elements = (0, bson_1.parseToElementsToArray)(bson, 0);
+ const isError = isErrorResponse(bson, elements);
+ return isError
+ ? new MongoDBResponse(bson, 0, false, elements)
+ : new this(bson, 0, false, elements);
+ }
+ // {ok:1}
+ static { this.empty = new MongoDBResponse(new Uint8Array([13, 0, 0, 0, 16, 111, 107, 0, 1, 0, 0, 0, 0])); }
+ /**
+ * Returns true iff:
+ * - ok is 0 and the top-level code === 50
+ * - ok is 1 and the writeErrors array contains a code === 50
+ * - ok is 1 and the writeConcern object contains a code === 50
+ */
+ get isMaxTimeExpiredError() {
+ // {ok: 0, code: 50 ... }
+ const isTopLevel = this.ok === 0 && this.code === error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired;
+ if (isTopLevel)
+ return true;
+ if (this.ok === 0)
+ return false;
+ // {ok: 1, writeConcernError: {code: 50 ... }}
+ const isWriteConcern = this.get('writeConcernError', bson_1.BSONType.object)?.getNumber('code') ===
+ error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired;
+ if (isWriteConcern)
+ return true;
+ const writeErrors = this.get('writeErrors', bson_1.BSONType.array);
+ if (writeErrors?.size()) {
+ for (let i = 0; i < writeErrors.size(); i++) {
+ const isWriteError = writeErrors.get(i, bson_1.BSONType.object)?.getNumber('code') ===
+ error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired;
+ // {ok: 1, writeErrors: [{code: 50 ... }]}
+ if (isWriteError)
+ return true;
+ }
+ }
+ return false;
+ }
+ /**
+ * Drivers can safely assume that the `recoveryToken` field is always a BSON document but drivers MUST NOT modify the
+ * contents of the document.
+ */
+ get recoveryToken() {
+ return (this.get('recoveryToken', bson_1.BSONType.object)?.toObject({
+ promoteValues: false,
+ promoteLongs: false,
+ promoteBuffers: false,
+ validation: { utf8: true }
+ }) ?? null);
+ }
+ /**
+ * The server creates a cursor in response to a snapshot find/aggregate command and reports atClusterTime within the cursor field in the response.
+ * For the distinct command the server adds a top-level atClusterTime field to the response.
+ * The atClusterTime field represents the timestamp of the read and is guaranteed to be majority committed.
+ */
+ get atClusterTime() {
+ return (this.get('cursor', bson_1.BSONType.object)?.get('atClusterTime', bson_1.BSONType.timestamp) ??
+ this.get('atClusterTime', bson_1.BSONType.timestamp));
+ }
+ get operationTime() {
+ return this.get('operationTime', bson_1.BSONType.timestamp);
+ }
+ /** Normalizes whatever BSON value is "ok" to a JS number 1 or 0. */
+ get ok() {
+ return this.getNumber('ok') ? 1 : 0;
+ }
+ get $err() {
+ return this.get('$err', bson_1.BSONType.string);
+ }
+ get errmsg() {
+ return this.get('errmsg', bson_1.BSONType.string);
+ }
+ get code() {
+ return this.getNumber('code');
+ }
+ get $clusterTime() {
+ if (!('clusterTime' in this)) {
+ const clusterTimeDoc = this.get('$clusterTime', bson_1.BSONType.object);
+ if (clusterTimeDoc == null) {
+ this.clusterTime = null;
+ return null;
+ }
+ const clusterTime = clusterTimeDoc.get('clusterTime', bson_1.BSONType.timestamp, true);
+ const signature = clusterTimeDoc.get('signature', bson_1.BSONType.object)?.toObject();
+ // @ts-expect-error: `signature` is incorrectly typed. It is public API.
+ this.clusterTime = { clusterTime, signature };
+ }
+ return this.clusterTime ?? null;
+ }
+ toObject(options) {
+ const exactBSONOptions = {
+ ...(0, bson_1.pluckBSONSerializeOptions)(options ?? {}),
+ validation: (0, bson_1.parseUtf8ValidationOption)(options)
+ };
+ return super.toObject(exactBSONOptions);
+ }
+}
+exports.MongoDBResponse = MongoDBResponse;
+/** @internal */
+class CursorResponse extends MongoDBResponse {
+ constructor() {
+ super(...arguments);
+ this._batch = null;
+ this.iterated = 0;
+ this._encryptedBatch = null;
+ }
+ /**
+ * This supports a feature of the FindCursor.
+ * It is an optimization to avoid an extra getMore when the limit has been reached
+ */
+ static get emptyGetMore() {
+ return new CursorResponse((0, bson_1.serialize)({ ok: 1, cursor: { id: 0n, nextBatch: [] } }));
+ }
+ static is(value) {
+ return value instanceof CursorResponse || value === CursorResponse.emptyGetMore;
+ }
+ get cursor() {
+ return this.get('cursor', bson_1.BSONType.object, true);
+ }
+ get id() {
+ try {
+ return bson_1.Long.fromBigInt(this.cursor.get('id', bson_1.BSONType.long, true));
+ }
+ catch (cause) {
+ throw new error_1.MongoUnexpectedServerResponseError(cause.message, { cause });
+ }
+ }
+ get ns() {
+ const namespace = this.cursor.get('ns', bson_1.BSONType.string);
+ if (namespace != null)
+ return (0, utils_1.ns)(namespace);
+ return null;
+ }
+ get length() {
+ return Math.max(this.batchSize - this.iterated, 0);
+ }
+ get encryptedBatch() {
+ if (this.encryptedResponse == null)
+ return null;
+ if (this._encryptedBatch != null)
+ return this._encryptedBatch;
+ const cursor = this.encryptedResponse?.get('cursor', bson_1.BSONType.object);
+ if (cursor?.has('firstBatch'))
+ this._encryptedBatch = cursor.get('firstBatch', bson_1.BSONType.array, true);
+ else if (cursor?.has('nextBatch'))
+ this._encryptedBatch = cursor.get('nextBatch', bson_1.BSONType.array, true);
+ else
+ throw new error_1.MongoUnexpectedServerResponseError('Cursor document did not contain a batch');
+ return this._encryptedBatch;
+ }
+ get batch() {
+ if (this._batch != null)
+ return this._batch;
+ const cursor = this.cursor;
+ if (cursor.has('firstBatch'))
+ this._batch = cursor.get('firstBatch', bson_1.BSONType.array, true);
+ else if (cursor.has('nextBatch'))
+ this._batch = cursor.get('nextBatch', bson_1.BSONType.array, true);
+ else
+ throw new error_1.MongoUnexpectedServerResponseError('Cursor document did not contain a batch');
+ return this._batch;
+ }
+ get batchSize() {
+ return this.batch?.size();
+ }
+ get postBatchResumeToken() {
+ return (this.cursor.get('postBatchResumeToken', bson_1.BSONType.object)?.toObject({
+ promoteValues: false,
+ promoteLongs: false,
+ promoteBuffers: false,
+ validation: { utf8: true }
+ }) ?? null);
+ }
+ shift(options) {
+ if (this.iterated >= this.batchSize) {
+ return null;
+ }
+ const result = this.batch.get(this.iterated, bson_1.BSONType.object, true) ?? null;
+ const encryptedResult = this.encryptedBatch?.get(this.iterated, bson_1.BSONType.object, true) ?? null;
+ this.iterated += 1;
+ if (options?.raw) {
+ return result.toBytes();
+ }
+ else {
+ const object = result.toObject(options);
+ if (encryptedResult) {
+ (0, utils_1.decorateDecryptionResult)(object, encryptedResult.toObject(options), true);
+ }
+ return object;
+ }
+ }
+ clear() {
+ this.iterated = this.batchSize;
+ }
+}
+exports.CursorResponse = CursorResponse;
+/**
+ * Explain responses have nothing to do with cursor responses
+ * This class serves to temporarily avoid refactoring how cursors handle
+ * explain responses which is to detect that the response is not cursor-like and return the explain
+ * result as the "first and only" document in the "batch" and end the "cursor"
+ */
+class ExplainedCursorResponse extends CursorResponse {
+ constructor() {
+ super(...arguments);
+ this.isExplain = true;
+ this._length = 1;
+ }
+ get id() {
+ return bson_1.Long.fromBigInt(0n);
+ }
+ get batchSize() {
+ return 0;
+ }
+ get ns() {
+ return null;
+ }
+ get length() {
+ return this._length;
+ }
+ shift(options) {
+ if (this._length === 0)
+ return null;
+ this._length -= 1;
+ return this.toObject(options);
+ }
+}
+exports.ExplainedCursorResponse = ExplainedCursorResponse;
+/**
+ * Client bulk writes have some extra metadata at the top level that needs to be
+ * included in the result returned to the user.
+ */
+class ClientBulkWriteCursorResponse extends CursorResponse {
+ get insertedCount() {
+ return this.get('nInserted', bson_1.BSONType.int, true);
+ }
+ get upsertedCount() {
+ return this.get('nUpserted', bson_1.BSONType.int, true);
+ }
+ get matchedCount() {
+ return this.get('nMatched', bson_1.BSONType.int, true);
+ }
+ get modifiedCount() {
+ return this.get('nModified', bson_1.BSONType.int, true);
+ }
+ get deletedCount() {
+ return this.get('nDeleted', bson_1.BSONType.int, true);
+ }
+ get writeConcernError() {
+ return this.get('writeConcernError', bson_1.BSONType.object, false);
+ }
+}
+exports.ClientBulkWriteCursorResponse = ClientBulkWriteCursorResponse;
+//# sourceMappingURL=responses.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/responses.js.map b/node_modules/mongodb/lib/cmap/wire_protocol/responses.js.map
new file mode 100644
index 00000000..a5dd903e
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/responses.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../src/cmap/wire_protocol/responses.ts"],"names":[],"mappings":";;;AAyCA,0CAwBC;AAjED,qCAYoB;AACpB,uCAAsF;AAEtF,uCAA2D;AAC3D,mDAI8B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ED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,eAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,eAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,eAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,eAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAmB,EAAE,eAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;CACF;AAxBD,sEAwBC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/shared.js b/node_modules/mongodb/lib/cmap/wire_protocol/shared.js
new file mode 100644
index 00000000..bbe66b54
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/shared.js
@@ -0,0 +1,35 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.getReadPreference = getReadPreference;
+exports.isSharded = isSharded;
+const error_1 = require("../../error");
+const read_preference_1 = require("../../read_preference");
+const common_1 = require("../../sdam/common");
+const topology_description_1 = require("../../sdam/topology_description");
+function getReadPreference(options) {
+ // Default to command version of the readPreference.
+ let readPreference = options?.readPreference ?? read_preference_1.ReadPreference.primary;
+ if (typeof readPreference === 'string') {
+ readPreference = read_preference_1.ReadPreference.fromString(readPreference);
+ }
+ if (!(readPreference instanceof read_preference_1.ReadPreference)) {
+ throw new error_1.MongoInvalidArgumentError('Option "readPreference" must be a ReadPreference instance');
+ }
+ return readPreference;
+}
+function isSharded(topologyOrServer) {
+ if (topologyOrServer == null) {
+ return false;
+ }
+ if (topologyOrServer.description && topologyOrServer.description.type === common_1.ServerType.Mongos) {
+ return true;
+ }
+ // NOTE: This is incredibly inefficient, and should be removed once command construction
+ // happens based on `Server` not `Topology`.
+ if (topologyOrServer.description && topologyOrServer.description instanceof topology_description_1.TopologyDescription) {
+ const servers = Array.from(topologyOrServer.description.servers.values());
+ return servers.some((server) => server.type === common_1.ServerType.Mongos);
+ }
+ return false;
+}
+//# sourceMappingURL=shared.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cmap/wire_protocol/shared.js.map b/node_modules/mongodb/lib/cmap/wire_protocol/shared.js.map
new file mode 100644
index 00000000..a0cce4d4
--- /dev/null
+++ b/node_modules/mongodb/lib/cmap/wire_protocol/shared.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/cmap/wire_protocol/shared.ts"],"names":[],"mappings":";;AAaA,8CAeC;AAED,8BAiBC;AA/CD,uCAAwD;AACxD,2DAAgF;AAChF,8CAA+C;AAI/C,0EAAsE;AAOtE,SAAgB,iBAAiB,CAAC,OAA8B;IAC9D,oDAAoD;IACpD,IAAI,cAAc,GAAG,OAAO,EAAE,cAAc,IAAI,gCAAc,CAAC,OAAO,CAAC;IAEvE,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;QACvC,cAAc,GAAG,gCAAc,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,CAAC,CAAC,cAAc,YAAY,gCAAc,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,iCAAyB,CACjC,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,SAAgB,SAAS,CAAC,gBAAiD;IACzE,IAAI,gBAAgB,IAAI,IAAI,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,WAAW,CAAC,IAAI,KAAK,mBAAU,CAAC,MAAM,EAAE,CAAC;QAC5F,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wFAAwF;IACxF,4CAA4C;IAC5C,IAAI,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,WAAW,YAAY,0CAAmB,EAAE,CAAC;QAChG,MAAM,OAAO,GAAwB,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/F,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAyB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,mBAAU,CAAC,MAAM,CAAC,CAAC;IACxF,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/collection.js b/node_modules/mongodb/lib/collection.js
new file mode 100644
index 00000000..0d1a5ba9
--- /dev/null
+++ b/node_modules/mongodb/lib/collection.js
@@ -0,0 +1,751 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Collection = void 0;
+const bson_1 = require("./bson");
+const ordered_1 = require("./bulk/ordered");
+const unordered_1 = require("./bulk/unordered");
+const change_stream_1 = require("./change_stream");
+const aggregation_cursor_1 = require("./cursor/aggregation_cursor");
+const find_cursor_1 = require("./cursor/find_cursor");
+const list_indexes_cursor_1 = require("./cursor/list_indexes_cursor");
+const list_search_indexes_cursor_1 = require("./cursor/list_search_indexes_cursor");
+const error_1 = require("./error");
+const count_1 = require("./operations/count");
+const delete_1 = require("./operations/delete");
+const distinct_1 = require("./operations/distinct");
+const estimated_document_count_1 = require("./operations/estimated_document_count");
+const execute_operation_1 = require("./operations/execute_operation");
+const find_and_modify_1 = require("./operations/find_and_modify");
+const indexes_1 = require("./operations/indexes");
+const insert_1 = require("./operations/insert");
+const rename_1 = require("./operations/rename");
+const create_1 = require("./operations/search_indexes/create");
+const drop_1 = require("./operations/search_indexes/drop");
+const update_1 = require("./operations/search_indexes/update");
+const update_2 = require("./operations/update");
+const read_concern_1 = require("./read_concern");
+const read_preference_1 = require("./read_preference");
+const utils_1 = require("./utils");
+const write_concern_1 = require("./write_concern");
+/**
+ * The **Collection** class is an internal class that embodies a MongoDB collection
+ * allowing for insert/find/update/delete and other command operation on that MongoDB collection.
+ *
+ * **COLLECTION Cannot directly be instantiated**
+ * @public
+ *
+ * @example
+ * ```ts
+ * import { MongoClient } from 'mongodb';
+ *
+ * interface Pet {
+ * name: string;
+ * kind: 'dog' | 'cat' | 'fish';
+ * }
+ *
+ * const client = new MongoClient('mongodb://localhost:27017');
+ * const pets = client.db().collection('pets');
+ *
+ * const petCursor = pets.find();
+ *
+ * for await (const pet of petCursor) {
+ * console.log(`${pet.name} is a ${pet.kind}!`);
+ * }
+ * ```
+ */
+class Collection {
+ /**
+ * Create a new Collection instance
+ * @internal
+ */
+ constructor(db, name, options) {
+ this.db = db;
+ // Internal state
+ this.s = {
+ db,
+ options,
+ namespace: new utils_1.MongoDBCollectionNamespace(db.databaseName, name),
+ pkFactory: db.options?.pkFactory ?? utils_1.DEFAULT_PK_FACTORY,
+ readPreference: read_preference_1.ReadPreference.fromOptions(options),
+ bsonOptions: (0, bson_1.resolveBSONOptions)(options, db),
+ readConcern: read_concern_1.ReadConcern.fromOptions(options),
+ writeConcern: write_concern_1.WriteConcern.fromOptions(options)
+ };
+ this.client = db.client;
+ }
+ /**
+ * The name of the database this collection belongs to
+ */
+ get dbName() {
+ return this.s.namespace.db;
+ }
+ /**
+ * The name of this collection
+ */
+ get collectionName() {
+ return this.s.namespace.collection;
+ }
+ /**
+ * The namespace of this collection, in the format `${this.dbName}.${this.collectionName}`
+ */
+ get namespace() {
+ return this.fullNamespace.toString();
+ }
+ /**
+ * @internal
+ *
+ * The `MongoDBNamespace` for the collection.
+ */
+ get fullNamespace() {
+ return this.s.namespace;
+ }
+ /**
+ * The current readConcern of the collection. If not explicitly defined for
+ * this collection, will be inherited from the parent DB
+ */
+ get readConcern() {
+ if (this.s.readConcern == null) {
+ return this.db.readConcern;
+ }
+ return this.s.readConcern;
+ }
+ /**
+ * The current readPreference of the collection. If not explicitly defined for
+ * this collection, will be inherited from the parent DB
+ */
+ get readPreference() {
+ if (this.s.readPreference == null) {
+ return this.db.readPreference;
+ }
+ return this.s.readPreference;
+ }
+ get bsonOptions() {
+ return this.s.bsonOptions;
+ }
+ /**
+ * The current writeConcern of the collection. If not explicitly defined for
+ * this collection, will be inherited from the parent DB
+ */
+ get writeConcern() {
+ if (this.s.writeConcern == null) {
+ return this.db.writeConcern;
+ }
+ return this.s.writeConcern;
+ }
+ /** The current index hint for the collection */
+ get hint() {
+ return this.s.collectionHint;
+ }
+ set hint(v) {
+ this.s.collectionHint = (0, utils_1.normalizeHintField)(v);
+ }
+ get timeoutMS() {
+ return this.s.options.timeoutMS;
+ }
+ /**
+ * Inserts a single document into MongoDB. If documents passed in do not contain the **_id** field,
+ * one will be added to each of the documents missing it by the driver, mutating the document. This behavior
+ * can be overridden by setting the **forceServerObjectId** flag.
+ *
+ * @param doc - The document to insert
+ * @param options - Optional settings for the command
+ */
+ async insertOne(doc, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new insert_1.InsertOneOperation(this, doc, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Inserts an array of documents into MongoDB. If documents passed in do not contain the **_id** field,
+ * one will be added to each of the documents missing it by the driver, mutating the document. This behavior
+ * can be overridden by setting the **forceServerObjectId** flag.
+ *
+ * @param docs - The documents to insert
+ * @param options - Optional settings for the command
+ */
+ async insertMany(docs, options) {
+ if (!Array.isArray(docs)) {
+ throw new error_1.MongoInvalidArgumentError('Argument "docs" must be an array of documents');
+ }
+ options = (0, utils_1.resolveOptions)(this, options ?? {});
+ const acknowledged = write_concern_1.WriteConcern.fromOptions(options)?.w !== 0;
+ try {
+ const res = await this.bulkWrite(docs.map(doc => ({ insertOne: { document: doc } })), options);
+ return {
+ acknowledged,
+ insertedCount: res.insertedCount,
+ insertedIds: res.insertedIds
+ };
+ }
+ catch (err) {
+ if (err && err.message === 'Operation must be an object with an operation key') {
+ throw new error_1.MongoInvalidArgumentError('Collection.insertMany() cannot be called with an array that has null/undefined values');
+ }
+ throw err;
+ }
+ }
+ /**
+ * Perform a bulkWrite operation without a fluent API
+ *
+ * Legal operation types are
+ * - `insertOne`
+ * - `replaceOne`
+ * - `updateOne`
+ * - `updateMany`
+ * - `deleteOne`
+ * - `deleteMany`
+ *
+ * If documents passed in do not contain the **_id** field,
+ * one will be added to each of the documents missing it by the driver, mutating the document. This behavior
+ * can be overridden by setting the **forceServerObjectId** flag.
+ *
+ * @param operations - Bulk operations to perform
+ * @param options - Optional settings for the command
+ * @throws MongoDriverError if operations is not an array
+ */
+ async bulkWrite(operations, options) {
+ if (!Array.isArray(operations)) {
+ throw new error_1.MongoInvalidArgumentError('Argument "operations" must be an array of documents');
+ }
+ options = (0, utils_1.resolveOptions)(this, options ?? {});
+ // TODO(NODE-7071): remove once the client doesn't need to be connected to construct
+ // bulk operations
+ const isConnected = this.client.topology != null;
+ if (!isConnected) {
+ await (0, execute_operation_1.autoConnect)(this.client);
+ }
+ // Create the bulk operation
+ const bulk = options.ordered === false
+ ? this.initializeUnorderedBulkOp(options)
+ : this.initializeOrderedBulkOp(options);
+ // for each op go through and add to the bulk
+ for (const operation of operations) {
+ bulk.raw(operation);
+ }
+ // Execute the bulk
+ return await bulk.execute({ ...options });
+ }
+ /**
+ * Update a single document in a collection
+ *
+ * The value of `update` can be either:
+ * - UpdateFilter - A document that contains update operator expressions,
+ * - Document[] - an aggregation pipeline.
+ *
+ * @param filter - The filter used to select the document to update
+ * @param update - The modifications to apply
+ * @param options - Optional settings for the command
+ */
+ async updateOne(filter, update, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new update_2.UpdateOneOperation(this.s.namespace, filter, update, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Replace a document in a collection with another document
+ *
+ * @param filter - The filter used to select the document to replace
+ * @param replacement - The Document that replaces the matching document
+ * @param options - Optional settings for the command
+ */
+ async replaceOne(filter, replacement, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new update_2.ReplaceOneOperation(this.s.namespace, filter, replacement, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Update multiple documents in a collection
+ *
+ * The value of `update` can be either:
+ * - UpdateFilter - A document that contains update operator expressions,
+ * - Document[] - an aggregation pipeline.
+ *
+ * @param filter - The filter used to select the document to update
+ * @param update - The modifications to apply
+ * @param options - Optional settings for the command
+ */
+ async updateMany(filter, update, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new update_2.UpdateManyOperation(this.s.namespace, filter, update, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Delete a document from a collection
+ *
+ * @param filter - The filter used to select the document to remove
+ * @param options - Optional settings for the command
+ */
+ async deleteOne(filter = {}, options = {}) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new delete_1.DeleteOneOperation(this.s.namespace, filter, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Delete multiple documents from a collection
+ *
+ * @param filter - The filter used to select the documents to remove
+ * @param options - Optional settings for the command
+ */
+ async deleteMany(filter = {}, options = {}) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new delete_1.DeleteManyOperation(this.s.namespace, filter, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Rename the collection.
+ *
+ * @remarks
+ * This operation does not inherit options from the Db or MongoClient.
+ *
+ * @param newName - New name of of the collection.
+ * @param options - Optional settings for the command
+ */
+ async rename(newName, options) {
+ // Intentionally, we do not inherit options from parent for this operation.
+ return await (0, execute_operation_1.executeOperation)(this.client, new rename_1.RenameOperation(this, newName, (0, utils_1.resolveOptions)(undefined, {
+ ...options,
+ readPreference: read_preference_1.ReadPreference.PRIMARY
+ })));
+ }
+ /**
+ * Drop the collection from the database, removing it permanently. New accesses will create a new collection.
+ *
+ * @param options - Optional settings for the command
+ */
+ async drop(options) {
+ return await this.db.dropCollection(this.collectionName, options);
+ }
+ async findOne(filter = {}, options = {}) {
+ // Explicitly set the limit to 1 and singleBatch to true for all commands, per the spec.
+ // noCursorTimeout must be unset as well as batchSize.
+ // See: https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#findone-api-details
+ const { ...opts } = options;
+ opts.singleBatch = true;
+ const cursor = this.find(filter, opts).limit(1);
+ const result = await cursor.next();
+ await cursor.close();
+ return result;
+ }
+ find(filter = {}, options = {}) {
+ return new find_cursor_1.FindCursor(this.client, this.s.namespace, filter, (0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * Returns the options of the collection.
+ *
+ * @param options - Optional settings for the command
+ */
+ async options(options) {
+ options = (0, utils_1.resolveOptions)(this, options);
+ const [collection] = await this.db
+ .listCollections({ name: this.collectionName }, { ...options, nameOnly: false })
+ .toArray();
+ if (collection == null || collection.options == null) {
+ throw new error_1.MongoAPIError(`collection ${this.namespace} not found`);
+ }
+ return collection.options;
+ }
+ /**
+ * Returns if the collection is a capped collection
+ *
+ * @param options - Optional settings for the command
+ */
+ async isCapped(options) {
+ const { capped } = await this.options(options);
+ return Boolean(capped);
+ }
+ /**
+ * Creates an index on the db and collection collection.
+ *
+ * @param indexSpec - The field name or index specification to create an index for
+ * @param options - Optional settings for the command
+ *
+ * @example
+ * ```ts
+ * const collection = client.db('foo').collection('bar');
+ *
+ * await collection.createIndex({ a: 1, b: -1 });
+ *
+ * // Alternate syntax for { c: 1, d: -1 } that ensures order of indexes
+ * await collection.createIndex([ [c, 1], [d, -1] ]);
+ *
+ * // Equivalent to { e: 1 }
+ * await collection.createIndex('e');
+ *
+ * // Equivalent to { f: 1, g: 1 }
+ * await collection.createIndex(['f', 'g'])
+ *
+ * // Equivalent to { h: 1, i: -1 }
+ * await collection.createIndex([ { h: 1 }, { i: -1 } ]);
+ *
+ * // Equivalent to { j: 1, k: -1, l: 2d }
+ * await collection.createIndex(['j', ['k', -1], { l: '2d' }])
+ * ```
+ */
+ async createIndex(indexSpec, options) {
+ const indexes = await (0, execute_operation_1.executeOperation)(this.client, indexes_1.CreateIndexesOperation.fromIndexSpecification(this, this.collectionName, indexSpec, (0, utils_1.resolveOptions)(this, options)));
+ return indexes[0];
+ }
+ /**
+ * Creates multiple indexes in the collection, this method is only supported for
+ * MongoDB 2.6 or higher. Earlier version of MongoDB will throw a command not supported
+ * error.
+ *
+ * **Note**: Unlike {@link Collection#createIndex| createIndex}, this function takes in raw index specifications.
+ * Index specifications are defined {@link https://www.mongodb.com/docs/manual/reference/command/createIndexes/| here}.
+ *
+ * @param indexSpecs - An array of index specifications to be created
+ * @param options - Optional settings for the command
+ *
+ * @example
+ * ```ts
+ * const collection = client.db('foo').collection('bar');
+ * await collection.createIndexes([
+ * // Simple index on field fizz
+ * {
+ * key: { fizz: 1 },
+ * }
+ * // wildcard index
+ * {
+ * key: { '$**': 1 }
+ * },
+ * // named index on darmok and jalad
+ * {
+ * key: { darmok: 1, jalad: -1 }
+ * name: 'tanagra'
+ * }
+ * ]);
+ * ```
+ */
+ async createIndexes(indexSpecs, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, indexes_1.CreateIndexesOperation.fromIndexDescriptionArray(this, this.collectionName, indexSpecs, (0, utils_1.resolveOptions)(this, { ...options, maxTimeMS: undefined })));
+ }
+ /**
+ * Drops an index from this collection.
+ *
+ * @param indexName - Name of the index to drop.
+ * @param options - Optional settings for the command
+ */
+ async dropIndex(indexName, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new indexes_1.DropIndexOperation(this, indexName, {
+ ...(0, utils_1.resolveOptions)(this, options),
+ readPreference: read_preference_1.ReadPreference.primary
+ }));
+ }
+ /**
+ * Drops all indexes from this collection.
+ *
+ * @param options - Optional settings for the command
+ */
+ async dropIndexes(options) {
+ try {
+ await (0, execute_operation_1.executeOperation)(this.client, new indexes_1.DropIndexOperation(this, '*', (0, utils_1.resolveOptions)(this, options)));
+ return true;
+ }
+ catch (error) {
+ // TODO(NODE-6517): Driver should only filter for namespace not found error. Other errors should be thrown.
+ if (error instanceof error_1.MongoOperationTimeoutError)
+ throw error;
+ return false;
+ }
+ }
+ /**
+ * Get the list of all indexes information for the collection.
+ *
+ * @param options - Optional settings for the command
+ */
+ listIndexes(options) {
+ return new list_indexes_cursor_1.ListIndexesCursor(this, (0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * Checks if one or more indexes exist on the collection, fails on first non-existing index
+ *
+ * @param indexes - One or more index names to check.
+ * @param options - Optional settings for the command
+ */
+ async indexExists(indexes, options) {
+ const indexNames = Array.isArray(indexes) ? indexes : [indexes];
+ const allIndexes = new Set(await this.listIndexes(options)
+ .map(({ name }) => name)
+ .toArray());
+ return indexNames.every(name => allIndexes.has(name));
+ }
+ async indexInformation(options) {
+ return await this.indexes({
+ ...options,
+ full: options?.full ?? false
+ });
+ }
+ /**
+ * Gets an estimate of the count of documents in a collection using collection metadata.
+ * This will always run a count command on all server versions.
+ *
+ * due to an oversight in versions 5.0.0-5.0.8 of MongoDB, the count command,
+ * which estimatedDocumentCount uses in its implementation, was not included in v1 of
+ * the Stable API, and so users of the Stable API with estimatedDocumentCount are
+ * recommended to upgrade their server version to 5.0.9+ or set apiStrict: false to avoid
+ * encountering errors.
+ *
+ * @see {@link https://www.mongodb.com/docs/manual/reference/command/count/#behavior|Count: Behavior}
+ * @param options - Optional settings for the command
+ */
+ async estimatedDocumentCount(options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new estimated_document_count_1.EstimatedDocumentCountOperation(this, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Gets the number of documents matching the filter.
+ * For a fast count of the total documents in a collection see {@link Collection#estimatedDocumentCount| estimatedDocumentCount}.
+ *
+ * Due to countDocuments using the $match aggregation pipeline stage, certain query operators cannot be used in countDocuments. This includes the $where and $near query operators, among others. Details can be found in the documentation for the $match aggregation pipeline stage.
+ *
+ * **Note**: When migrating from {@link Collection#count| count} to {@link Collection#countDocuments| countDocuments}
+ * the following query operators must be replaced:
+ *
+ * | Operator | Replacement |
+ * | -------- | ----------- |
+ * | `$where` | [`$expr`][1] |
+ * | `$near` | [`$geoWithin`][2] with [`$center`][3] |
+ * | `$nearSphere` | [`$geoWithin`][2] with [`$centerSphere`][4] |
+ *
+ * [1]: https://www.mongodb.com/docs/manual/reference/operator/query/expr/
+ * [2]: https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/
+ * [3]: https://www.mongodb.com/docs/manual/reference/operator/query/center/#op._S_center
+ * [4]: https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/#op._S_centerSphere
+ *
+ * @param filter - The filter for the count
+ * @param options - Optional settings for the command
+ *
+ * @see https://www.mongodb.com/docs/manual/reference/operator/query/expr/
+ * @see https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/
+ * @see https://www.mongodb.com/docs/manual/reference/operator/query/center/#op._S_center
+ * @see https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/#op._S_centerSphere
+ */
+ async countDocuments(filter = {}, options = {}) {
+ const pipeline = [];
+ pipeline.push({ $match: filter });
+ if (typeof options.skip === 'number') {
+ pipeline.push({ $skip: options.skip });
+ }
+ if (typeof options.limit === 'number') {
+ pipeline.push({ $limit: options.limit });
+ }
+ pipeline.push({ $group: { _id: 1, n: { $sum: 1 } } });
+ const cursor = this.aggregate(pipeline, options);
+ const doc = await cursor.next();
+ await cursor.close();
+ return doc?.n ?? 0;
+ }
+ async distinct(key, filter = {}, options = {}) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new distinct_1.DistinctOperation(this, key, filter, (0, utils_1.resolveOptions)(this, options)));
+ }
+ async indexes(options) {
+ const indexes = await this.listIndexes(options).toArray();
+ const full = options?.full ?? true;
+ if (full) {
+ return indexes;
+ }
+ const object = Object.fromEntries(indexes.map(({ name, key }) => [name, Object.entries(key)]));
+ return object;
+ }
+ async findOneAndDelete(filter, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new find_and_modify_1.FindOneAndDeleteOperation(this, filter, (0, utils_1.resolveOptions)(this, options)));
+ }
+ async findOneAndReplace(filter, replacement, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new find_and_modify_1.FindOneAndReplaceOperation(this, filter, replacement, (0, utils_1.resolveOptions)(this, options)));
+ }
+ async findOneAndUpdate(filter, update, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new find_and_modify_1.FindOneAndUpdateOperation(this, filter, update, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Execute an aggregation framework pipeline against the collection, needs MongoDB \>= 2.2
+ *
+ * @param pipeline - An array of aggregation pipelines to execute
+ * @param options - Optional settings for the command
+ */
+ aggregate(pipeline = [], options) {
+ if (!Array.isArray(pipeline)) {
+ throw new error_1.MongoInvalidArgumentError('Argument "pipeline" must be an array of aggregation stages');
+ }
+ return new aggregation_cursor_1.AggregationCursor(this.client, this.s.namespace, pipeline, (0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this collection.
+ *
+ * @remarks
+ * watch() accepts two generic arguments for distinct use cases:
+ * - The first is to override the schema that may be defined for this specific collection
+ * - The second is to override the shape of the change stream document entirely, if it is not provided the type will default to ChangeStreamDocument of the first argument
+ * @example
+ * By just providing the first argument I can type the change to be `ChangeStreamDocument<{ _id: number }>`
+ * ```ts
+ * collection.watch<{ _id: number }>()
+ * .on('change', change => console.log(change._id.toFixed(4)));
+ * ```
+ *
+ * @example
+ * Passing a second argument provides a way to reflect the type changes caused by an advanced pipeline.
+ * Here, we are using a pipeline to have MongoDB filter for insert changes only and add a comment.
+ * No need start from scratch on the ChangeStreamInsertDocument type!
+ * By using an intersection we can save time and ensure defaults remain the same type!
+ * ```ts
+ * collection
+ * .watch & { comment: string }>([
+ * { $addFields: { comment: 'big changes' } },
+ * { $match: { operationType: 'insert' } }
+ * ])
+ * .on('change', change => {
+ * change.comment.startsWith('big');
+ * change.operationType === 'insert';
+ * // No need to narrow in code because the generics did that for us!
+ * expectType(change.fullDocument);
+ * });
+ * ```
+ *
+ * @remarks
+ * When `timeoutMS` is configured for a change stream, it will have different behaviour depending
+ * on whether the change stream is in iterator mode or emitter mode. In both cases, a change
+ * stream will time out if it does not receive a change event within `timeoutMS` of the last change
+ * event.
+ *
+ * Note that if a change stream is consistently timing out when watching a collection, database or
+ * client that is being changed, then this may be due to the server timing out before it can finish
+ * processing the existing oplog. To address this, restart the change stream with a higher
+ * `timeoutMS`.
+ *
+ * If the change stream times out the initial aggregate operation to establish the change stream on
+ * the server, then the client will close the change stream. If the getMore calls to the server
+ * time out, then the change stream will be left open, but will throw a MongoOperationTimeoutError
+ * when in iterator mode and emit an error event that returns a MongoOperationTimeoutError in
+ * emitter mode.
+ *
+ * To determine whether or not the change stream is still open following a timeout, check the
+ * {@link ChangeStream.closed} getter.
+ *
+ * @example
+ * In iterator mode, if a next() call throws a timeout error, it will attempt to resume the change stream.
+ * The next call can just be retried after this succeeds.
+ * ```ts
+ * const changeStream = collection.watch([], { timeoutMS: 100 });
+ * try {
+ * await changeStream.next();
+ * } catch (e) {
+ * if (e instanceof MongoOperationTimeoutError && !changeStream.closed) {
+ * await changeStream.next();
+ * }
+ * throw e;
+ * }
+ * ```
+ *
+ * @example
+ * In emitter mode, if the change stream goes `timeoutMS` without emitting a change event, it will
+ * emit an error event that returns a MongoOperationTimeoutError, but will not close the change
+ * stream unless the resume attempt fails. There is no need to re-establish change listeners as
+ * this will automatically continue emitting change events once the resume attempt completes.
+ *
+ * ```ts
+ * const changeStream = collection.watch([], { timeoutMS: 100 });
+ * changeStream.on('change', console.log);
+ * changeStream.on('error', e => {
+ * if (e instanceof MongoOperationTimeoutError && !changeStream.closed) {
+ * // do nothing
+ * } else {
+ * changeStream.close();
+ * }
+ * });
+ * ```
+ *
+ * @param pipeline - An array of {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/|aggregation pipeline stages} through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.
+ * @param options - Optional settings for the command
+ * @typeParam TLocal - Type of the data being detected by the change stream
+ * @typeParam TChange - Type of the whole change stream document emitted
+ */
+ watch(pipeline = [], options = {}) {
+ // Allow optionally not specifying a pipeline
+ if (!Array.isArray(pipeline)) {
+ options = pipeline;
+ pipeline = [];
+ }
+ return new change_stream_1.ChangeStream(this, pipeline, (0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * Initiate an Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order.
+ *
+ * @throws MongoNotConnectedError
+ * @remarks
+ * **NOTE:** MongoClient must be connected prior to calling this method due to a known limitation in this legacy implementation.
+ * However, `collection.bulkWrite()` provides an equivalent API that does not require prior connecting.
+ */
+ initializeUnorderedBulkOp(options) {
+ return new unordered_1.UnorderedBulkOperation(this, (0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * Initiate an In order bulk write operation. Operations will be serially executed in the order they are added, creating a new operation for each switch in types.
+ *
+ * @throws MongoNotConnectedError
+ * @remarks
+ * **NOTE:** MongoClient must be connected prior to calling this method due to a known limitation in this legacy implementation.
+ * However, `collection.bulkWrite()` provides an equivalent API that does not require prior connecting.
+ */
+ initializeOrderedBulkOp(options) {
+ return new ordered_1.OrderedBulkOperation(this, (0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * An estimated count of matching documents in the db to a filter.
+ *
+ * **NOTE:** This method has been deprecated, since it does not provide an accurate count of the documents
+ * in a collection. To obtain an accurate count of documents in the collection, use {@link Collection#countDocuments| countDocuments}.
+ * To obtain an estimated count of all documents in the collection, use {@link Collection#estimatedDocumentCount| estimatedDocumentCount}.
+ *
+ * @deprecated use {@link Collection#countDocuments| countDocuments} or {@link Collection#estimatedDocumentCount| estimatedDocumentCount} instead
+ *
+ * @param filter - The filter for the count.
+ * @param options - Optional settings for the command
+ */
+ async count(filter = {}, options = {}) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new count_1.CountOperation(this.fullNamespace, filter, (0, utils_1.resolveOptions)(this, options)));
+ }
+ listSearchIndexes(indexNameOrOptions, options) {
+ options =
+ typeof indexNameOrOptions === 'object' ? indexNameOrOptions : options == null ? {} : options;
+ const indexName = indexNameOrOptions == null
+ ? null
+ : typeof indexNameOrOptions === 'object'
+ ? null
+ : indexNameOrOptions;
+ return new list_search_indexes_cursor_1.ListSearchIndexesCursor(this, indexName, options);
+ }
+ /**
+ * Creates a single search index for the collection.
+ *
+ * @param description - The index description for the new search index.
+ * @returns A promise that resolves to the name of the new search index.
+ *
+ * @remarks Only available when used against a 7.0+ Atlas cluster.
+ */
+ async createSearchIndex(description) {
+ const [index] = await this.createSearchIndexes([description]);
+ return index;
+ }
+ /**
+ * Creates multiple search indexes for the current collection.
+ *
+ * @param descriptions - An array of `SearchIndexDescription`s for the new search indexes.
+ * @returns A promise that resolves to an array of the newly created search index names.
+ *
+ * @remarks Only available when used against a 7.0+ Atlas cluster.
+ * @returns
+ */
+ async createSearchIndexes(descriptions) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new create_1.CreateSearchIndexesOperation(this, descriptions));
+ }
+ /**
+ * Deletes a search index by index name.
+ *
+ * @param name - The name of the search index to be deleted.
+ *
+ * @remarks Only available when used against a 7.0+ Atlas cluster.
+ */
+ async dropSearchIndex(name) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new drop_1.DropSearchIndexOperation(this, name));
+ }
+ /**
+ * Updates a search index by replacing the existing index definition with the provided definition.
+ *
+ * @param name - The name of the search index to update.
+ * @param definition - The new search index definition.
+ *
+ * @remarks Only available when used against a 7.0+ Atlas cluster.
+ */
+ async updateSearchIndex(name, definition) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new update_1.UpdateSearchIndexOperation(this, name, definition));
+ }
+}
+exports.Collection = Collection;
+//# sourceMappingURL=collection.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/collection.js.map b/node_modules/mongodb/lib/collection.js.map
new file mode 100644
index 00000000..8a3a4b31
--- /dev/null
+++ b/node_modules/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AAsB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,iBAAiB,CAAC,WAAmC;QACzD,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,mBAAmB,CAAC,YAAsC;QAC9D,OAAO,MAAM,IAAA,oCAAgB,EAC3B,IAAI,CAAC,MAAM,EACX,IAAI,qCAA4B,CAAC,IAAsB,EAAE,YAAY,CAAC,CACvE,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAC,IAAY;QAChC,OAAO,MAAM,IAAA,oCAAgB,EAC3B,IAAI,CAAC,MAAM,EACX,IAAI,+BAAwB,CAAC,IAAsB,EAAE,IAAI,CAAC,CAC3D,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,iBAAiB,CAAC,IAAY,EAAE,UAAoB;QACxD,OAAO,MAAM,IAAA,oCAAgB,EAC3B,IAAI,CAAC,MAAM,EACX,IAAI,mCAA0B,CAAC,IAAsB,EAAE,IAAI,EAAE,UAAU,CAAC,CACzE,CAAC;IACJ,CAAC;CACF;AA1nCD,gCA0nCC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/connection_string.js b/node_modules/mongodb/lib/connection_string.js
new file mode 100644
index 00000000..eb01cc96
--- /dev/null
+++ b/node_modules/mongodb/lib/connection_string.js
@@ -0,0 +1,1106 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.DEFAULT_OPTIONS = exports.OPTIONS = void 0;
+exports.resolveSRVRecord = resolveSRVRecord;
+exports.parseOptions = parseOptions;
+const dns = require("dns");
+const mongodb_connection_string_url_1 = require("mongodb-connection-string-url");
+const process = require("process");
+const url_1 = require("url");
+const mongo_credentials_1 = require("./cmap/auth/mongo_credentials");
+const providers_1 = require("./cmap/auth/providers");
+const compression_1 = require("./cmap/wire_protocol/compression");
+const encrypter_1 = require("./encrypter");
+const error_1 = require("./error");
+const mongo_client_1 = require("./mongo_client");
+const mongo_logger_1 = require("./mongo_logger");
+const read_concern_1 = require("./read_concern");
+const read_preference_1 = require("./read_preference");
+const runtime_adapters_1 = require("./runtime_adapters");
+const monitor_1 = require("./sdam/monitor");
+const utils_1 = require("./utils");
+const write_concern_1 = require("./write_concern");
+const VALID_TXT_RECORDS = ['authSource', 'replicaSet', 'loadBalanced'];
+const LB_SINGLE_HOST_ERROR = 'loadBalanced option only supported with a single host in the URI';
+const LB_REPLICA_SET_ERROR = 'loadBalanced option not supported with a replicaSet option';
+const LB_DIRECT_CONNECTION_ERROR = 'loadBalanced option not supported when directConnection is provided';
+function retryDNSTimeoutFor(rrtype) {
+ const resolve = rrtype === 'SRV'
+ ? (address) => dns.promises.resolve(address, 'SRV')
+ : (address) => dns.promises.resolve(address, 'TXT');
+ return async function dnsReqRetryTimeout(lookupAddress) {
+ try {
+ return await resolve(lookupAddress);
+ }
+ catch (firstDNSError) {
+ if (firstDNSError.code === dns.TIMEOUT) {
+ return await resolve(lookupAddress);
+ }
+ else {
+ throw firstDNSError;
+ }
+ }
+ };
+}
+const resolveSrv = retryDNSTimeoutFor('SRV');
+const resolveTxt = retryDNSTimeoutFor('TXT');
+/**
+ * Lookup a `mongodb+srv` connection string, combine the parts and reparse it as a normal
+ * connection string.
+ *
+ * @param uri - The connection string to parse
+ * @param options - Optional user provided connection string options
+ */
+async function resolveSRVRecord(options) {
+ if (typeof options.srvHost !== 'string') {
+ throw new error_1.MongoAPIError('Option "srvHost" must not be empty');
+ }
+ // Asynchronously start TXT resolution so that we do not have to wait until
+ // the SRV record is resolved before starting a second DNS query.
+ const lookupAddress = options.srvHost;
+ const txtResolutionPromise = resolveTxt(lookupAddress);
+ txtResolutionPromise.then(undefined, utils_1.squashError); // rejections will be handled later
+ const hostname = `_${options.srvServiceName}._tcp.${lookupAddress}`;
+ // Resolve the SRV record and use the result as the list of hosts to connect to.
+ const addresses = await resolveSrv(hostname);
+ if (addresses.length === 0) {
+ throw new error_1.MongoAPIError('No addresses found at host');
+ }
+ for (const { name } of addresses) {
+ (0, utils_1.checkParentDomainMatch)(name, lookupAddress);
+ }
+ const hostAddresses = addresses.map(r => utils_1.HostAddress.fromString(`${r.name}:${r.port ?? 27017}`));
+ validateLoadBalancedOptions(hostAddresses, options, true);
+ // Use the result of resolving the TXT record and add options from there if they exist.
+ let record;
+ try {
+ record = await txtResolutionPromise;
+ }
+ catch (error) {
+ if (error.code !== 'ENODATA' && error.code !== 'ENOTFOUND') {
+ throw error;
+ }
+ return hostAddresses;
+ }
+ if (record.length > 1) {
+ throw new error_1.MongoParseError('Multiple text records not allowed');
+ }
+ const txtRecordOptions = new url_1.URLSearchParams(record[0].join(''));
+ const txtRecordOptionKeys = [...txtRecordOptions.keys()];
+ if (txtRecordOptionKeys.some(key => !VALID_TXT_RECORDS.includes(key))) {
+ throw new error_1.MongoParseError(`Text record may only set any of: ${VALID_TXT_RECORDS.join(', ')}`);
+ }
+ if (VALID_TXT_RECORDS.some(option => txtRecordOptions.get(option) === '')) {
+ throw new error_1.MongoParseError('Cannot have empty URI params in DNS TXT Record');
+ }
+ const source = txtRecordOptions.get('authSource') ?? undefined;
+ const replicaSet = txtRecordOptions.get('replicaSet') ?? undefined;
+ const loadBalanced = txtRecordOptions.get('loadBalanced') ?? undefined;
+ if (!options.userSpecifiedAuthSource &&
+ source &&
+ options.credentials &&
+ !providers_1.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(options.credentials.mechanism)) {
+ options.credentials = mongo_credentials_1.MongoCredentials.merge(options.credentials, { source });
+ }
+ if (!options.userSpecifiedReplicaSet && replicaSet) {
+ options.replicaSet = replicaSet;
+ }
+ if (loadBalanced === 'true') {
+ options.loadBalanced = true;
+ }
+ if (options.replicaSet && options.srvMaxHosts > 0) {
+ throw new error_1.MongoParseError('Cannot combine replicaSet option with srvMaxHosts');
+ }
+ validateLoadBalancedOptions(hostAddresses, options, true);
+ return hostAddresses;
+}
+/**
+ * Checks if TLS options are valid
+ *
+ * @param allOptions - All options provided by user or included in default options map
+ * @throws MongoAPIError if TLS options are invalid
+ */
+function checkTLSOptions(allOptions) {
+ if (!allOptions)
+ return;
+ const check = (a, b) => {
+ if (allOptions.has(a) && allOptions.has(b)) {
+ throw new error_1.MongoAPIError(`The '${a}' option cannot be used with the '${b}' option`);
+ }
+ };
+ check('tlsInsecure', 'tlsAllowInvalidCertificates');
+ check('tlsInsecure', 'tlsAllowInvalidHostnames');
+}
+function getBoolean(name, value) {
+ if (typeof value === 'boolean')
+ return value;
+ switch (value) {
+ case 'true':
+ return true;
+ case 'false':
+ return false;
+ default:
+ throw new error_1.MongoParseError(`${name} must be either "true" or "false"`);
+ }
+}
+function getIntFromOptions(name, value) {
+ const parsedInt = (0, utils_1.parseInteger)(value);
+ if (parsedInt != null) {
+ return parsedInt;
+ }
+ throw new error_1.MongoParseError(`Expected ${name} to be stringified int value, got: ${value}`);
+}
+function getUIntFromOptions(name, value) {
+ const parsedValue = getIntFromOptions(name, value);
+ if (parsedValue < 0) {
+ throw new error_1.MongoParseError(`${name} can only be a positive int value, got: ${value}`);
+ }
+ return parsedValue;
+}
+function* entriesFromString(value) {
+ if (value === '') {
+ return;
+ }
+ const keyValuePairs = value.split(',');
+ for (const keyValue of keyValuePairs) {
+ const [key, value] = keyValue.split(/:(.*)/);
+ if (value == null) {
+ throw new error_1.MongoParseError('Cannot have undefined values in key value pairs');
+ }
+ yield [key, value];
+ }
+}
+class CaseInsensitiveMap extends Map {
+ constructor(entries = []) {
+ super(entries.map(([k, v]) => [k.toLowerCase(), v]));
+ }
+ has(k) {
+ return super.has(k.toLowerCase());
+ }
+ get(k) {
+ return super.get(k.toLowerCase());
+ }
+ set(k, v) {
+ return super.set(k.toLowerCase(), v);
+ }
+ delete(k) {
+ return super.delete(k.toLowerCase());
+ }
+}
+function parseOptions(uri, mongoClient = undefined, options = {}) {
+ if (mongoClient != null && !(mongoClient instanceof mongo_client_1.MongoClient)) {
+ options = mongoClient;
+ mongoClient = undefined;
+ }
+ // validate BSONOptions
+ if (options.useBigInt64 && typeof options.promoteLongs === 'boolean' && !options.promoteLongs) {
+ throw new error_1.MongoAPIError('Must request either bigint or Long for int64 deserialization');
+ }
+ if (options.useBigInt64 && typeof options.promoteValues === 'boolean' && !options.promoteValues) {
+ throw new error_1.MongoAPIError('Must request either bigint or Long for int64 deserialization');
+ }
+ const url = new mongodb_connection_string_url_1.default(uri);
+ const { hosts, isSRV } = url;
+ const mongoOptions = Object.create(null);
+ mongoOptions.hosts = isSRV ? [] : hosts.map(utils_1.HostAddress.fromString);
+ const urlOptions = new CaseInsensitiveMap();
+ if (url.pathname !== '/' && url.pathname !== '') {
+ const dbName = decodeURIComponent(url.pathname[0] === '/' ? url.pathname.slice(1) : url.pathname);
+ if (dbName) {
+ urlOptions.set('dbName', [dbName]);
+ }
+ }
+ if (url.username !== '') {
+ const auth = {
+ username: decodeURIComponent(url.username)
+ };
+ if (typeof url.password === 'string') {
+ auth.password = decodeURIComponent(url.password);
+ }
+ urlOptions.set('auth', [auth]);
+ }
+ for (const key of url.searchParams.keys()) {
+ const values = url.searchParams.getAll(key);
+ const isReadPreferenceTags = /readPreferenceTags/i.test(key);
+ if (!isReadPreferenceTags && values.length > 1) {
+ throw new error_1.MongoInvalidArgumentError(`URI option "${key}" cannot appear more than once in the connection string`);
+ }
+ if (!isReadPreferenceTags && values.includes('')) {
+ throw new error_1.MongoAPIError(`URI option "${key}" cannot be specified with no value`);
+ }
+ if (!urlOptions.has(key)) {
+ urlOptions.set(key, values);
+ }
+ }
+ const objectOptions = new CaseInsensitiveMap(Object.entries(options).filter(([, v]) => v != null));
+ // Validate options that can only be provided by one of uri or object
+ if (urlOptions.has('serverApi')) {
+ throw new error_1.MongoParseError('URI cannot contain `serverApi`, it can only be passed to the client');
+ }
+ const uriMechanismProperties = urlOptions.get('authMechanismProperties');
+ if (uriMechanismProperties) {
+ for (const property of uriMechanismProperties) {
+ if (/(^|,)ALLOWED_HOSTS:/.test(property)) {
+ throw new error_1.MongoParseError('Auth mechanism property ALLOWED_HOSTS is not allowed in the connection string.');
+ }
+ }
+ }
+ if (objectOptions.has('loadBalanced')) {
+ throw new error_1.MongoParseError('loadBalanced is only a valid option in the URI');
+ }
+ // All option collection
+ const allProvidedOptions = new CaseInsensitiveMap();
+ const allProvidedKeys = new Set([...urlOptions.keys(), ...objectOptions.keys()]);
+ for (const key of allProvidedKeys) {
+ const values = [];
+ const objectOptionValue = objectOptions.get(key);
+ if (objectOptionValue != null) {
+ values.push(objectOptionValue);
+ }
+ const urlValues = urlOptions.get(key) ?? [];
+ values.push(...urlValues);
+ allProvidedOptions.set(key, values);
+ }
+ if (allProvidedOptions.has('tls') || allProvidedOptions.has('ssl')) {
+ const tlsAndSslOpts = (allProvidedOptions.get('tls') || [])
+ .concat(allProvidedOptions.get('ssl') || [])
+ .map(getBoolean.bind(null, 'tls/ssl'));
+ if (new Set(tlsAndSslOpts).size !== 1) {
+ throw new error_1.MongoParseError('All values of tls/ssl must be the same.');
+ }
+ }
+ checkTLSOptions(allProvidedOptions);
+ const unsupportedOptions = (0, utils_1.setDifference)(allProvidedKeys, Array.from(Object.keys(exports.OPTIONS)).map(s => s.toLowerCase()));
+ if (unsupportedOptions.size !== 0) {
+ const optionWord = unsupportedOptions.size > 1 ? 'options' : 'option';
+ const isOrAre = unsupportedOptions.size > 1 ? 'are' : 'is';
+ throw new error_1.MongoParseError(`${optionWord} ${Array.from(unsupportedOptions).join(', ')} ${isOrAre} not supported`);
+ }
+ // Option parsing and setting
+ for (const [key, descriptor] of Object.entries(exports.OPTIONS)) {
+ const values = allProvidedOptions.get(key);
+ if (!values || values.length === 0) {
+ if (exports.DEFAULT_OPTIONS.has(key)) {
+ setOption(mongoOptions, key, descriptor, [exports.DEFAULT_OPTIONS.get(key)]);
+ }
+ }
+ else {
+ const { deprecated } = descriptor;
+ if (deprecated) {
+ const deprecatedMsg = typeof deprecated === 'string' ? `: ${deprecated}` : '';
+ (0, utils_1.emitWarning)(`${key} is a deprecated option${deprecatedMsg}`);
+ }
+ setOption(mongoOptions, key, descriptor, values);
+ }
+ }
+ if (mongoOptions.credentials) {
+ const isGssapi = mongoOptions.credentials.mechanism === providers_1.AuthMechanism.MONGODB_GSSAPI;
+ const isX509 = mongoOptions.credentials.mechanism === providers_1.AuthMechanism.MONGODB_X509;
+ const isAws = mongoOptions.credentials.mechanism === providers_1.AuthMechanism.MONGODB_AWS;
+ const isOidc = mongoOptions.credentials.mechanism === providers_1.AuthMechanism.MONGODB_OIDC;
+ if ((isGssapi || isX509) &&
+ allProvidedOptions.has('authSource') &&
+ mongoOptions.credentials.source !== '$external') {
+ // If authSource was explicitly given and its incorrect, we error
+ throw new error_1.MongoParseError(`authMechanism ${mongoOptions.credentials.mechanism} requires an authSource of '$external'`);
+ }
+ if (!(isGssapi || isX509 || isAws || isOidc) &&
+ mongoOptions.dbName &&
+ !allProvidedOptions.has('authSource')) {
+ // inherit the dbName unless GSSAPI or X509, then silently ignore dbName
+ // and there was no specific authSource given
+ mongoOptions.credentials = mongo_credentials_1.MongoCredentials.merge(mongoOptions.credentials, {
+ source: mongoOptions.dbName
+ });
+ }
+ if (isAws) {
+ const { username, password } = mongoOptions.credentials;
+ if (username || password) {
+ throw new error_1.MongoAPIError('username and password cannot be provided when using MONGODB-AWS. Credentials must be provided in a manner that can be read by the AWS SDK.');
+ }
+ if (mongoOptions.credentials.mechanismProperties.AWS_SESSION_TOKEN) {
+ throw new error_1.MongoAPIError('AWS_SESSION_TOKEN cannot be provided when using MONGODB-AWS. Credentials must be provided in a manner that can be read by the AWS SDK.');
+ }
+ }
+ mongoOptions.credentials.validate();
+ // Check if the only auth related option provided was authSource, if so we can remove credentials
+ if (mongoOptions.credentials.password === '' &&
+ mongoOptions.credentials.username === '' &&
+ mongoOptions.credentials.mechanism === providers_1.AuthMechanism.MONGODB_DEFAULT &&
+ Object.keys(mongoOptions.credentials.mechanismProperties).length === 0) {
+ delete mongoOptions.credentials;
+ }
+ }
+ if (!mongoOptions.dbName) {
+ // dbName default is applied here because of the credential validation above
+ mongoOptions.dbName = 'test';
+ }
+ validateLoadBalancedOptions(hosts, mongoOptions, isSRV);
+ if (mongoClient && mongoOptions.autoEncryption) {
+ encrypter_1.Encrypter.checkForMongoCrypt();
+ mongoOptions.encrypter = new encrypter_1.Encrypter(mongoClient, uri, options);
+ mongoOptions.autoEncrypter = mongoOptions.encrypter.autoEncrypter;
+ }
+ // Potential SRV Overrides and SRV connection string validations
+ mongoOptions.userSpecifiedAuthSource =
+ objectOptions.has('authSource') || urlOptions.has('authSource');
+ mongoOptions.userSpecifiedReplicaSet =
+ objectOptions.has('replicaSet') || urlOptions.has('replicaSet');
+ if (isSRV) {
+ // SRV Record is resolved upon connecting
+ mongoOptions.srvHost = hosts[0];
+ if (mongoOptions.directConnection) {
+ throw new error_1.MongoAPIError('SRV URI does not support directConnection');
+ }
+ if (mongoOptions.srvMaxHosts > 0 && typeof mongoOptions.replicaSet === 'string') {
+ throw new error_1.MongoParseError('Cannot use srvMaxHosts option with replicaSet');
+ }
+ // SRV turns on TLS by default, but users can override and turn it off
+ const noUserSpecifiedTLS = !objectOptions.has('tls') && !urlOptions.has('tls');
+ const noUserSpecifiedSSL = !objectOptions.has('ssl') && !urlOptions.has('ssl');
+ if (noUserSpecifiedTLS && noUserSpecifiedSSL) {
+ mongoOptions.tls = true;
+ }
+ }
+ else {
+ const userSpecifiedSrvOptions = urlOptions.has('srvMaxHosts') ||
+ objectOptions.has('srvMaxHosts') ||
+ urlOptions.has('srvServiceName') ||
+ objectOptions.has('srvServiceName');
+ if (userSpecifiedSrvOptions) {
+ throw new error_1.MongoParseError('Cannot use srvMaxHosts or srvServiceName with a non-srv connection string');
+ }
+ }
+ if (mongoOptions.directConnection && mongoOptions.hosts.length !== 1) {
+ throw new error_1.MongoParseError('directConnection option requires exactly one host');
+ }
+ if (!mongoOptions.proxyHost &&
+ (mongoOptions.proxyPort || mongoOptions.proxyUsername || mongoOptions.proxyPassword)) {
+ throw new error_1.MongoParseError('Must specify proxyHost if other proxy options are passed');
+ }
+ if ((mongoOptions.proxyUsername && !mongoOptions.proxyPassword) ||
+ (!mongoOptions.proxyUsername && mongoOptions.proxyPassword)) {
+ throw new error_1.MongoParseError('Can only specify both of proxy username/password or neither');
+ }
+ const proxyOptions = ['proxyHost', 'proxyPort', 'proxyUsername', 'proxyPassword'].map(key => urlOptions.get(key) ?? []);
+ if (proxyOptions.some(options => options.length > 1)) {
+ throw new error_1.MongoParseError('Proxy options cannot be specified multiple times in the connection string');
+ }
+ mongoOptions.mongoLoggerOptions = mongo_logger_1.MongoLogger.resolveOptions({
+ MONGODB_LOG_COMMAND: process.env.MONGODB_LOG_COMMAND,
+ MONGODB_LOG_TOPOLOGY: process.env.MONGODB_LOG_TOPOLOGY,
+ MONGODB_LOG_SERVER_SELECTION: process.env.MONGODB_LOG_SERVER_SELECTION,
+ MONGODB_LOG_CONNECTION: process.env.MONGODB_LOG_CONNECTION,
+ MONGODB_LOG_CLIENT: process.env.MONGODB_LOG_CLIENT,
+ MONGODB_LOG_ALL: process.env.MONGODB_LOG_ALL,
+ MONGODB_LOG_MAX_DOCUMENT_LENGTH: process.env.MONGODB_LOG_MAX_DOCUMENT_LENGTH,
+ MONGODB_LOG_PATH: process.env.MONGODB_LOG_PATH
+ }, {
+ mongodbLogPath: mongoOptions.mongodbLogPath,
+ mongodbLogComponentSeverities: mongoOptions.mongodbLogComponentSeverities,
+ mongodbLogMaxDocumentLength: mongoOptions.mongodbLogMaxDocumentLength
+ });
+ mongoOptions.runtime = (0, runtime_adapters_1.resolveRuntimeAdapters)(options);
+ return mongoOptions;
+}
+/**
+ * #### Throws if LB mode is true:
+ * - hosts contains more than one host
+ * - there is a replicaSet name set
+ * - directConnection is set
+ * - if srvMaxHosts is used when an srv connection string is passed in
+ *
+ * @throws MongoParseError
+ */
+function validateLoadBalancedOptions(hosts, mongoOptions, isSrv) {
+ if (mongoOptions.loadBalanced) {
+ if (hosts.length > 1) {
+ throw new error_1.MongoParseError(LB_SINGLE_HOST_ERROR);
+ }
+ if (mongoOptions.replicaSet) {
+ throw new error_1.MongoParseError(LB_REPLICA_SET_ERROR);
+ }
+ if (mongoOptions.directConnection) {
+ throw new error_1.MongoParseError(LB_DIRECT_CONNECTION_ERROR);
+ }
+ if (isSrv && mongoOptions.srvMaxHosts > 0) {
+ throw new error_1.MongoParseError('Cannot limit srv hosts with loadBalanced enabled');
+ }
+ }
+ return;
+}
+function setOption(mongoOptions, key, descriptor, values) {
+ const { target, type, transform } = descriptor;
+ const name = target ?? key;
+ switch (type) {
+ case 'boolean':
+ mongoOptions[name] = getBoolean(name, values[0]);
+ break;
+ case 'int':
+ mongoOptions[name] = getIntFromOptions(name, values[0]);
+ break;
+ case 'uint':
+ mongoOptions[name] = getUIntFromOptions(name, values[0]);
+ break;
+ case 'string':
+ if (values[0] == null) {
+ break;
+ }
+ // The value should always be a string here, but since the array is typed as unknown
+ // there still needs to be an explicit cast.
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
+ mongoOptions[name] = String(values[0]);
+ break;
+ case 'record':
+ if (!(0, utils_1.isRecord)(values[0])) {
+ throw new error_1.MongoParseError(`${name} must be an object`);
+ }
+ mongoOptions[name] = values[0];
+ break;
+ case 'any':
+ mongoOptions[name] = values[0];
+ break;
+ default: {
+ if (!transform) {
+ throw new error_1.MongoParseError('Descriptors missing a type must define a transform');
+ }
+ const transformValue = transform({ name, options: mongoOptions, values });
+ mongoOptions[name] = transformValue;
+ break;
+ }
+ }
+}
+exports.OPTIONS = {
+ enableOverloadRetargeting: {
+ default: false,
+ type: 'boolean'
+ },
+ appName: {
+ type: 'string'
+ },
+ auth: {
+ target: 'credentials',
+ transform({ name, options, values: [value] }) {
+ if (!(0, utils_1.isRecord)(value, ['username', 'password'])) {
+ throw new error_1.MongoParseError(`${name} must be an object with 'username' and 'password' properties`);
+ }
+ return mongo_credentials_1.MongoCredentials.merge(options.credentials, {
+ username: value.username,
+ password: value.password
+ });
+ }
+ },
+ authMechanism: {
+ target: 'credentials',
+ transform({ options, values: [value] }) {
+ const mechanisms = Object.values(providers_1.AuthMechanism);
+ const [mechanism] = mechanisms.filter(m => m.match(RegExp(String.raw `\b${value}\b`, 'i')));
+ if (!mechanism) {
+ throw new error_1.MongoParseError(`authMechanism one of ${mechanisms}, got ${value}`);
+ }
+ let source = options.credentials?.source;
+ if (mechanism === providers_1.AuthMechanism.MONGODB_PLAIN ||
+ providers_1.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(mechanism)) {
+ // some mechanisms have '$external' as the Auth Source
+ source = '$external';
+ }
+ let password = options.credentials?.password;
+ if (mechanism === providers_1.AuthMechanism.MONGODB_X509 && password === '') {
+ password = undefined;
+ }
+ return mongo_credentials_1.MongoCredentials.merge(options.credentials, {
+ mechanism,
+ source,
+ password
+ });
+ }
+ },
+ // Note that if the authMechanismProperties contain a TOKEN_RESOURCE that has a
+ // comma in it, it MUST be supplied as a MongoClient option instead of in the
+ // connection string.
+ authMechanismProperties: {
+ target: 'credentials',
+ transform({ options, values }) {
+ // We can have a combination of options passed in the URI and options passed
+ // as an object to the MongoClient. So we must transform the string options
+ // as well as merge them together with a potentially provided object.
+ let mechanismProperties = Object.create(null);
+ for (const optionValue of values) {
+ if (typeof optionValue === 'string') {
+ for (const [key, value] of entriesFromString(optionValue)) {
+ try {
+ mechanismProperties[key] = getBoolean(key, value);
+ }
+ catch {
+ mechanismProperties[key] = value;
+ }
+ }
+ }
+ else {
+ if (!(0, utils_1.isRecord)(optionValue)) {
+ throw new error_1.MongoParseError('AuthMechanismProperties must be an object');
+ }
+ mechanismProperties = { ...optionValue };
+ }
+ }
+ return mongo_credentials_1.MongoCredentials.merge(options.credentials, {
+ mechanismProperties
+ });
+ }
+ },
+ authSource: {
+ target: 'credentials',
+ transform({ options, values: [value] }) {
+ const source = String(value);
+ return mongo_credentials_1.MongoCredentials.merge(options.credentials, { source });
+ }
+ },
+ autoEncryption: {
+ type: 'record'
+ },
+ autoSelectFamily: {
+ type: 'boolean',
+ default: true
+ },
+ autoSelectFamilyAttemptTimeout: {
+ type: 'uint'
+ },
+ bsonRegExp: {
+ type: 'boolean'
+ },
+ serverApi: {
+ target: 'serverApi',
+ transform({ values: [version] }) {
+ const serverApiToValidate = typeof version === 'string' ? { version } : version;
+ const versionToValidate = serverApiToValidate && serverApiToValidate.version;
+ if (!versionToValidate) {
+ throw new error_1.MongoParseError(`Invalid \`serverApi\` property; must specify a version from the following enum: ["${Object.values(mongo_client_1.ServerApiVersion).join('", "')}"]`);
+ }
+ if (!Object.values(mongo_client_1.ServerApiVersion).some(v => v === versionToValidate)) {
+ throw new error_1.MongoParseError(`Invalid server API version=${versionToValidate}; must be in the following enum: ["${Object.values(mongo_client_1.ServerApiVersion).join('", "')}"]`);
+ }
+ return serverApiToValidate;
+ }
+ },
+ checkKeys: {
+ type: 'boolean'
+ },
+ compressors: {
+ default: 'none',
+ target: 'compressors',
+ transform({ values }) {
+ const compressionList = new Set();
+ for (const compVal of values) {
+ const compValArray = typeof compVal === 'string' ? compVal.split(',') : compVal;
+ if (!Array.isArray(compValArray)) {
+ throw new error_1.MongoInvalidArgumentError('compressors must be an array or a comma-delimited list of strings');
+ }
+ for (const c of compValArray) {
+ if (Object.keys(compression_1.Compressor).includes(String(c))) {
+ compressionList.add(String(c));
+ }
+ else {
+ throw new error_1.MongoInvalidArgumentError(`${c} is not a valid compression mechanism. Must be one of: ${Object.keys(compression_1.Compressor)}.`);
+ }
+ }
+ }
+ return [...compressionList];
+ }
+ },
+ connectTimeoutMS: {
+ default: 30000,
+ type: 'uint'
+ },
+ dbName: {
+ type: 'string'
+ },
+ directConnection: {
+ default: false,
+ type: 'boolean'
+ },
+ driverInfo: {
+ default: {},
+ type: 'record'
+ },
+ enableUtf8Validation: { type: 'boolean', default: true },
+ family: {
+ transform({ name, values: [value] }) {
+ const transformValue = getIntFromOptions(name, value);
+ if (transformValue === 4 || transformValue === 6) {
+ return transformValue;
+ }
+ throw new error_1.MongoParseError(`Option 'family' must be 4 or 6 got ${transformValue}.`);
+ }
+ },
+ fieldsAsRaw: {
+ type: 'record'
+ },
+ forceServerObjectId: {
+ default: false,
+ type: 'boolean'
+ },
+ fsync: {
+ deprecated: 'Please use journal instead',
+ target: 'writeConcern',
+ transform({ name, options, values: [value] }) {
+ const wc = write_concern_1.WriteConcern.fromOptions({
+ writeConcern: {
+ ...options.writeConcern,
+ fsync: getBoolean(name, value)
+ }
+ });
+ if (!wc)
+ throw new error_1.MongoParseError(`Unable to make a writeConcern from fsync=${value}`);
+ return wc;
+ }
+ },
+ heartbeatFrequencyMS: {
+ default: 10000,
+ type: 'uint'
+ },
+ ignoreUndefined: {
+ type: 'boolean'
+ },
+ j: {
+ deprecated: 'Please use journal instead',
+ target: 'writeConcern',
+ transform({ name, options, values: [value] }) {
+ const wc = write_concern_1.WriteConcern.fromOptions({
+ writeConcern: {
+ ...options.writeConcern,
+ journal: getBoolean(name, value)
+ }
+ });
+ if (!wc)
+ throw new error_1.MongoParseError(`Unable to make a writeConcern from journal=${value}`);
+ return wc;
+ }
+ },
+ journal: {
+ target: 'writeConcern',
+ transform({ name, options, values: [value] }) {
+ const wc = write_concern_1.WriteConcern.fromOptions({
+ writeConcern: {
+ ...options.writeConcern,
+ journal: getBoolean(name, value)
+ }
+ });
+ if (!wc)
+ throw new error_1.MongoParseError(`Unable to make a writeConcern from journal=${value}`);
+ return wc;
+ }
+ },
+ loadBalanced: {
+ default: false,
+ type: 'boolean'
+ },
+ localThresholdMS: {
+ default: 15,
+ type: 'uint'
+ },
+ maxAdaptiveRetries: {
+ default: 2,
+ type: 'uint'
+ },
+ maxConnecting: {
+ default: 2,
+ transform({ name, values: [value] }) {
+ const maxConnecting = getUIntFromOptions(name, value);
+ if (maxConnecting === 0) {
+ throw new error_1.MongoInvalidArgumentError('maxConnecting must be > 0 if specified');
+ }
+ return maxConnecting;
+ }
+ },
+ maxIdleTimeMS: {
+ default: 0,
+ type: 'uint'
+ },
+ maxPoolSize: {
+ default: 100,
+ type: 'uint'
+ },
+ maxStalenessSeconds: {
+ target: 'readPreference',
+ transform({ name, options, values: [value] }) {
+ const maxStalenessSeconds = getUIntFromOptions(name, value);
+ if (options.readPreference) {
+ return read_preference_1.ReadPreference.fromOptions({
+ readPreference: { ...options.readPreference, maxStalenessSeconds }
+ });
+ }
+ else {
+ return new read_preference_1.ReadPreference('secondary', undefined, { maxStalenessSeconds });
+ }
+ }
+ },
+ minInternalBufferSize: {
+ type: 'uint'
+ },
+ minPoolSize: {
+ default: 0,
+ type: 'uint'
+ },
+ minHeartbeatFrequencyMS: {
+ default: 500,
+ type: 'uint'
+ },
+ monitorCommands: {
+ default: false,
+ type: 'boolean'
+ },
+ name: {
+ target: 'driverInfo',
+ transform({ values: [value], options }) {
+ return { ...options.driverInfo, name: String(value) };
+ }
+ },
+ noDelay: {
+ default: true,
+ type: 'boolean'
+ },
+ pkFactory: {
+ default: utils_1.DEFAULT_PK_FACTORY,
+ transform({ values: [value] }) {
+ if ((0, utils_1.isRecord)(value, ['createPk']) && typeof value.createPk === 'function') {
+ return value;
+ }
+ throw new error_1.MongoParseError(`Option pkFactory must be an object with a createPk function, got ${value}`);
+ }
+ },
+ promoteBuffers: {
+ type: 'boolean'
+ },
+ promoteLongs: {
+ type: 'boolean'
+ },
+ promoteValues: {
+ type: 'boolean'
+ },
+ useBigInt64: {
+ type: 'boolean'
+ },
+ proxyHost: {
+ type: 'string'
+ },
+ proxyPassword: {
+ type: 'string'
+ },
+ proxyPort: {
+ type: 'uint'
+ },
+ proxyUsername: {
+ type: 'string'
+ },
+ raw: {
+ default: false,
+ type: 'boolean'
+ },
+ readConcern: {
+ transform({ values: [value], options }) {
+ if (value instanceof read_concern_1.ReadConcern || (0, utils_1.isRecord)(value, ['level'])) {
+ return read_concern_1.ReadConcern.fromOptions({ ...options.readConcern, ...value });
+ }
+ throw new error_1.MongoParseError(`ReadConcern must be an object, got ${JSON.stringify(value)}`);
+ }
+ },
+ readConcernLevel: {
+ target: 'readConcern',
+ transform({ values: [level], options }) {
+ return read_concern_1.ReadConcern.fromOptions({
+ ...options.readConcern,
+ level: level
+ });
+ }
+ },
+ readPreference: {
+ default: read_preference_1.ReadPreference.primary,
+ transform({ values: [value], options }) {
+ if (value instanceof read_preference_1.ReadPreference) {
+ return read_preference_1.ReadPreference.fromOptions({
+ readPreference: { ...options.readPreference, ...value },
+ ...value
+ });
+ }
+ if ((0, utils_1.isRecord)(value, ['mode'])) {
+ const rp = read_preference_1.ReadPreference.fromOptions({
+ readPreference: { ...options.readPreference, ...value },
+ ...value
+ });
+ if (rp)
+ return rp;
+ else
+ throw new error_1.MongoParseError(`Cannot make read preference from ${JSON.stringify(value)}`);
+ }
+ if (typeof value === 'string') {
+ const rpOpts = {
+ hedge: options.readPreference?.hedge,
+ maxStalenessSeconds: options.readPreference?.maxStalenessSeconds
+ };
+ return new read_preference_1.ReadPreference(value, options.readPreference?.tags, rpOpts);
+ }
+ throw new error_1.MongoParseError(`Unknown ReadPreference value: ${value}`);
+ }
+ },
+ readPreferenceTags: {
+ target: 'readPreference',
+ transform({ values, options }) {
+ const tags = Array.isArray(values[0])
+ ? values[0]
+ : values;
+ const readPreferenceTags = [];
+ for (const tag of tags) {
+ const readPreferenceTag = Object.create(null);
+ if (typeof tag === 'string') {
+ for (const [k, v] of entriesFromString(tag)) {
+ readPreferenceTag[k] = v;
+ }
+ }
+ if ((0, utils_1.isRecord)(tag)) {
+ for (const [k, v] of Object.entries(tag)) {
+ readPreferenceTag[k] = v;
+ }
+ }
+ readPreferenceTags.push(readPreferenceTag);
+ }
+ return read_preference_1.ReadPreference.fromOptions({
+ readPreference: options.readPreference,
+ readPreferenceTags
+ });
+ }
+ },
+ replicaSet: {
+ type: 'string'
+ },
+ retryReads: {
+ default: true,
+ type: 'boolean'
+ },
+ retryWrites: {
+ default: true,
+ type: 'boolean'
+ },
+ runtimeAdapters: {
+ type: 'record'
+ },
+ serializeFunctions: {
+ type: 'boolean'
+ },
+ serverMonitoringMode: {
+ default: 'auto',
+ transform({ values: [value] }) {
+ if (!Object.values(monitor_1.ServerMonitoringMode).includes(value)) {
+ throw new error_1.MongoParseError('serverMonitoringMode must be one of `auto`, `poll`, or `stream`');
+ }
+ return value;
+ }
+ },
+ serverSelectionTimeoutMS: {
+ default: 30000,
+ type: 'uint'
+ },
+ servername: {
+ type: 'string'
+ },
+ socketTimeoutMS: {
+ // TODO(NODE-6491): deprecated: 'Please use timeoutMS instead',
+ default: 0,
+ type: 'uint'
+ },
+ srvMaxHosts: {
+ type: 'uint',
+ default: 0
+ },
+ srvServiceName: {
+ type: 'string',
+ default: 'mongodb'
+ },
+ ssl: {
+ target: 'tls',
+ type: 'boolean'
+ },
+ timeoutMS: {
+ type: 'uint'
+ },
+ tls: {
+ type: 'boolean'
+ },
+ tlsAllowInvalidCertificates: {
+ target: 'rejectUnauthorized',
+ transform({ name, values: [value] }) {
+ // allowInvalidCertificates is the inverse of rejectUnauthorized
+ return !getBoolean(name, value);
+ }
+ },
+ tlsAllowInvalidHostnames: {
+ target: 'checkServerIdentity',
+ transform({ name, values: [value] }) {
+ // tlsAllowInvalidHostnames means setting the checkServerIdentity function to a noop
+ return getBoolean(name, value) ? () => undefined : undefined;
+ }
+ },
+ tlsCAFile: {
+ type: 'string'
+ },
+ tlsCRLFile: {
+ type: 'string'
+ },
+ tlsCertificateKeyFile: {
+ type: 'string'
+ },
+ tlsCertificateKeyFilePassword: {
+ target: 'passphrase',
+ type: 'any'
+ },
+ tlsInsecure: {
+ transform({ name, options, values: [value] }) {
+ const tlsInsecure = getBoolean(name, value);
+ if (tlsInsecure) {
+ options.checkServerIdentity = () => undefined;
+ options.rejectUnauthorized = false;
+ }
+ else {
+ options.checkServerIdentity = options.tlsAllowInvalidHostnames
+ ? () => undefined
+ : undefined;
+ options.rejectUnauthorized = options.tlsAllowInvalidCertificates ? false : true;
+ }
+ return tlsInsecure;
+ }
+ },
+ w: {
+ target: 'writeConcern',
+ transform({ values: [value], options }) {
+ return write_concern_1.WriteConcern.fromOptions({ writeConcern: { ...options.writeConcern, w: value } });
+ }
+ },
+ waitQueueTimeoutMS: {
+ // TODO(NODE-6491): deprecated: 'Please use timeoutMS instead',
+ default: 0,
+ type: 'uint'
+ },
+ writeConcern: {
+ target: 'writeConcern',
+ transform({ values: [value], options }) {
+ if ((0, utils_1.isRecord)(value) || value instanceof write_concern_1.WriteConcern) {
+ return write_concern_1.WriteConcern.fromOptions({
+ writeConcern: {
+ ...options.writeConcern,
+ ...value
+ }
+ });
+ }
+ else if (value === 'majority' || typeof value === 'number') {
+ return write_concern_1.WriteConcern.fromOptions({
+ writeConcern: {
+ ...options.writeConcern,
+ w: value
+ }
+ });
+ }
+ throw new error_1.MongoParseError(`Invalid WriteConcern cannot parse: ${JSON.stringify(value)}`);
+ }
+ },
+ wtimeout: {
+ deprecated: 'Please use wtimeoutMS instead',
+ target: 'writeConcern',
+ transform({ values: [value], options }) {
+ const wc = write_concern_1.WriteConcern.fromOptions({
+ writeConcern: {
+ ...options.writeConcern,
+ wtimeout: getUIntFromOptions('wtimeout', value)
+ }
+ });
+ if (wc)
+ return wc;
+ throw new error_1.MongoParseError(`Cannot make WriteConcern from wtimeout`);
+ }
+ },
+ wtimeoutMS: {
+ target: 'writeConcern',
+ transform({ values: [value], options }) {
+ const wc = write_concern_1.WriteConcern.fromOptions({
+ writeConcern: {
+ ...options.writeConcern,
+ wtimeoutMS: getUIntFromOptions('wtimeoutMS', value)
+ }
+ });
+ if (wc)
+ return wc;
+ throw new error_1.MongoParseError(`Cannot make WriteConcern from wtimeout`);
+ }
+ },
+ zlibCompressionLevel: {
+ default: 0,
+ type: 'int'
+ },
+ mongodbLogPath: {
+ transform({ values: [value] }) {
+ if (!((typeof value === 'string' && ['stderr', 'stdout'].includes(value)) ||
+ (value &&
+ typeof value === 'object' &&
+ 'write' in value &&
+ typeof value.write === 'function'))) {
+ throw new error_1.MongoAPIError(`Option 'mongodbLogPath' must be of type 'stderr' | 'stdout' | MongoDBLogWritable`);
+ }
+ return value;
+ }
+ },
+ mongodbLogComponentSeverities: {
+ transform({ values: [value] }) {
+ if (typeof value !== 'object' || !value) {
+ throw new error_1.MongoAPIError(`Option 'mongodbLogComponentSeverities' must be a non-null object`);
+ }
+ for (const [k, v] of Object.entries(value)) {
+ if (typeof v !== 'string' || typeof k !== 'string') {
+ throw new error_1.MongoAPIError(`User input for option 'mongodbLogComponentSeverities' object cannot include a non-string key or value`);
+ }
+ if (!Object.values(mongo_logger_1.MongoLoggableComponent).some(val => val === k) && k !== 'default') {
+ throw new error_1.MongoAPIError(`User input for option 'mongodbLogComponentSeverities' contains invalid key: ${k}`);
+ }
+ if (!Object.values(mongo_logger_1.SeverityLevel).some(val => val === v)) {
+ throw new error_1.MongoAPIError(`Option 'mongodbLogComponentSeverities' does not support ${v} as a value for ${k}`);
+ }
+ }
+ return value;
+ }
+ },
+ mongodbLogMaxDocumentLength: { type: 'uint' },
+ // Custom types for modifying core behavior
+ connectionType: { type: 'any' },
+ srvPoller: { type: 'any' },
+ // Accepted Node.js Options
+ allowPartialTrustChain: { type: 'any' },
+ minDHSize: { type: 'any' },
+ pskCallback: { type: 'any' },
+ secureContext: { type: 'any' },
+ enableTrace: { type: 'any' },
+ requestCert: { type: 'any' },
+ rejectUnauthorized: { type: 'any' },
+ checkServerIdentity: { type: 'any' },
+ keepAliveInitialDelay: { type: 'any' },
+ ALPNProtocols: { type: 'any' },
+ SNICallback: { type: 'any' },
+ session: { type: 'any' },
+ requestOCSP: { type: 'any' },
+ localAddress: { type: 'any' },
+ localPort: { type: 'any' },
+ hints: { type: 'any' },
+ lookup: { type: 'any' },
+ ca: { type: 'any' },
+ cert: { type: 'any' },
+ ciphers: { type: 'any' },
+ crl: { type: 'any' },
+ ecdhCurve: { type: 'any' },
+ key: { type: 'any' },
+ passphrase: { type: 'any' },
+ pfx: { type: 'any' },
+ secureProtocol: { type: 'any' },
+ index: { type: 'any' },
+ // Legacy options from v3 era
+ __skipPingOnConnect: { type: 'boolean' }
+};
+exports.DEFAULT_OPTIONS = new CaseInsensitiveMap(Object.entries(exports.OPTIONS)
+ .filter(([, descriptor]) => descriptor.default != null)
+ .map(([k, d]) => [k, d.default]));
+//# sourceMappingURL=connection_string.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/connection_string.js.map b/node_modules/mongodb/lib/connection_string.js.map
new file mode 100644
index 00000000..9dc21885
--- /dev/null
+++ b/node_modules/mongodb/lib/connection_string.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"connection_string.js","sourceRoot":"","sources":["../src/connection_string.ts"],"names":[],"mappings":";;;AA4EA,4CAiFC;AA+ED,oCAwTC;AApiBD,2BAA2B;AAC3B,iFAA6D;AAC7D,mCAAmC;AACnC,6BAAsC;AAGtC,qEAAiE;AACjE,qDAAoF;AACpF,kEAAmF;AACnF,2CAAwC;AACxC,mCAAoF;AACpF,iDAOwB;AACxB,iDAAoF;AACpF,iDAAoE;AACpE,uDAA4E;AAC5E,yDAA4D;AAC5D,4CAAsD;AAEtD,mCASiB;AACjB,mDAAuD;AAEvD,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AAEvE,MAAM,oBAAoB,GAAG,kEAAkE,CAAC;AAChG,MAAM,oBAAoB,GAAG,4DAA4D,CAAC;AAC1F,MAAM,0BAA0B,GAC9B,qEAAqE,CAAC;AAIxE,SAAS,kBAAkB,CACzB,MAAqB;IAErB,MAAM,OAAO,GACX,MAAM,KAAK,KAAK;QACd,CAAC,CAAC,CAAC,OAAe,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC;QAC3D,CAAC,CAAC,CAAC,OAAe,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,OA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AAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CACnC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/constants.js b/node_modules/mongodb/lib/constants.js
new file mode 100644
index 00000000..e1021b72
--- /dev/null
+++ b/node_modules/mongodb/lib/constants.js
@@ -0,0 +1,170 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.END = exports.CHANGE = exports.INIT = exports.MORE = exports.RESPONSE = exports.SERVER_HEARTBEAT_FAILED = exports.SERVER_HEARTBEAT_SUCCEEDED = exports.SERVER_HEARTBEAT_STARTED = exports.COMMAND_FAILED = exports.COMMAND_SUCCEEDED = exports.COMMAND_STARTED = exports.CLUSTER_TIME_RECEIVED = exports.CONNECTION_CHECKED_IN = exports.CONNECTION_CHECKED_OUT = exports.CONNECTION_CHECK_OUT_FAILED = exports.CONNECTION_CHECK_OUT_STARTED = exports.CONNECTION_CLOSED = exports.CONNECTION_READY = exports.CONNECTION_CREATED = exports.CONNECTION_POOL_READY = exports.CONNECTION_POOL_CLEARED = exports.CONNECTION_POOL_CLOSED = exports.CONNECTION_POOL_CREATED = exports.WAITING_FOR_SUITABLE_SERVER = exports.SERVER_SELECTION_SUCCEEDED = exports.SERVER_SELECTION_FAILED = exports.SERVER_SELECTION_STARTED = exports.TOPOLOGY_DESCRIPTION_CHANGED = exports.TOPOLOGY_CLOSED = exports.TOPOLOGY_OPENING = exports.SERVER_DESCRIPTION_CHANGED = exports.SERVER_CLOSED = exports.SERVER_OPENING = exports.DESCRIPTION_RECEIVED = exports.UNPINNED = exports.PINNED = exports.MESSAGE = exports.ENDED = exports.CLOSED = exports.CONNECT = exports.OPEN = exports.CLOSE = exports.TIMEOUT = exports.ERROR = exports.SYSTEM_JS_COLLECTION = exports.SYSTEM_COMMAND_COLLECTION = exports.SYSTEM_USER_COLLECTION = exports.SYSTEM_PROFILE_COLLECTION = exports.SYSTEM_INDEX_COLLECTION = exports.SYSTEM_NAMESPACE_COLLECTION = void 0;
+exports.kDecoratedKeys = exports.kDecorateResult = exports.LEGACY_HELLO_COMMAND_CAMEL_CASE = exports.LEGACY_HELLO_COMMAND = exports.MONGO_CLIENT_EVENTS = exports.LOCAL_SERVER_EVENTS = exports.SERVER_RELAY_EVENTS = exports.APM_EVENTS = exports.TOPOLOGY_EVENTS = exports.CMAP_EVENTS = exports.HEARTBEAT_EVENTS = exports.RESUME_TOKEN_CHANGED = void 0;
+exports.SYSTEM_NAMESPACE_COLLECTION = 'system.namespaces';
+exports.SYSTEM_INDEX_COLLECTION = 'system.indexes';
+exports.SYSTEM_PROFILE_COLLECTION = 'system.profile';
+exports.SYSTEM_USER_COLLECTION = 'system.users';
+exports.SYSTEM_COMMAND_COLLECTION = '$cmd';
+exports.SYSTEM_JS_COLLECTION = 'system.js';
+// events
+exports.ERROR = 'error';
+exports.TIMEOUT = 'timeout';
+exports.CLOSE = 'close';
+exports.OPEN = 'open';
+exports.CONNECT = 'connect';
+exports.CLOSED = 'closed';
+exports.ENDED = 'ended';
+exports.MESSAGE = 'message';
+exports.PINNED = 'pinned';
+exports.UNPINNED = 'unpinned';
+exports.DESCRIPTION_RECEIVED = 'descriptionReceived';
+/** @internal */
+exports.SERVER_OPENING = 'serverOpening';
+/** @internal */
+exports.SERVER_CLOSED = 'serverClosed';
+/** @internal */
+exports.SERVER_DESCRIPTION_CHANGED = 'serverDescriptionChanged';
+/** @internal */
+exports.TOPOLOGY_OPENING = 'topologyOpening';
+/** @internal */
+exports.TOPOLOGY_CLOSED = 'topologyClosed';
+/** @internal */
+exports.TOPOLOGY_DESCRIPTION_CHANGED = 'topologyDescriptionChanged';
+/** @internal */
+exports.SERVER_SELECTION_STARTED = 'serverSelectionStarted';
+/** @internal */
+exports.SERVER_SELECTION_FAILED = 'serverSelectionFailed';
+/** @internal */
+exports.SERVER_SELECTION_SUCCEEDED = 'serverSelectionSucceeded';
+/** @internal */
+exports.WAITING_FOR_SUITABLE_SERVER = 'waitingForSuitableServer';
+/** @internal */
+exports.CONNECTION_POOL_CREATED = 'connectionPoolCreated';
+/** @internal */
+exports.CONNECTION_POOL_CLOSED = 'connectionPoolClosed';
+/** @internal */
+exports.CONNECTION_POOL_CLEARED = 'connectionPoolCleared';
+/** @internal */
+exports.CONNECTION_POOL_READY = 'connectionPoolReady';
+/** @internal */
+exports.CONNECTION_CREATED = 'connectionCreated';
+/** @internal */
+exports.CONNECTION_READY = 'connectionReady';
+/** @internal */
+exports.CONNECTION_CLOSED = 'connectionClosed';
+/** @internal */
+exports.CONNECTION_CHECK_OUT_STARTED = 'connectionCheckOutStarted';
+/** @internal */
+exports.CONNECTION_CHECK_OUT_FAILED = 'connectionCheckOutFailed';
+/** @internal */
+exports.CONNECTION_CHECKED_OUT = 'connectionCheckedOut';
+/** @internal */
+exports.CONNECTION_CHECKED_IN = 'connectionCheckedIn';
+exports.CLUSTER_TIME_RECEIVED = 'clusterTimeReceived';
+/** @internal */
+exports.COMMAND_STARTED = 'commandStarted';
+/** @internal */
+exports.COMMAND_SUCCEEDED = 'commandSucceeded';
+/** @internal */
+exports.COMMAND_FAILED = 'commandFailed';
+/** @internal */
+exports.SERVER_HEARTBEAT_STARTED = 'serverHeartbeatStarted';
+/** @internal */
+exports.SERVER_HEARTBEAT_SUCCEEDED = 'serverHeartbeatSucceeded';
+/** @internal */
+exports.SERVER_HEARTBEAT_FAILED = 'serverHeartbeatFailed';
+exports.RESPONSE = 'response';
+exports.MORE = 'more';
+exports.INIT = 'init';
+exports.CHANGE = 'change';
+exports.END = 'end';
+exports.RESUME_TOKEN_CHANGED = 'resumeTokenChanged';
+/** @public */
+exports.HEARTBEAT_EVENTS = Object.freeze([
+ exports.SERVER_HEARTBEAT_STARTED,
+ exports.SERVER_HEARTBEAT_SUCCEEDED,
+ exports.SERVER_HEARTBEAT_FAILED
+]);
+/** @public */
+exports.CMAP_EVENTS = Object.freeze([
+ exports.CONNECTION_POOL_CREATED,
+ exports.CONNECTION_POOL_READY,
+ exports.CONNECTION_POOL_CLEARED,
+ exports.CONNECTION_POOL_CLOSED,
+ exports.CONNECTION_CREATED,
+ exports.CONNECTION_READY,
+ exports.CONNECTION_CLOSED,
+ exports.CONNECTION_CHECK_OUT_STARTED,
+ exports.CONNECTION_CHECK_OUT_FAILED,
+ exports.CONNECTION_CHECKED_OUT,
+ exports.CONNECTION_CHECKED_IN
+]);
+/** @public */
+exports.TOPOLOGY_EVENTS = Object.freeze([
+ exports.SERVER_OPENING,
+ exports.SERVER_CLOSED,
+ exports.SERVER_DESCRIPTION_CHANGED,
+ exports.TOPOLOGY_OPENING,
+ exports.TOPOLOGY_CLOSED,
+ exports.TOPOLOGY_DESCRIPTION_CHANGED,
+ exports.ERROR,
+ exports.TIMEOUT,
+ exports.CLOSE
+]);
+/** @public */
+exports.APM_EVENTS = Object.freeze([
+ exports.COMMAND_STARTED,
+ exports.COMMAND_SUCCEEDED,
+ exports.COMMAND_FAILED
+]);
+/**
+ * All events that we relay to the `Topology`
+ * @internal
+ */
+exports.SERVER_RELAY_EVENTS = Object.freeze([
+ exports.SERVER_HEARTBEAT_STARTED,
+ exports.SERVER_HEARTBEAT_SUCCEEDED,
+ exports.SERVER_HEARTBEAT_FAILED,
+ exports.COMMAND_STARTED,
+ exports.COMMAND_SUCCEEDED,
+ exports.COMMAND_FAILED,
+ ...exports.CMAP_EVENTS
+]);
+/**
+ * All events we listen to from `Server` instances, but do not forward to the client
+ * @internal
+ */
+exports.LOCAL_SERVER_EVENTS = Object.freeze([
+ exports.CONNECT,
+ exports.DESCRIPTION_RECEIVED,
+ exports.CLOSED,
+ exports.ENDED
+]);
+/** @public */
+exports.MONGO_CLIENT_EVENTS = Object.freeze([
+ ...exports.CMAP_EVENTS,
+ ...exports.APM_EVENTS,
+ ...exports.TOPOLOGY_EVENTS,
+ ...exports.HEARTBEAT_EVENTS
+]);
+/**
+ * @internal
+ * The legacy hello command that was deprecated in MongoDB 5.0.
+ */
+exports.LEGACY_HELLO_COMMAND = 'ismaster';
+/**
+ * @internal
+ * The legacy hello command that was deprecated in MongoDB 5.0.
+ */
+exports.LEGACY_HELLO_COMMAND_CAMEL_CASE = 'isMaster';
+// Typescript errors if we index objects with `Symbol.for(...)`, so
+// to avoid TS errors we pull them out into variables. Then we can type
+// the objects (and class) that we expect to see them on and prevent TS
+// errors.
+/** @internal */
+exports.kDecorateResult = Symbol.for('@@mdb.decorateDecryptionResult');
+/** @internal */
+exports.kDecoratedKeys = Symbol.for('@@mdb.decryptedKeys');
+//# sourceMappingURL=constants.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/constants.js.map b/node_modules/mongodb/lib/constants.js.map
new file mode 100644
index 00000000..809a6bde
--- /dev/null
+++ b/node_modules/mongodb/lib/constants.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;AAAa,QAAA,2BAA2B,GAAG,mBAAmB,CAAC;AAClD,QAAA,uBAAuB,GAAG,gBAAgB,CAAC;AAC3C,QAAA,yBAAyB,GAAG,gBAAgB,CAAC;AAC7C,QAAA,sBAAsB,GAAG,cAAc,CAAC;AACxC,QAAA,yBAAyB,GAAG,MAAM,CAAC;AACnC,QAAA,oBAAoB,GAAG,WAAW,CAAC;AAEhD,SAAS;AACI,QAAA,KAAK,GAAG,OAAgB,CAAC;AACzB,QAAA,OAAO,GAAG,SAAkB,CAAC;AAC7B,QAAA,KAAK,GAAG,OAAgB,CAAC;AACzB,QAAA,IAAI,GAAG,MAAe,CAAC;AACvB,QAAA,OAAO,GAAG,SAAkB,CAAC;AAC7B,QAAA,MAAM,GAAG,QAAiB,CAAC;AAC3B,QAAA,KAAK,GAAG,OAAgB,CAAC;AACzB,QAAA,OAAO,GAAG,SAAkB,CAAC;AAC7B,QAAA,MAAM,GAAG,QAAiB,CAAC;AAC3B,QAAA,QAAQ,GAAG,UAAmB,CAAC;AAC/B,QAAA,oBAAoB,GAAG,qBAAqB,CAAC;AAC1D,gBAAgB;AAC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B;IACxB,kCAA0B;IAC1B,+BAAuB;IACvB,uBAAe;IACf,yBAAiB;IACjB,sBAAc;IACd,GAAG,mBAAW;CACN,CAAC,CAAC;AAEZ;;;GAGG;AACU,QAAA,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,eAAO;IACP,4BAAoB;IACpB,cAAM;IACN,aAAK;CACG,CAAC,CAAC;AAEZ,cAAc;AACD,QAAA,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,GAAG,mBAAW;IACd,GAAG,kBAAU;IACb,GAAG,uBAAe;IAClB,GAAG,wBAAgB;CACX,CAAC,CAAC;AAEZ;;;GAGG;AACU,QAAA,oBAAoB,GAAG,UAAU,CAAC;AAE/C;;;GAGG;AACU,QAAA,+BAA+B,GAAG,UAAU,CAAC;AAE1D,mEAAmE;AACnE,wEAAwE;AACxE,uEAAuE;AACvE,UAAU;AACV,gBAAgB;AACH,QAAA,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAC5E,gBAAgB;AACH,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/abstract_cursor.js b/node_modules/mongodb/lib/cursor/abstract_cursor.js
new file mode 100644
index 00000000..5e223872
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/abstract_cursor.js
@@ -0,0 +1,924 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CursorTimeoutContext = exports.AbstractCursor = exports.CursorTimeoutMode = exports.CURSOR_FLAGS = void 0;
+const stream_1 = require("stream");
+const bson_1 = require("../bson");
+const error_1 = require("../error");
+const mongo_types_1 = require("../mongo_types");
+const execute_operation_1 = require("../operations/execute_operation");
+const get_more_1 = require("../operations/get_more");
+const kill_cursors_1 = require("../operations/kill_cursors");
+const read_concern_1 = require("../read_concern");
+const read_preference_1 = require("../read_preference");
+const sessions_1 = require("../sessions");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+/** @public */
+exports.CURSOR_FLAGS = [
+ 'tailable',
+ 'oplogReplay',
+ 'noCursorTimeout',
+ 'awaitData',
+ 'exhaust',
+ 'partial'
+];
+function removeActiveCursor() {
+ this.client.s.activeCursors.delete(this);
+}
+/**
+ * @public
+ * @experimental
+ * Specifies how `timeoutMS` is applied to the cursor. Can be either `'cursorLifeTime'` or `'iteration'`
+ * When set to `'iteration'`, the deadline specified by `timeoutMS` applies to each call of
+ * `cursor.next()`.
+ * When set to `'cursorLifetime'`, the deadline applies to the life of the entire cursor.
+ *
+ * Depending on the type of cursor being used, this option has different default values.
+ * For non-tailable cursors, this value defaults to `'cursorLifetime'`
+ * For tailable cursors, this value defaults to `'iteration'` since tailable cursors, by
+ * definition can have an arbitrarily long lifetime.
+ *
+ * @example
+ * ```ts
+ * const cursor = collection.find({}, {timeoutMS: 100, timeoutMode: 'iteration'});
+ * for await (const doc of cursor) {
+ * // process doc
+ * // This will throw a timeout error if any of the iterator's `next()` calls takes more than 100ms, but
+ * // will continue to iterate successfully otherwise, regardless of the number of batches.
+ * }
+ * ```
+ *
+ * @example
+ * ```ts
+ * const cursor = collection.find({}, { timeoutMS: 1000, timeoutMode: 'cursorLifetime' });
+ * const docs = await cursor.toArray(); // This entire line will throw a timeout error if all batches are not fetched and returned within 1000ms.
+ * ```
+ */
+exports.CursorTimeoutMode = Object.freeze({
+ ITERATION: 'iteration',
+ LIFETIME: 'cursorLifetime'
+});
+/** @public */
+class AbstractCursor extends mongo_types_1.TypedEventEmitter {
+ /** @event */
+ static { this.CLOSE = 'close'; }
+ /** @internal */
+ constructor(client, namespace, options = {}) {
+ super();
+ /** @internal */
+ this.documents = null;
+ /** @internal */
+ this.hasEmittedClose = false;
+ this.on('error', utils_1.noop);
+ if (!client.s.isMongoClient) {
+ throw new error_1.MongoRuntimeError('Cursor must be constructed with MongoClient');
+ }
+ this.cursorClient = client;
+ this.cursorNamespace = namespace;
+ this.cursorId = null;
+ this.initialized = false;
+ this.isClosed = false;
+ this.isKilled = false;
+ this.cursorOptions = {
+ readPreference: options.readPreference && options.readPreference instanceof read_preference_1.ReadPreference
+ ? options.readPreference
+ : read_preference_1.ReadPreference.primary,
+ ...(0, bson_1.pluckBSONSerializeOptions)(options),
+ timeoutMS: options?.timeoutContext?.csotEnabled()
+ ? options.timeoutContext.timeoutMS
+ : options.timeoutMS,
+ tailable: options.tailable,
+ awaitData: options.awaitData
+ };
+ if (this.cursorOptions.timeoutMS != null) {
+ if (options.timeoutMode == null) {
+ if (options.tailable) {
+ if (options.awaitData) {
+ if (options.maxAwaitTimeMS != null &&
+ options.maxAwaitTimeMS >= this.cursorOptions.timeoutMS)
+ throw new error_1.MongoInvalidArgumentError('Cannot specify maxAwaitTimeMS >= timeoutMS for a tailable awaitData cursor');
+ }
+ this.cursorOptions.timeoutMode = exports.CursorTimeoutMode.ITERATION;
+ }
+ else {
+ this.cursorOptions.timeoutMode = exports.CursorTimeoutMode.LIFETIME;
+ }
+ }
+ else {
+ if (options.tailable && options.timeoutMode === exports.CursorTimeoutMode.LIFETIME) {
+ throw new error_1.MongoInvalidArgumentError("Cannot set tailable cursor's timeoutMode to LIFETIME");
+ }
+ this.cursorOptions.timeoutMode = options.timeoutMode;
+ }
+ }
+ else {
+ if (options.timeoutMode != null)
+ throw new error_1.MongoInvalidArgumentError('Cannot set timeoutMode without setting timeoutMS');
+ }
+ // Set for initial command
+ this.cursorOptions.omitMaxTimeMS =
+ this.cursorOptions.timeoutMS != null &&
+ ((this.cursorOptions.timeoutMode === exports.CursorTimeoutMode.ITERATION &&
+ !this.cursorOptions.tailable) ||
+ (this.cursorOptions.tailable && !this.cursorOptions.awaitData));
+ const readConcern = read_concern_1.ReadConcern.fromOptions(options);
+ if (readConcern) {
+ this.cursorOptions.readConcern = readConcern;
+ }
+ if (typeof options.batchSize === 'number') {
+ this.cursorOptions.batchSize = options.batchSize;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (options.comment !== undefined) {
+ this.cursorOptions.comment = options.comment;
+ }
+ if (typeof options.maxTimeMS === 'number') {
+ this.cursorOptions.maxTimeMS = options.maxTimeMS;
+ }
+ if (typeof options.maxAwaitTimeMS === 'number') {
+ this.cursorOptions.maxAwaitTimeMS = options.maxAwaitTimeMS;
+ }
+ this.cursorSession = options.session ?? null;
+ this.deserializationOptions = {
+ ...this.cursorOptions,
+ validation: {
+ utf8: options?.enableUtf8Validation === false ? false : true
+ }
+ };
+ this.timeoutContext = options.timeoutContext;
+ this.signal = options.signal;
+ this.abortListener = (0, utils_1.addAbortListener)(this.signal, () => void this.close().then(undefined, utils_1.squashError));
+ this.trackCursor();
+ }
+ /**
+ * The cursor has no id until it receives a response from the initial cursor creating command.
+ *
+ * It is non-zero for as long as the database has an open cursor.
+ *
+ * The initiating command may receive a zero id if the entire result is in the `firstBatch`.
+ */
+ get id() {
+ return this.cursorId ?? undefined;
+ }
+ /** @internal */
+ get isDead() {
+ return (this.cursorId?.isZero() ?? false) || this.isClosed || this.isKilled;
+ }
+ /** @internal */
+ get client() {
+ return this.cursorClient;
+ }
+ /** @internal */
+ get server() {
+ return this.selectedServer;
+ }
+ get namespace() {
+ return this.cursorNamespace;
+ }
+ get readPreference() {
+ return this.cursorOptions.readPreference;
+ }
+ get readConcern() {
+ return this.cursorOptions.readConcern;
+ }
+ /** @internal */
+ get session() {
+ return this.cursorSession;
+ }
+ set session(clientSession) {
+ this.cursorSession = clientSession;
+ }
+ /**
+ * The cursor is closed and all remaining locally buffered documents have been iterated.
+ */
+ get closed() {
+ return this.isClosed && (this.documents?.length ?? 0) === 0;
+ }
+ /**
+ * A `killCursors` command was attempted on this cursor.
+ * This is performed if the cursor id is non zero.
+ */
+ get killed() {
+ return this.isKilled;
+ }
+ get loadBalanced() {
+ return !!this.cursorClient.topology?.loadBalanced;
+ }
+ /**
+ * @experimental
+ * An alias for {@link AbstractCursor.close|AbstractCursor.close()}.
+ */
+ async [Symbol.asyncDispose]() {
+ await this.close();
+ }
+ /** Adds cursor to client's tracking so it will be closed by MongoClient.close() */
+ trackCursor() {
+ this.cursorClient.s.activeCursors.add(this);
+ if (!this.listeners('close').includes(removeActiveCursor)) {
+ this.once('close', removeActiveCursor);
+ }
+ }
+ /** Returns current buffered documents length */
+ bufferedCount() {
+ return this.documents?.length ?? 0;
+ }
+ /** Returns current buffered documents */
+ readBufferedDocuments(number) {
+ const bufferedDocs = [];
+ const documentsToRead = Math.min(number ?? this.documents?.length ?? 0, this.documents?.length ?? 0);
+ for (let count = 0; count < documentsToRead; count++) {
+ const document = this.documents?.shift(this.deserializationOptions);
+ if (document != null) {
+ bufferedDocs.push(document);
+ }
+ }
+ return bufferedDocs;
+ }
+ async *[Symbol.asyncIterator]() {
+ this.signal?.throwIfAborted();
+ if (this.closed) {
+ return;
+ }
+ try {
+ while (true) {
+ if (this.isKilled) {
+ return;
+ }
+ if (this.closed) {
+ return;
+ }
+ if (this.cursorId != null && this.isDead && (this.documents?.length ?? 0) === 0) {
+ return;
+ }
+ const document = await this.next();
+ // eslint-disable-next-line no-restricted-syntax
+ if (document === null) {
+ return;
+ }
+ yield document;
+ this.signal?.throwIfAborted();
+ }
+ }
+ finally {
+ // Only close the cursor if it has not already been closed. This finally clause handles
+ // the case when a user would break out of a for await of loop early.
+ if (!this.isClosed) {
+ try {
+ await this.close();
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ }
+ }
+ }
+ stream() {
+ const readable = new ReadableCursorStream(this);
+ const abortListener = (0, utils_1.addAbortListener)(this.signal, function () {
+ readable.destroy(this.reason);
+ });
+ readable.once('end', () => {
+ abortListener?.[utils_1.kDispose]();
+ });
+ return readable;
+ }
+ async hasNext() {
+ this.signal?.throwIfAborted();
+ if (this.cursorId === bson_1.Long.ZERO) {
+ return false;
+ }
+ if (this.cursorOptions.timeoutMode === exports.CursorTimeoutMode.ITERATION && this.cursorId != null) {
+ this.timeoutContext?.refresh();
+ }
+ try {
+ do {
+ if ((this.documents?.length ?? 0) !== 0) {
+ return true;
+ }
+ await this.fetchBatch();
+ } while (!this.isDead || (this.documents?.length ?? 0) !== 0);
+ }
+ finally {
+ if (this.cursorOptions.timeoutMode === exports.CursorTimeoutMode.ITERATION) {
+ this.timeoutContext?.clear();
+ }
+ }
+ return false;
+ }
+ /** Get the next available document from the cursor, returns null if no more documents are available. */
+ async next() {
+ this.signal?.throwIfAborted();
+ if (this.cursorId === bson_1.Long.ZERO) {
+ throw new error_1.MongoCursorExhaustedError();
+ }
+ if (this.cursorOptions.timeoutMode === exports.CursorTimeoutMode.ITERATION && this.cursorId != null) {
+ this.timeoutContext?.refresh();
+ }
+ try {
+ do {
+ const doc = this.documents?.shift(this.deserializationOptions);
+ if (doc != null) {
+ if (this.transform != null)
+ return await this.transformDocument(doc);
+ return doc;
+ }
+ await this.fetchBatch();
+ } while (!this.isDead || (this.documents?.length ?? 0) !== 0);
+ }
+ finally {
+ if (this.cursorOptions.timeoutMode === exports.CursorTimeoutMode.ITERATION) {
+ this.timeoutContext?.clear();
+ }
+ }
+ return null;
+ }
+ /**
+ * Try to get the next available document from the cursor or `null` if an empty batch is returned
+ */
+ async tryNext() {
+ this.signal?.throwIfAborted();
+ if (this.cursorId === bson_1.Long.ZERO) {
+ throw new error_1.MongoCursorExhaustedError();
+ }
+ if (this.cursorOptions.timeoutMode === exports.CursorTimeoutMode.ITERATION && this.cursorId != null) {
+ this.timeoutContext?.refresh();
+ }
+ try {
+ let doc = this.documents?.shift(this.deserializationOptions);
+ if (doc != null) {
+ if (this.transform != null)
+ return await this.transformDocument(doc);
+ return doc;
+ }
+ await this.fetchBatch();
+ doc = this.documents?.shift(this.deserializationOptions);
+ if (doc != null) {
+ if (this.transform != null)
+ return await this.transformDocument(doc);
+ return doc;
+ }
+ }
+ finally {
+ if (this.cursorOptions.timeoutMode === exports.CursorTimeoutMode.ITERATION) {
+ this.timeoutContext?.clear();
+ }
+ }
+ return null;
+ }
+ /**
+ * Iterates over all the documents for this cursor using the iterator, callback pattern.
+ *
+ * If the iterator returns `false`, iteration will stop.
+ *
+ * @param iterator - The iteration callback.
+ * @deprecated - Will be removed in a future release. Use for await...of instead.
+ */
+ async forEach(iterator) {
+ this.signal?.throwIfAborted();
+ if (typeof iterator !== 'function') {
+ throw new error_1.MongoInvalidArgumentError('Argument "iterator" must be a function');
+ }
+ for await (const document of this) {
+ const result = iterator(document);
+ if (result === false) {
+ break;
+ }
+ }
+ }
+ /**
+ * Frees any client-side resources used by the cursor.
+ */
+ async close(options) {
+ await this.cleanup(options?.timeoutMS);
+ }
+ /**
+ * Returns an array of documents. The caller is responsible for making sure that there
+ * is enough memory to store the results. Note that the array only contains partial
+ * results when this cursor had been previously accessed. In that case,
+ * cursor.rewind() can be used to reset the cursor.
+ */
+ async toArray() {
+ this.signal?.throwIfAborted();
+ const array = [];
+ // at the end of the loop (since readBufferedDocuments is called) the buffer will be empty
+ // then, the 'await of' syntax will run a getMore call
+ for await (const document of this) {
+ array.push(document);
+ const docs = this.readBufferedDocuments();
+ if (this.transform != null) {
+ for (const doc of docs) {
+ array.push(await this.transformDocument(doc));
+ }
+ }
+ else {
+ // Note: previous versions of this logic used `array.push(...)`, which adds each item
+ // to the callstack. For large arrays, this can exceed the maximum call size.
+ for (const doc of docs) {
+ array.push(doc);
+ }
+ }
+ }
+ return array;
+ }
+ /**
+ * Add a cursor flag to the cursor
+ *
+ * @param flag - The flag to set, must be one of following ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'partial' -.
+ * @param value - The flag boolean value.
+ */
+ addCursorFlag(flag, value) {
+ this.throwIfInitialized();
+ if (!exports.CURSOR_FLAGS.includes(flag)) {
+ throw new error_1.MongoInvalidArgumentError(`Flag ${flag} is not one of ${exports.CURSOR_FLAGS}`);
+ }
+ if (typeof value !== 'boolean') {
+ throw new error_1.MongoInvalidArgumentError(`Flag ${flag} must be a boolean value`);
+ }
+ this.cursorOptions[flag] = value;
+ return this;
+ }
+ /**
+ * Map all documents using the provided function
+ * If there is a transform set on the cursor, that will be called first and the result passed to
+ * this function's transform.
+ *
+ * @remarks
+ *
+ * **Note** Cursors use `null` internally to indicate that there are no more documents in the cursor. Providing a mapping
+ * function that maps values to `null` will result in the cursor closing itself before it has finished iterating
+ * all documents. This will **not** result in a memory leak, just surprising behavior. For example:
+ *
+ * ```typescript
+ * const cursor = collection.find({});
+ * cursor.map(() => null);
+ *
+ * const documents = await cursor.toArray();
+ * // documents is always [], regardless of how many documents are in the collection.
+ * ```
+ *
+ * Other falsey values are allowed:
+ *
+ * ```typescript
+ * const cursor = collection.find({});
+ * cursor.map(() => '');
+ *
+ * const documents = await cursor.toArray();
+ * // documents is now an array of empty strings
+ * ```
+ *
+ * **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
+ * it **does not** return a new instance of a cursor. This means when calling map,
+ * you should always assign the result to a new variable in order to get a correctly typed cursor variable.
+ * Take note of the following example:
+ *
+ * @example
+ * ```typescript
+ * const cursor: FindCursor = coll.find();
+ * const mappedCursor: FindCursor = cursor.map(doc => Object.keys(doc).length);
+ * const keyCounts: number[] = await mappedCursor.toArray(); // cursor.toArray() still returns Document[]
+ * ```
+ * @param transform - The mapping transformation method.
+ */
+ map(transform) {
+ this.throwIfInitialized();
+ const oldTransform = this.transform;
+ if (oldTransform) {
+ this.transform = doc => {
+ return transform(oldTransform(doc));
+ };
+ }
+ else {
+ this.transform = transform;
+ }
+ return this;
+ }
+ /**
+ * Set the ReadPreference for the cursor.
+ *
+ * @param readPreference - The new read preference for the cursor.
+ */
+ withReadPreference(readPreference) {
+ this.throwIfInitialized();
+ if (readPreference instanceof read_preference_1.ReadPreference) {
+ this.cursorOptions.readPreference = readPreference;
+ }
+ else if (typeof readPreference === 'string') {
+ this.cursorOptions.readPreference = read_preference_1.ReadPreference.fromString(readPreference);
+ }
+ else {
+ throw new error_1.MongoInvalidArgumentError(`Invalid read preference: ${readPreference}`);
+ }
+ return this;
+ }
+ /**
+ * Set the ReadPreference for the cursor.
+ *
+ * @param readPreference - The new read preference for the cursor.
+ */
+ withReadConcern(readConcern) {
+ this.throwIfInitialized();
+ const resolvedReadConcern = read_concern_1.ReadConcern.fromOptions({ readConcern });
+ if (resolvedReadConcern) {
+ this.cursorOptions.readConcern = resolvedReadConcern;
+ }
+ return this;
+ }
+ /**
+ * Set a maxTimeMS on the cursor query, allowing for hard timeout limits on queries (Only supported on MongoDB 2.6 or higher)
+ *
+ * @param value - Number of milliseconds to wait before aborting the query.
+ */
+ maxTimeMS(value) {
+ this.throwIfInitialized();
+ if (typeof value !== 'number') {
+ throw new error_1.MongoInvalidArgumentError('Argument for maxTimeMS must be a number');
+ }
+ this.cursorOptions.maxTimeMS = value;
+ return this;
+ }
+ /**
+ * Set the batch size for the cursor.
+ *
+ * @param value - The number of documents to return per batch. See {@link https://www.mongodb.com/docs/manual/reference/command/find/|find command documentation}.
+ */
+ batchSize(value) {
+ this.throwIfInitialized();
+ if (this.cursorOptions.tailable) {
+ throw new error_1.MongoTailableCursorError('Tailable cursor does not support batchSize');
+ }
+ if (typeof value !== 'number') {
+ throw new error_1.MongoInvalidArgumentError('Operation "batchSize" requires an integer');
+ }
+ this.cursorOptions.batchSize = value;
+ return this;
+ }
+ /**
+ * Rewind this cursor to its uninitialized state. Any options that are present on the cursor will
+ * remain in effect. Iterating this cursor will cause new queries to be sent to the server, even
+ * if the resultant data has already been retrieved by this cursor.
+ */
+ rewind() {
+ if (this.timeoutContext && this.timeoutContext.owner !== this) {
+ throw new error_1.MongoAPIError(`Cannot rewind cursor that does not own its timeout context.`);
+ }
+ if (!this.initialized) {
+ return;
+ }
+ this.cursorId = null;
+ this.documents?.clear();
+ this.timeoutContext?.clear();
+ this.timeoutContext = undefined;
+ this.isClosed = false;
+ this.isKilled = false;
+ this.initialized = false;
+ this.hasEmittedClose = false;
+ this.trackCursor();
+ // We only want to end this session if we created it, and it hasn't ended yet
+ if (this.cursorSession?.explicit === false) {
+ if (!this.cursorSession.hasEnded) {
+ this.cursorSession.endSession().then(undefined, utils_1.squashError);
+ }
+ this.cursorSession = null;
+ }
+ }
+ /** @internal */
+ async getMore() {
+ if (this.cursorId == null) {
+ throw new error_1.MongoRuntimeError('Unexpected null cursor id. A cursor creating command should have set this');
+ }
+ if (this.selectedServer == null) {
+ throw new error_1.MongoRuntimeError('Unexpected null selectedServer. A cursor creating command should have set this');
+ }
+ if (this.cursorSession == null) {
+ throw new error_1.MongoRuntimeError('Unexpected null session. A cursor creating command should have set this');
+ }
+ const getMoreOptions = {
+ ...this.cursorOptions,
+ session: this.cursorSession,
+ batchSize: this.cursorOptions.batchSize
+ };
+ const getMoreOperation = new get_more_1.GetMoreOperation(this.cursorNamespace, this.cursorId, this.selectedServer, getMoreOptions);
+ return await (0, execute_operation_1.executeOperation)(this.cursorClient, getMoreOperation, this.timeoutContext);
+ }
+ /**
+ * @internal
+ *
+ * This function is exposed for the unified test runner's createChangeStream
+ * operation. We cannot refactor to use the abstract _initialize method without
+ * a significant refactor.
+ */
+ async cursorInit() {
+ if (this.cursorOptions.timeoutMS != null) {
+ this.timeoutContext ??= new CursorTimeoutContext(timeout_1.TimeoutContext.create({
+ serverSelectionTimeoutMS: this.client.s.options.serverSelectionTimeoutMS,
+ timeoutMS: this.cursorOptions.timeoutMS
+ }), this);
+ }
+ try {
+ this.cursorSession ??= this.cursorClient.startSession({ owner: this, explicit: false });
+ const state = await this._initialize(this.cursorSession);
+ // Set omitMaxTimeMS to the value needed for subsequent getMore calls
+ this.cursorOptions.omitMaxTimeMS = this.cursorOptions.timeoutMS != null;
+ const response = state.response;
+ this.selectedServer = state.server;
+ this.cursorId = response.id;
+ this.cursorNamespace = response.ns ?? this.namespace;
+ this.documents = response;
+ this.initialized = true; // the cursor is now initialized, even if it is dead
+ }
+ catch (error) {
+ // the cursor is now initialized, even if an error occurred
+ this.initialized = true;
+ await this.cleanup(undefined, error);
+ throw error;
+ }
+ if (this.isDead) {
+ await this.cleanup();
+ }
+ return;
+ }
+ /** @internal Attempt to obtain more documents */
+ async fetchBatch() {
+ if (this.isClosed) {
+ return;
+ }
+ if (this.isDead) {
+ // if the cursor is dead, we clean it up
+ // cleanupCursor should never throw, but if it does it indicates a bug in the driver
+ // and we should surface the error
+ await this.cleanup();
+ return;
+ }
+ if (this.cursorId == null) {
+ await this.cursorInit();
+ // If the cursor died or returned documents, return
+ if ((this.documents?.length ?? 0) !== 0 || this.isDead)
+ return;
+ }
+ // Otherwise, run a getMore
+ try {
+ const response = await this.getMore();
+ this.cursorId = response.id;
+ this.documents = response;
+ }
+ catch (error) {
+ try {
+ await this.cleanup(undefined, error);
+ }
+ catch (cleanupError) {
+ // `cleanupCursor` should never throw, squash and throw the original error
+ (0, utils_1.squashError)(cleanupError);
+ }
+ throw error;
+ }
+ if (this.isDead) {
+ // If we successfully received a response from a cursor BUT the cursor indicates that it is exhausted,
+ // we intentionally clean up the cursor to release its session back into the pool before the cursor
+ // is iterated. This prevents a cursor that is exhausted on the server from holding
+ // onto a session indefinitely until the AbstractCursor is iterated.
+ //
+ // cleanupCursorAsync should never throw, but if it does it indicates a bug in the driver
+ // and we should surface the error
+ await this.cleanup();
+ }
+ }
+ /** @internal */
+ async cleanup(timeoutMS, error) {
+ this.abortListener?.[utils_1.kDispose]();
+ this.isClosed = true;
+ const timeoutContextForKillCursors = () => {
+ if (timeoutMS != null) {
+ this.timeoutContext?.clear();
+ return new CursorTimeoutContext(timeout_1.TimeoutContext.create({
+ serverSelectionTimeoutMS: this.client.s.options.serverSelectionTimeoutMS,
+ timeoutMS
+ }), this);
+ }
+ else {
+ return this.timeoutContext?.refreshed();
+ }
+ };
+ const withEmitClose = async (fn) => {
+ try {
+ await fn();
+ }
+ finally {
+ this.emitClose();
+ }
+ };
+ const close = async () => {
+ // if no session has been defined on the cursor, the cursor was never initialized
+ // or the cursor was re-wound and never re-iterated. In either case, we
+ // 1. do not need to end the session (there is no session after all)
+ // 2. do not need to kill the cursor server-side
+ const session = this.cursorSession;
+ if (!session)
+ return;
+ try {
+ if (!this.isKilled &&
+ this.cursorId &&
+ !this.cursorId.isZero() &&
+ this.cursorNamespace &&
+ this.selectedServer &&
+ !session.hasEnded) {
+ this.isKilled = true;
+ const cursorId = this.cursorId;
+ this.cursorId = bson_1.Long.ZERO;
+ await (0, execute_operation_1.executeOperation)(this.cursorClient, new kill_cursors_1.KillCursorsOperation(cursorId, this.cursorNamespace, this.selectedServer, {
+ session
+ }), timeoutContextForKillCursors());
+ }
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ finally {
+ if (session.owner === this) {
+ await session.endSession({ error });
+ }
+ if (!session.inTransaction()) {
+ (0, sessions_1.maybeClearPinnedConnection)(session, { error });
+ }
+ }
+ };
+ await withEmitClose(close);
+ }
+ /** @internal */
+ emitClose() {
+ try {
+ if (!this.hasEmittedClose && ((this.documents?.length ?? 0) === 0 || this.isClosed)) {
+ // @ts-expect-error: CursorEvents is generic so Parameters may not be assignable to `[]`. Not sure how to require extenders do not add parameters.
+ this.emit('close');
+ }
+ }
+ finally {
+ this.hasEmittedClose = true;
+ }
+ }
+ /** @internal */
+ async transformDocument(document) {
+ if (this.transform == null)
+ return document;
+ try {
+ const transformedDocument = this.transform(document);
+ // eslint-disable-next-line no-restricted-syntax
+ if (transformedDocument === null) {
+ const TRANSFORM_TO_NULL_ERROR = 'Cursor returned a `null` document, but the cursor is not exhausted. Mapping documents to `null` is not supported in the cursor transform.';
+ throw new error_1.MongoAPIError(TRANSFORM_TO_NULL_ERROR);
+ }
+ return transformedDocument;
+ }
+ catch (transformError) {
+ try {
+ await this.close();
+ }
+ catch (closeError) {
+ (0, utils_1.squashError)(closeError);
+ }
+ throw transformError;
+ }
+ }
+ /** @internal */
+ throwIfInitialized() {
+ if (this.initialized)
+ throw new error_1.MongoCursorInUseError();
+ }
+}
+exports.AbstractCursor = AbstractCursor;
+class ReadableCursorStream extends stream_1.Readable {
+ constructor(cursor) {
+ super({
+ objectMode: true,
+ autoDestroy: false,
+ highWaterMark: 1
+ });
+ this._readInProgress = false;
+ this._cursor = cursor;
+ }
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ _read(size) {
+ if (!this._readInProgress) {
+ this._readInProgress = true;
+ this._readNext();
+ }
+ }
+ _destroy(error, callback) {
+ this._cursor.close().then(() => callback(error), closeError => callback(closeError));
+ }
+ _readNext() {
+ if (this._cursor.id === bson_1.Long.ZERO) {
+ this.push(null);
+ return;
+ }
+ this._cursor
+ .next()
+ .then(
+ // result from next()
+ result => {
+ if (result == null) {
+ this.push(null);
+ }
+ else if (this.destroyed) {
+ this._cursor.close().then(undefined, utils_1.squashError);
+ }
+ else {
+ if (this.push(result)) {
+ return this._readNext();
+ }
+ this._readInProgress = false;
+ }
+ },
+ // error from next()
+ err => {
+ // NOTE: This is questionable, but we have a test backing the behavior. It seems the
+ // desired behavior is that a stream ends cleanly when a user explicitly closes
+ // a client during iteration. Alternatively, we could do the "right" thing and
+ // propagate the error message by removing this special case.
+ if (err.message.match(/server is closed/)) {
+ this._cursor.close().then(undefined, utils_1.squashError);
+ return this.push(null);
+ }
+ // NOTE: This is also perhaps questionable. The rationale here is that these errors tend
+ // to be "operation was interrupted", where a cursor has been closed but there is an
+ // active getMore in-flight. This used to check if the cursor was killed but once
+ // that changed to happen in cleanup legitimate errors would not destroy the
+ // stream. There are change streams test specifically test these cases.
+ if (err.message.match(/operation was interrupted/)) {
+ return this.push(null);
+ }
+ // NOTE: The two above checks on the message of the error will cause a null to be pushed
+ // to the stream, thus closing the stream before the destroy call happens. This means
+ // that either of those error messages on a change stream will not get a proper
+ // 'error' event to be emitted (the error passed to destroy). Change stream resumability
+ // relies on that error event to be emitted to create its new cursor and thus was not
+ // working on 4.4 servers because the error emitted on failover was "interrupted at
+ // shutdown" while on 5.0+ it is "The server is in quiesce mode and will shut down".
+ // See NODE-4475.
+ return this.destroy(err);
+ })
+ // if either of the above handlers throw
+ .catch(error => {
+ this._readInProgress = false;
+ this.destroy(error);
+ });
+ }
+}
+/**
+ * @internal
+ * The cursor timeout context is a wrapper around a timeout context
+ * that keeps track of the "owner" of the cursor. For timeout contexts
+ * instantiated inside a cursor, the owner will be the cursor.
+ *
+ * All timeout behavior is exactly the same as the wrapped timeout context's.
+ */
+class CursorTimeoutContext extends timeout_1.TimeoutContext {
+ constructor(timeoutContext, owner) {
+ super();
+ this.timeoutContext = timeoutContext;
+ this.owner = owner;
+ }
+ get serverSelectionTimeout() {
+ return this.timeoutContext.serverSelectionTimeout;
+ }
+ get connectionCheckoutTimeout() {
+ return this.timeoutContext.connectionCheckoutTimeout;
+ }
+ get clearServerSelectionTimeout() {
+ return this.timeoutContext.clearServerSelectionTimeout;
+ }
+ get timeoutForSocketWrite() {
+ return this.timeoutContext.timeoutForSocketWrite;
+ }
+ get timeoutForSocketRead() {
+ return this.timeoutContext.timeoutForSocketRead;
+ }
+ csotEnabled() {
+ return this.timeoutContext.csotEnabled();
+ }
+ refresh() {
+ if (typeof this.owner !== 'symbol')
+ return this.timeoutContext.refresh();
+ }
+ clear() {
+ if (typeof this.owner !== 'symbol')
+ return this.timeoutContext.clear();
+ }
+ get maxTimeMS() {
+ return this.timeoutContext.maxTimeMS;
+ }
+ get timeoutMS() {
+ return this.timeoutContext.csotEnabled() ? this.timeoutContext.timeoutMS : null;
+ }
+ refreshed() {
+ return new CursorTimeoutContext(this.timeoutContext.refreshed(), this.owner);
+ }
+ addMaxTimeMSToCommand(command, options) {
+ this.timeoutContext.addMaxTimeMSToCommand(command, options);
+ }
+ getSocketTimeoutMS() {
+ return this.timeoutContext.getSocketTimeoutMS();
+ }
+}
+exports.CursorTimeoutContext = CursorTimeoutContext;
+//# sourceMappingURL=abstract_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/abstract_cursor.js.map b/node_modules/mongodb/lib/cursor/abstract_cursor.js.map
new file mode 100644
index 00000000..4cbc38ce
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/abstract_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"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IAAI,CAAC;IAClF,CAAC;IACQ,SAAS;QAChB,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/E,CAAC;IACQ,qBAAqB,CAAC,OAAiB,EAAE,OAAoC;QACpF,IAAI,CAAC,cAAc,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IACQ,kBAAkB;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;IAClD,CAAC;CACF;AAhDD,oDAgDC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/aggregation_cursor.js b/node_modules/mongodb/lib/cursor/aggregation_cursor.js
new file mode 100644
index 00000000..bfea310d
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/aggregation_cursor.js
@@ -0,0 +1,164 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AggregationCursor = void 0;
+const error_1 = require("../error");
+const explain_1 = require("../explain");
+const aggregate_1 = require("../operations/aggregate");
+const execute_operation_1 = require("../operations/execute_operation");
+const utils_1 = require("../utils");
+const abstract_cursor_1 = require("./abstract_cursor");
+const explainable_cursor_1 = require("./explainable_cursor");
+/**
+ * The **AggregationCursor** class is an internal class that embodies an aggregation cursor on MongoDB
+ * allowing for iteration over the results returned from the underlying query. It supports
+ * one by one document iteration, conversion to an array or can be iterated as a Node 4.X
+ * or higher stream
+ * @public
+ */
+class AggregationCursor extends explainable_cursor_1.ExplainableCursor {
+ /** @internal */
+ constructor(client, namespace, pipeline = [], options = {}) {
+ super(client, namespace, options);
+ this.pipeline = pipeline;
+ this.aggregateOptions = options;
+ const lastStage = this.pipeline[this.pipeline.length - 1];
+ if (this.cursorOptions.timeoutMS != null &&
+ this.cursorOptions.timeoutMode === abstract_cursor_1.CursorTimeoutMode.ITERATION &&
+ (lastStage?.$merge != null || lastStage?.$out != null))
+ throw new error_1.MongoAPIError('Cannot use $out or $merge stage with ITERATION timeoutMode');
+ }
+ clone() {
+ const clonedOptions = (0, utils_1.mergeOptions)({}, this.aggregateOptions);
+ delete clonedOptions.session;
+ return new AggregationCursor(this.client, this.namespace, this.pipeline, {
+ ...clonedOptions
+ });
+ }
+ map(transform) {
+ return super.map(transform);
+ }
+ /** @internal */
+ async _initialize(session) {
+ const options = {
+ ...this.aggregateOptions,
+ ...this.cursorOptions,
+ session,
+ signal: this.signal
+ };
+ if (options.explain) {
+ try {
+ (0, explain_1.validateExplainTimeoutOptions)(options, explain_1.Explain.fromOptions(options));
+ }
+ catch {
+ throw new error_1.MongoAPIError('timeoutMS cannot be used with explain when explain is specified in aggregateOptions');
+ }
+ }
+ const aggregateOperation = new aggregate_1.AggregateOperation(this.namespace, this.pipeline, options);
+ const response = await (0, execute_operation_1.executeOperation)(this.client, aggregateOperation, this.timeoutContext);
+ return { server: aggregateOperation.server, session, response };
+ }
+ async explain(verbosity, options) {
+ const { explain, timeout } = this.resolveExplainTimeoutOptions(verbosity, options);
+ return (await (0, execute_operation_1.executeOperation)(this.client, new aggregate_1.AggregateOperation(this.namespace, this.pipeline, {
+ ...this.aggregateOptions, // NOTE: order matters here, we may need to refine this
+ ...this.cursorOptions,
+ ...timeout,
+ explain: explain ?? true
+ }))).shift(this.deserializationOptions);
+ }
+ addStage(stage) {
+ this.throwIfInitialized();
+ if (this.cursorOptions.timeoutMS != null &&
+ this.cursorOptions.timeoutMode === abstract_cursor_1.CursorTimeoutMode.ITERATION &&
+ (stage.$out != null || stage.$merge != null)) {
+ throw new error_1.MongoAPIError('Cannot use $out or $merge stage with ITERATION timeoutMode');
+ }
+ this.pipeline.push(stage);
+ return this;
+ }
+ group($group) {
+ return this.addStage({ $group });
+ }
+ /** Add a limit stage to the aggregation pipeline */
+ limit($limit) {
+ return this.addStage({ $limit });
+ }
+ /** Add a match stage to the aggregation pipeline */
+ match($match) {
+ return this.addStage({ $match });
+ }
+ /** Add an out stage to the aggregation pipeline */
+ out($out) {
+ return this.addStage({ $out });
+ }
+ /**
+ * Add a project stage to the aggregation pipeline
+ *
+ * @remarks
+ * In order to strictly type this function you must provide an interface
+ * that represents the effect of your projection on the result documents.
+ *
+ * By default chaining a projection to your cursor changes the returned type to the generic {@link Document} type.
+ * You should specify a parameterized type to have assertions on your final results.
+ *
+ * @example
+ * ```typescript
+ * // Best way
+ * const docs: AggregationCursor<{ a: number }> = cursor.project<{ a: number }>({ _id: 0, a: true });
+ * // Flexible way
+ * const docs: AggregationCursor = cursor.project({ _id: 0, a: true });
+ * ```
+ *
+ * @remarks
+ * In order to strictly type this function you must provide an interface
+ * that represents the effect of your projection on the result documents.
+ *
+ * **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
+ * it **does not** return a new instance of a cursor. This means when calling project,
+ * you should always assign the result to a new variable in order to get a correctly typed cursor variable.
+ * Take note of the following example:
+ *
+ * @example
+ * ```typescript
+ * const cursor: AggregationCursor<{ a: number; b: string }> = coll.aggregate([]);
+ * const projectCursor = cursor.project<{ a: number }>({ _id: 0, a: true });
+ * const aPropOnlyArray: {a: number}[] = await projectCursor.toArray();
+ *
+ * // or always use chaining and save the final cursor
+ *
+ * const cursor = coll.aggregate().project<{ a: string }>({
+ * _id: 0,
+ * a: { $convert: { input: '$a', to: 'string' }
+ * }});
+ * ```
+ */
+ project($project) {
+ return this.addStage({ $project });
+ }
+ /** Add a lookup stage to the aggregation pipeline */
+ lookup($lookup) {
+ return this.addStage({ $lookup });
+ }
+ /** Add a redact stage to the aggregation pipeline */
+ redact($redact) {
+ return this.addStage({ $redact });
+ }
+ /** Add a skip stage to the aggregation pipeline */
+ skip($skip) {
+ return this.addStage({ $skip });
+ }
+ /** Add a sort stage to the aggregation pipeline */
+ sort($sort) {
+ return this.addStage({ $sort });
+ }
+ /** Add a unwind stage to the aggregation pipeline */
+ unwind($unwind) {
+ return this.addStage({ $unwind });
+ }
+ /** Add a geoNear stage to the aggregation pipeline */
+ geoNear($geoNear) {
+ return this.addStage({ $geoNear });
+ }
+}
+exports.AggregationCursor = AggregationCursor;
+//# sourceMappingURL=aggregation_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/aggregation_cursor.js.map b/node_modules/mongodb/lib/cursor/aggregation_cursor.js.map
new file mode 100644
index 00000000..55b1cffc
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/aggregation_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"aggregation_cursor.js","sourceRoot":"","sources":["../../src/cursor/aggregation_cursor.ts"],"names":[],"mappings":";;;AACA,oCAAyC;AACzC,wCAKoB;AAGpB,uDAAoF;AACpF,uEAAmE;AAGnE,oCAA+D;AAC/D,uDAI2B;AAC3B,6DAAyD;AAKzD;;;;;;GAMG;AACH,MAAa,iBAAiC,SAAQ,sCAA0B;IAK9E,gBAAgB;IAChB,YACE,MAAmB,EACnB,SAA2B,EAC3B,WAAuB,EAAE,EACzB,UAAwC,EAAE;QAE1C,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAElC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;QAEhC,MAAM,SAAS,GAAyB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAEhF,IACE,IAAI,CAAC,aAAa,CAAC,SAAS,IAAI,IAAI;YACpC,IAAI,CAAC,aAAa,CAAC,WAAW,KAAK,mCAAiB,CAAC,SAAS;YAC9D,CAAC,SAAS,EAAE,MAAM,IAAI,IAAI,IAAI,SAAS,EAAE,IAAI,IAAI,IAAI,CAAC;YAEtD,MAAM,IAAI,qBAAa,CAAC,4DAA4D,CAAC,CAAC;IAC1F,CAAC;IAED,KAAK;QACH,MAAM,aAAa,GAAG,IAAA,oBAAY,EAAC,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC9D,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;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,OAAO,CAAgC,QAAkB;QACvD,OAAO,IAAI,CAAC,QAAQ,CAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,qDAAqD;IACrD,MAAM,CAAC,OAAiB;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,qDAAqD;IACrD,MAAM,CAAC,OAAiB;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,mDAAmD;IACnD,IAAI,CAAC,KAAa;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,mDAAmD;IACnD,IAAI,CAAC,KAAW;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,qDAAqD;IACrD,MAAM,CAAC,OAA0B;QAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,sDAAsD;IACtD,OAAO,CAAC,QAAkB;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrC,CAAC;CACF;AApND,8CAoNC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/change_stream_cursor.js b/node_modules/mongodb/lib/cursor/change_stream_cursor.js
new file mode 100644
index 00000000..ca2a28cc
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/change_stream_cursor.js
@@ -0,0 +1,104 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ChangeStreamCursor = void 0;
+const change_stream_1 = require("../change_stream");
+const constants_1 = require("../constants");
+const aggregate_1 = require("../operations/aggregate");
+const execute_operation_1 = require("../operations/execute_operation");
+const utils_1 = require("../utils");
+const abstract_cursor_1 = require("./abstract_cursor");
+/** @internal */
+class ChangeStreamCursor extends abstract_cursor_1.AbstractCursor {
+ constructor(client, namespace, pipeline = [], options = {}) {
+ super(client, namespace, { ...options, tailable: true, awaitData: true });
+ this.pipeline = pipeline;
+ this.changeStreamCursorOptions = options;
+ this._resumeToken = null;
+ this.startAtOperationTime = options.startAtOperationTime ?? null;
+ if (options.startAfter) {
+ this.resumeToken = options.startAfter;
+ }
+ else if (options.resumeAfter) {
+ this.resumeToken = options.resumeAfter;
+ }
+ }
+ set resumeToken(token) {
+ this._resumeToken = token;
+ this.emit(change_stream_1.ChangeStream.RESUME_TOKEN_CHANGED, token);
+ }
+ get resumeToken() {
+ return this._resumeToken;
+ }
+ get resumeOptions() {
+ const options = {
+ ...this.changeStreamCursorOptions
+ };
+ for (const key of ['resumeAfter', 'startAfter', 'startAtOperationTime']) {
+ delete options[key];
+ }
+ if (this.resumeToken != null) {
+ if (this.changeStreamCursorOptions.startAfter && !this.hasReceived) {
+ options.startAfter = this.resumeToken;
+ }
+ else {
+ options.resumeAfter = this.resumeToken;
+ }
+ }
+ else if (this.startAtOperationTime != null) {
+ options.startAtOperationTime = this.startAtOperationTime;
+ }
+ return options;
+ }
+ cacheResumeToken(resumeToken) {
+ if (this.bufferedCount() === 0 && this.postBatchResumeToken) {
+ this.resumeToken = this.postBatchResumeToken;
+ }
+ else {
+ this.resumeToken = resumeToken;
+ }
+ this.hasReceived = true;
+ }
+ _processBatch(response) {
+ const { postBatchResumeToken } = response;
+ if (postBatchResumeToken) {
+ this.postBatchResumeToken = postBatchResumeToken;
+ if (response.batchSize === 0) {
+ this.resumeToken = postBatchResumeToken;
+ }
+ }
+ }
+ clone() {
+ return new ChangeStreamCursor(this.client, this.namespace, this.pipeline, {
+ ...this.cursorOptions
+ });
+ }
+ async _initialize(session) {
+ const aggregateOperation = new aggregate_1.AggregateOperation(this.namespace, this.pipeline, {
+ ...this.cursorOptions,
+ ...this.changeStreamCursorOptions,
+ session
+ });
+ const response = await (0, execute_operation_1.executeOperation)(session.client, aggregateOperation, this.timeoutContext);
+ const server = aggregateOperation.server;
+ this.maxWireVersion = (0, utils_1.maxWireVersion)(server);
+ if (this.startAtOperationTime == null &&
+ this.changeStreamCursorOptions.resumeAfter == null &&
+ this.changeStreamCursorOptions.startAfter == null) {
+ this.startAtOperationTime = response.operationTime;
+ }
+ this._processBatch(response);
+ this.emit(constants_1.INIT, response);
+ this.emit(constants_1.RESPONSE);
+ return { server, session, response };
+ }
+ async getMore() {
+ const response = await super.getMore();
+ this.maxWireVersion = (0, utils_1.maxWireVersion)(this.server);
+ this._processBatch(response);
+ this.emit(change_stream_1.ChangeStream.MORE, response);
+ this.emit(change_stream_1.ChangeStream.RESPONSE);
+ return response;
+ }
+}
+exports.ChangeStreamCursor = ChangeStreamCursor;
+//# sourceMappingURL=change_stream_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/change_stream_cursor.js.map b/node_modules/mongodb/lib/cursor/change_stream_cursor.js.map
new file mode 100644
index 00000000..b7e8cc63
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/change_stream_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"change_stream_cursor.js","sourceRoot":"","sources":["../../src/cursor/change_stream_cursor.ts"],"names":[],"mappings":";;;AACA,oDAM0B;AAE1B,4CAA8C;AAE9C,uDAA6D;AAE7D,uEAAmE;AAEnE,oCAAiE;AACjE,uDAI2B;AAY3B,gBAAgB;AAChB,MAAa,kBAGX,SAAQ,gCAA2C;IAenD,YACE,MAAmB,EACnB,SAA2B,EAC3B,WAAuB,EAAE,EACzB,UAAqC,EAAE;QAEvC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE1E,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CA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AI,CAAC,cAAc,GAAG,IAAA,sBAAc,EAAC,MAAM,CAAC,CAAC;QAE7C,IACE,IAAI,CAAC,oBAAoB,IAAI,IAAI;YACjC,IAAI,CAAC,yBAAyB,CAAC,WAAW,IAAI,IAAI;YAClD,IAAI,CAAC,yBAAyB,CAAC,UAAU,IAAI,IAAI,EACjD,CAAC;YACD,IAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC,aAAa,CAAC;QACrD,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAE7B,IAAI,CAAC,IAAI,CAAC,gBAAI,EAAE,QAAQ,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,oBAAQ,CAAC,CAAC;QAEpB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IACvC,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QAEvC,IAAI,CAAC,cAAc,GAAG,IAAA,sBAAc,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAE7B,IAAI,CAAC,IAAI,CAAC,4BAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,4BAAY,CAAC,QAAQ,CAAC,CAAC;QACjC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAzID,gDAyIC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.js b/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.js
new file mode 100644
index 00000000..6abd4ec4
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.js
@@ -0,0 +1,52 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ClientBulkWriteCursor = void 0;
+const client_bulk_write_1 = require("../operations/client_bulk_write/client_bulk_write");
+const execute_operation_1 = require("../operations/execute_operation");
+const utils_1 = require("../utils");
+const abstract_cursor_1 = require("./abstract_cursor");
+/**
+ * This is the cursor that handles client bulk write operations. Note this is never
+ * exposed directly to the user and is always immediately exhausted.
+ * @internal
+ */
+class ClientBulkWriteCursor extends abstract_cursor_1.AbstractCursor {
+ /** @internal */
+ constructor(client, commandBuilder, options = {}) {
+ super(client, new utils_1.MongoDBNamespace('admin', '$cmd'), options);
+ this.commandBuilder = commandBuilder;
+ this.clientBulkWriteOptions = options;
+ }
+ /**
+ * We need a way to get the top level cursor response fields for
+ * generating the bulk write result, so we expose this here.
+ */
+ get response() {
+ if (this.cursorResponse)
+ return this.cursorResponse;
+ return null;
+ }
+ get operations() {
+ return this.commandBuilder.lastOperations;
+ }
+ clone() {
+ const clonedOptions = (0, utils_1.mergeOptions)({}, this.clientBulkWriteOptions);
+ delete clonedOptions.session;
+ return new ClientBulkWriteCursor(this.client, this.commandBuilder, {
+ ...clonedOptions
+ });
+ }
+ /** @internal */
+ async _initialize(session) {
+ const clientBulkWriteOperation = new client_bulk_write_1.ClientBulkWriteOperation(this.commandBuilder, {
+ ...this.clientBulkWriteOptions,
+ ...this.cursorOptions,
+ session
+ });
+ const response = await (0, execute_operation_1.executeOperation)(this.client, clientBulkWriteOperation, this.timeoutContext);
+ this.cursorResponse = response;
+ return { server: clientBulkWriteOperation.server, session, response };
+ }
+}
+exports.ClientBulkWriteCursor = ClientBulkWriteCursor;
+//# sourceMappingURL=client_bulk_write_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.js.map b/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.js.map
new file mode 100644
index 00000000..ad28ab4b
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"client_bulk_write_cursor.js","sourceRoot":"","sources":["../../src/cursor/client_bulk_write_cursor.ts"],"names":[],"mappings":";;;A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OAAO,EAAE,MAAM,EAAE,wBAAwB,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IACxE,CAAC;CACF;AAzDD,sDAyDC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/explainable_cursor.js b/node_modules/mongodb/lib/cursor/explainable_cursor.js
new file mode 100644
index 00000000..d4717b6e
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/explainable_cursor.js
@@ -0,0 +1,36 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ExplainableCursor = void 0;
+const abstract_cursor_1 = require("./abstract_cursor");
+/**
+ * @public
+ *
+ * A base class for any cursors that have `explain()` methods.
+ */
+class ExplainableCursor extends abstract_cursor_1.AbstractCursor {
+ resolveExplainTimeoutOptions(verbosity, options) {
+ let explain;
+ let timeout;
+ if (verbosity == null && options == null) {
+ explain = undefined;
+ timeout = undefined;
+ }
+ else if (verbosity != null && options == null) {
+ explain =
+ typeof verbosity !== 'object'
+ ? verbosity
+ : 'verbosity' in verbosity
+ ? verbosity
+ : undefined;
+ timeout = typeof verbosity === 'object' && 'timeoutMS' in verbosity ? verbosity : undefined;
+ }
+ else {
+ // @ts-expect-error TS isn't smart enough to determine that if both options are provided, the first is explain options
+ explain = verbosity;
+ timeout = options;
+ }
+ return { timeout, explain };
+ }
+}
+exports.ExplainableCursor = ExplainableCursor;
+//# sourceMappingURL=explainable_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/explainable_cursor.js.map b/node_modules/mongodb/lib/cursor/explainable_cursor.js.map
new file mode 100644
index 00000000..c0a14cc0
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/explainable_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"explainable_cursor.js","sourceRoot":"","sources":["../../src/cursor/explainable_cursor.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AAEnD;;;;GAIG;AACH,MAAsB,iBAA2B,SAAQ,gCAAuB;IAcpE,4BAA4B,CACpC,SAAiF,EACjF,OAAgC;QAEhC,IAAI,OAAiE,CAAC;QACtE,IAAI,OAA2C,CAAC;QAEhD,IAAI,SAAS,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACzC,OAAO,GAAG,SAAS,CAAC;YACpB,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC;aAAM,IAAI,SAAS,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YAChD,OAAO;gBACL,OAAO,SAAS,KAAK,QAAQ;oBAC3B,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,WAAW,IAAI,SAAS;wBACxB,CAAC,CAAC,SAAS;wBACX,CAAC,CAAC,SAAS,CAAC;YAElB,OAAO,GAAG,OAAO,SAAS,KAAK,QAAQ,IAAI,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9F,CAAC;aAAM,CAAC;YACN,sHAAsH;YACtH,OAAO,GAAG,SAAS,CAAC;YACpB,OAAO,GAAG,OAAO,CAAC;QACpB,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC9B,CAAC;CACF;AAzCD,8CAyCC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/find_cursor.js b/node_modules/mongodb/lib/cursor/find_cursor.js
new file mode 100644
index 00000000..c10ba25c
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/find_cursor.js
@@ -0,0 +1,399 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.FindCursor = exports.FLAGS = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const explain_1 = require("../explain");
+const count_1 = require("../operations/count");
+const execute_operation_1 = require("../operations/execute_operation");
+const find_1 = require("../operations/find");
+const sort_1 = require("../sort");
+const utils_1 = require("../utils");
+const explainable_cursor_1 = require("./explainable_cursor");
+/** @public Flags allowed for cursor */
+exports.FLAGS = [
+ 'tailable',
+ 'oplogReplay',
+ 'noCursorTimeout',
+ 'awaitData',
+ 'exhaust',
+ 'partial'
+];
+/** @public */
+class FindCursor extends explainable_cursor_1.ExplainableCursor {
+ /** @internal */
+ constructor(client, namespace, filter = {}, options = {}) {
+ super(client, namespace, options);
+ /** @internal */
+ this.numReturned = 0;
+ this.cursorFilter = filter;
+ this.findOptions = options;
+ if (options.sort != null) {
+ this.findOptions.sort = (0, sort_1.formatSort)(options.sort);
+ }
+ }
+ clone() {
+ const clonedOptions = (0, utils_1.mergeOptions)({}, this.findOptions);
+ delete clonedOptions.session;
+ return new FindCursor(this.client, this.namespace, this.cursorFilter, {
+ ...clonedOptions
+ });
+ }
+ map(transform) {
+ return super.map(transform);
+ }
+ /** @internal */
+ async _initialize(session) {
+ const options = {
+ ...this.findOptions, // NOTE: order matters here, we may need to refine this
+ ...this.cursorOptions,
+ session,
+ signal: this.signal
+ };
+ if (options.explain) {
+ try {
+ (0, explain_1.validateExplainTimeoutOptions)(options, explain_1.Explain.fromOptions(options));
+ }
+ catch {
+ throw new error_1.MongoAPIError('timeoutMS cannot be used with explain when explain is specified in findOptions');
+ }
+ }
+ const findOperation = new find_1.FindOperation(this.namespace, this.cursorFilter, options);
+ const response = await (0, execute_operation_1.executeOperation)(this.client, findOperation, this.timeoutContext);
+ // the response is not a cursor when `explain` is enabled
+ this.numReturned = response.batchSize;
+ return { server: findOperation.server, session, response };
+ }
+ /** @internal */
+ async getMore() {
+ const numReturned = this.numReturned;
+ const limit = this.findOptions.limit ?? Infinity;
+ const remaining = limit - numReturned;
+ if (numReturned === limit && !this.id?.isZero()) {
+ // this is an optimization for the special case of a limit for a find command to avoid an
+ // extra getMore when the limit has been reached and the limit is a multiple of the batchSize.
+ // This is a consequence of the new query engine in 5.0 having no knowledge of the limit as it
+ // produces results for the find command. Once a batch is filled up, it is returned and only
+ // on the subsequent getMore will the query framework consider the limit, determine the cursor
+ // is exhausted and return a cursorId of zero.
+ // instead, if we determine there are no more documents to request from the server, we preemptively
+ // close the cursor
+ try {
+ await this.close();
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ return responses_1.CursorResponse.emptyGetMore;
+ }
+ // TODO(DRIVERS-1448): Remove logic to enforce `limit` in the driver
+ let cleanup = utils_1.noop;
+ const { batchSize } = this.cursorOptions;
+ if (batchSize != null && batchSize > remaining) {
+ this.cursorOptions.batchSize = remaining;
+ // After executing the final getMore, re-assign the batchSize back to its original value so that
+ // if the cursor is rewound and executed, the batchSize is still correct.
+ cleanup = () => {
+ this.cursorOptions.batchSize = batchSize;
+ };
+ }
+ try {
+ const response = await super.getMore();
+ this.numReturned = this.numReturned + response.batchSize;
+ return response;
+ }
+ finally {
+ cleanup?.();
+ }
+ }
+ /**
+ * Get the count of documents for this cursor
+ * @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead
+ */
+ async count(options) {
+ (0, utils_1.emitWarningOnce)('cursor.count is deprecated and will be removed in the next major version, please use `collection.estimatedDocumentCount` or `collection.countDocuments` instead ');
+ if (typeof options === 'boolean') {
+ throw new error_1.MongoInvalidArgumentError('Invalid first parameter to count');
+ }
+ return await (0, execute_operation_1.executeOperation)(this.client, new count_1.CountOperation(this.namespace, this.cursorFilter, {
+ ...this.findOptions, // NOTE: order matters here, we may need to refine this
+ ...this.cursorOptions,
+ ...options
+ }));
+ }
+ async explain(verbosity, options) {
+ const { explain, timeout } = this.resolveExplainTimeoutOptions(verbosity, options);
+ return (await (0, execute_operation_1.executeOperation)(this.client, new find_1.FindOperation(this.namespace, this.cursorFilter, {
+ ...this.findOptions, // NOTE: order matters here, we may need to refine this
+ ...this.cursorOptions,
+ ...timeout,
+ explain: explain ?? true
+ }))).shift(this.deserializationOptions);
+ }
+ /** Set the cursor query */
+ filter(filter) {
+ this.throwIfInitialized();
+ this.cursorFilter = filter;
+ return this;
+ }
+ /**
+ * Set the cursor hint
+ *
+ * @param hint - If specified, then the query system will only consider plans using the hinted index.
+ */
+ hint(hint) {
+ this.throwIfInitialized();
+ this.findOptions.hint = hint;
+ return this;
+ }
+ /**
+ * Set the cursor min
+ *
+ * @param min - Specify a $min value to specify the inclusive lower bound for a specific index in order to constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order.
+ */
+ min(min) {
+ this.throwIfInitialized();
+ this.findOptions.min = min;
+ return this;
+ }
+ /**
+ * Set the cursor max
+ *
+ * @param max - Specify a $max value to specify the exclusive upper bound for a specific index in order to constrain the results of find(). The $max specifies the upper bound for all keys of a specific index in order.
+ */
+ max(max) {
+ this.throwIfInitialized();
+ this.findOptions.max = max;
+ return this;
+ }
+ /**
+ * Set the cursor returnKey.
+ * If set to true, modifies the cursor to only return the index field or fields for the results of the query, rather than documents.
+ * If set to true and the query does not use an index to perform the read operation, the returned documents will not contain any fields.
+ *
+ * @param value - the returnKey value.
+ */
+ returnKey(value) {
+ this.throwIfInitialized();
+ this.findOptions.returnKey = value;
+ return this;
+ }
+ /**
+ * Modifies the output of a query by adding a field $recordId to matching documents. $recordId is the internal key which uniquely identifies a document in a collection.
+ *
+ * @param value - The $showDiskLoc option has now been deprecated and replaced with the showRecordId field. $showDiskLoc will still be accepted for OP_QUERY stye find.
+ */
+ showRecordId(value) {
+ this.throwIfInitialized();
+ this.findOptions.showRecordId = value;
+ return this;
+ }
+ /**
+ * Add a query modifier to the cursor query
+ *
+ * @param name - The query modifier (must start with $, such as $orderby etc)
+ * @param value - The modifier value.
+ */
+ addQueryModifier(name, value) {
+ this.throwIfInitialized();
+ if (name[0] !== '$') {
+ throw new error_1.MongoInvalidArgumentError(`${name} is not a valid query modifier`);
+ }
+ // Strip of the $
+ const field = name.substr(1);
+ // NOTE: consider some TS magic for this
+ switch (field) {
+ case 'comment':
+ this.findOptions.comment = value;
+ break;
+ case 'explain':
+ this.findOptions.explain = value;
+ break;
+ case 'hint':
+ this.findOptions.hint = value;
+ break;
+ case 'max':
+ this.findOptions.max = value;
+ break;
+ case 'maxTimeMS':
+ this.findOptions.maxTimeMS = value;
+ break;
+ case 'min':
+ this.findOptions.min = value;
+ break;
+ case 'orderby':
+ this.findOptions.sort = (0, sort_1.formatSort)(value);
+ break;
+ case 'query':
+ this.cursorFilter = value;
+ break;
+ case 'returnKey':
+ this.findOptions.returnKey = value;
+ break;
+ case 'showDiskLoc':
+ this.findOptions.showRecordId = value;
+ break;
+ default:
+ throw new error_1.MongoInvalidArgumentError(`Invalid query modifier: ${name}`);
+ }
+ return this;
+ }
+ /**
+ * Add a comment to the cursor query allowing for tracking the comment in the log.
+ *
+ * @param value - The comment attached to this query.
+ */
+ comment(value) {
+ this.throwIfInitialized();
+ this.findOptions.comment = value;
+ return this;
+ }
+ /**
+ * Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise)
+ *
+ * @param value - Number of milliseconds to wait before aborting the tailed query.
+ */
+ maxAwaitTimeMS(value) {
+ this.throwIfInitialized();
+ if (typeof value !== 'number') {
+ throw new error_1.MongoInvalidArgumentError('Argument for maxAwaitTimeMS must be a number');
+ }
+ this.findOptions.maxAwaitTimeMS = value;
+ return this;
+ }
+ /**
+ * Set a maxTimeMS on the cursor query, allowing for hard timeout limits on queries (Only supported on MongoDB 2.6 or higher)
+ *
+ * @param value - Number of milliseconds to wait before aborting the query.
+ */
+ maxTimeMS(value) {
+ this.throwIfInitialized();
+ if (typeof value !== 'number') {
+ throw new error_1.MongoInvalidArgumentError('Argument for maxTimeMS must be a number');
+ }
+ this.findOptions.maxTimeMS = value;
+ return this;
+ }
+ /**
+ * Add a project stage to the aggregation pipeline
+ *
+ * @remarks
+ * In order to strictly type this function you must provide an interface
+ * that represents the effect of your projection on the result documents.
+ *
+ * By default chaining a projection to your cursor changes the returned type to the generic
+ * {@link Document} type.
+ * You should specify a parameterized type to have assertions on your final results.
+ *
+ * @example
+ * ```typescript
+ * // Best way
+ * const docs: FindCursor<{ a: number }> = cursor.project<{ a: number }>({ _id: 0, a: true });
+ * // Flexible way
+ * const docs: FindCursor = cursor.project({ _id: 0, a: true });
+ * ```
+ *
+ * @remarks
+ *
+ * **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
+ * it **does not** return a new instance of a cursor. This means when calling project,
+ * you should always assign the result to a new variable in order to get a correctly typed cursor variable.
+ * Take note of the following example:
+ *
+ * @example
+ * ```typescript
+ * const cursor: FindCursor<{ a: number; b: string }> = coll.find();
+ * const projectCursor = cursor.project<{ a: number }>({ _id: 0, a: true });
+ * const aPropOnlyArray: {a: number}[] = await projectCursor.toArray();
+ *
+ * // or always use chaining and save the final cursor
+ *
+ * const cursor = coll.find().project<{ a: string }>({
+ * _id: 0,
+ * a: { $convert: { input: '$a', to: 'string' }
+ * }});
+ * ```
+ */
+ project(value) {
+ this.throwIfInitialized();
+ this.findOptions.projection = value;
+ return this;
+ }
+ /**
+ * Sets the sort order of the cursor query.
+ *
+ * @param sort - The key or keys set for the sort.
+ * @param direction - The direction of the sorting (1 or -1).
+ */
+ sort(sort, direction) {
+ this.throwIfInitialized();
+ if (this.findOptions.tailable) {
+ throw new error_1.MongoTailableCursorError('Tailable cursor does not support sorting');
+ }
+ this.findOptions.sort = (0, sort_1.formatSort)(sort, direction);
+ return this;
+ }
+ /**
+ * Allows disk use for blocking sort operations exceeding 100MB memory. (MongoDB 3.2 or higher)
+ *
+ * @remarks
+ * {@link https://www.mongodb.com/docs/manual/reference/command/find/#find-cmd-allowdiskuse | find command allowDiskUse documentation}
+ */
+ allowDiskUse(allow = true) {
+ this.throwIfInitialized();
+ if (!this.findOptions.sort) {
+ throw new error_1.MongoInvalidArgumentError('Option "allowDiskUse" requires a sort specification');
+ }
+ // As of 6.0 the default is true. This allows users to get back to the old behavior.
+ if (!allow) {
+ this.findOptions.allowDiskUse = false;
+ return this;
+ }
+ this.findOptions.allowDiskUse = true;
+ return this;
+ }
+ /**
+ * Set the collation options for the cursor.
+ *
+ * @param value - The cursor collation options (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields).
+ */
+ collation(value) {
+ this.throwIfInitialized();
+ this.findOptions.collation = value;
+ return this;
+ }
+ /**
+ * Set the limit for the cursor.
+ *
+ * @param value - The limit for the cursor query.
+ */
+ limit(value) {
+ this.throwIfInitialized();
+ if (this.findOptions.tailable) {
+ throw new error_1.MongoTailableCursorError('Tailable cursor does not support limit');
+ }
+ if (typeof value !== 'number') {
+ throw new error_1.MongoInvalidArgumentError('Operation "limit" requires an integer');
+ }
+ this.findOptions.limit = value;
+ return this;
+ }
+ /**
+ * Set the skip for the cursor.
+ *
+ * @param value - The skip for the cursor query.
+ */
+ skip(value) {
+ this.throwIfInitialized();
+ if (this.findOptions.tailable) {
+ throw new error_1.MongoTailableCursorError('Tailable cursor does not support skip');
+ }
+ if (typeof value !== 'number') {
+ throw new error_1.MongoInvalidArgumentError('Operation "skip" requires an integer');
+ }
+ this.findOptions.skip = value;
+ return this;
+ }
+}
+exports.FindCursor = FindCursor;
+//# sourceMappingURL=find_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/find_cursor.js.map b/node_modules/mongodb/lib/cursor/find_cursor.js.map
new file mode 100644
index 00000000..2ee20498
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/find_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"find_cursor.js","sourceRoot":"","sources":["../../src/cursor/find_cursor.ts"],"names":[],"mappings":";;;AACA,+DAAiE;AACjE,oCAA8F;AAC9F,wCAKoB;AAIpB,+CAAwE;AACxE,uEAAmE;AACnE,6CAAqE;AAGrE,kCAAoE;AACpE,oCAAmG;AAEnG,6DAAyD;AAEzD,uCAAuC;AAC1B,QAAA,KAAK,GAAG;IACnB,UAAU;IACV,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,SAAS;IACT,SAAS;CACD,CAAC;AAEX,cAAc;AACd,MAAa,UAA0B,SAAQ,sCAA0B;IAQvE,gBAAgB;IAChB,YACE,MAAmB,EACnB,SAA2B,EAC3B,SAAmB,EAAE,EACrB,UAA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I,gCAAwB,CAAC,uCAAuC,CAAC,CAAC;QAC9E,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,iCAAyB,CAAC,sCAAsC,CAAC,CAAC;QAC9E,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,KAAK,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/cD,gCA+cC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/list_collections_cursor.js b/node_modules/mongodb/lib/cursor/list_collections_cursor.js
new file mode 100644
index 00000000..e0804057
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/list_collections_cursor.js
@@ -0,0 +1,34 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ListCollectionsCursor = void 0;
+const execute_operation_1 = require("../operations/execute_operation");
+const list_collections_1 = require("../operations/list_collections");
+const abstract_cursor_1 = require("./abstract_cursor");
+/** @public */
+class ListCollectionsCursor extends abstract_cursor_1.AbstractCursor {
+ constructor(db, filter, options) {
+ super(db.client, db.s.namespace, options);
+ this.parent = db;
+ this.filter = filter;
+ this.options = options;
+ }
+ clone() {
+ return new ListCollectionsCursor(this.parent, this.filter, {
+ ...this.options,
+ ...this.cursorOptions
+ });
+ }
+ /** @internal */
+ async _initialize(session) {
+ const operation = new list_collections_1.ListCollectionsOperation(this.parent, this.filter, {
+ ...this.cursorOptions,
+ ...this.options,
+ session,
+ signal: this.signal
+ });
+ const response = await (0, execute_operation_1.executeOperation)(this.parent.client, operation, this.timeoutContext);
+ return { server: operation.server, session, response };
+ }
+}
+exports.ListCollectionsCursor = ListCollectionsCursor;
+//# sourceMappingURL=list_collections_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/list_collections_cursor.js.map b/node_modules/mongodb/lib/cursor/list_collections_cursor.js.map
new file mode 100644
index 00000000..a02a42da
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/list_collections_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"list_collections_cursor.js","sourceRoot":"","sources":["../../src/cursor/list_collections_cursor.ts"],"names":[],"mappings":";;;AAGA,uEAAmE;AACnE,qEAIwC;AAExC,uDAA+E;AAE/E,cAAc;AACd,MAAa,qBAIX,SAAQ,gCAAiB;IAKzB,YAAY,EAAM,EAAE,MAAgB,EAAE,OAA4C;QAChF,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACzD,GAAG,IAAI,CAAC,OAAO;YACf,GAAG,IAAI,CAAC,aAAa;SACtB,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,WAAW,CAAC,OAAkC;QAClD,MAAM,SAAS,GAAG,IAAI,2CAAwB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACvE,GAAG,IAAI,CAAC,aAAa;YACrB,GAAG,IAAI,CAAC,OAAO;YACf,OAAO;YACP,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,IAAA,oCAAgB,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAE5F,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IACzD,CAAC;CACF;AApCD,sDAoCC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/list_indexes_cursor.js b/node_modules/mongodb/lib/cursor/list_indexes_cursor.js
new file mode 100644
index 00000000..a78a7fd2
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/list_indexes_cursor.js
@@ -0,0 +1,32 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ListIndexesCursor = void 0;
+const execute_operation_1 = require("../operations/execute_operation");
+const indexes_1 = require("../operations/indexes");
+const abstract_cursor_1 = require("./abstract_cursor");
+/** @public */
+class ListIndexesCursor extends abstract_cursor_1.AbstractCursor {
+ constructor(collection, options) {
+ super(collection.client, collection.s.namespace, options);
+ this.parent = collection;
+ this.options = options;
+ }
+ clone() {
+ return new ListIndexesCursor(this.parent, {
+ ...this.options,
+ ...this.cursorOptions
+ });
+ }
+ /** @internal */
+ async _initialize(session) {
+ const operation = new indexes_1.ListIndexesOperation(this.parent, {
+ ...this.cursorOptions,
+ ...this.options,
+ session
+ });
+ const response = await (0, execute_operation_1.executeOperation)(this.parent.client, operation, this.timeoutContext);
+ return { server: operation.server, session, response };
+ }
+}
+exports.ListIndexesCursor = ListIndexesCursor;
+//# sourceMappingURL=list_indexes_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/list_indexes_cursor.js.map b/node_modules/mongodb/lib/cursor/list_indexes_cursor.js.map
new file mode 100644
index 00000000..3962b584
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/list_indexes_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"list_indexes_cursor.js","sourceRoot":"","sources":["../../src/cursor/list_indexes_cursor.ts"],"names":[],"mappings":";;;AACA,uEAAmE;AACnE,mDAAsF;AAEtF,uDAA+E;AAE/E,cAAc;AACd,MAAa,iBAAkB,SAAQ,gCAAc;IAInD,YAAY,UAAsB,EAAE,OAA4B;QAC9D,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE;YACxC,GAAG,IAAI,CAAC,OAAO;YACf,GAAG,IAAI,CAAC,aAAa;SACtB,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,WAAW,CAAC,OAAkC;QAClD,MAAM,SAAS,GAAG,IAAI,8BAAoB,CAAC,IAAI,CAAC,MAAM,EAAE;YACtD,GAAG,IAAI,CAAC,aAAa;YACrB,GAAG,IAAI,CAAC,OAAO;YACf,OAAO;SACR,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,IAAA,oCAAgB,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAE5F,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IACzD,CAAC;CACF;AA7BD,8CA6BC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.js b/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.js
new file mode 100644
index 00000000..d9c39c70
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.js
@@ -0,0 +1,14 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ListSearchIndexesCursor = void 0;
+const aggregation_cursor_1 = require("./aggregation_cursor");
+/** @public */
+class ListSearchIndexesCursor extends aggregation_cursor_1.AggregationCursor {
+ /** @internal */
+ constructor({ fullNamespace: ns, client }, name, options = {}) {
+ const pipeline = name == null ? [{ $listSearchIndexes: {} }] : [{ $listSearchIndexes: { name } }];
+ super(client, ns, pipeline, options);
+ }
+}
+exports.ListSearchIndexesCursor = ListSearchIndexesCursor;
+//# sourceMappingURL=list_search_indexes_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.js.map b/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.js.map
new file mode 100644
index 00000000..6353a21a
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"list_search_indexes_cursor.js","sourceRoot":"","sources":["../../src/cursor/list_search_indexes_cursor.ts"],"names":[],"mappings":";;;AAEA,6DAAyD;AAKzD,cAAc;AACd,MAAa,uBAAwB,SAAQ,sCAAmC;IAC9E,gBAAgB;IAChB,YACE,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,EAAc,EACzC,IAAmB,EACnB,UAAoC,EAAE;QAEtC,MAAM,QAAQ,GACZ,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACnF,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF;AAXD,0DAWC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/run_command_cursor.js b/node_modules/mongodb/lib/cursor/run_command_cursor.js
new file mode 100644
index 00000000..41a85959
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/run_command_cursor.js
@@ -0,0 +1,94 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.RunCommandCursor = void 0;
+const error_1 = require("../error");
+const execute_operation_1 = require("../operations/execute_operation");
+const get_more_1 = require("../operations/get_more");
+const run_command_1 = require("../operations/run_command");
+const utils_1 = require("../utils");
+const abstract_cursor_1 = require("./abstract_cursor");
+/** @public */
+class RunCommandCursor extends abstract_cursor_1.AbstractCursor {
+ /**
+ * Controls the `getMore.comment` field
+ * @param comment - any BSON value
+ */
+ setComment(comment) {
+ this.getMoreOptions.comment = comment;
+ return this;
+ }
+ /**
+ * Controls the `getMore.maxTimeMS` field. Only valid when cursor is tailable await
+ * @param maxTimeMS - the number of milliseconds to wait for new data
+ */
+ setMaxTimeMS(maxTimeMS) {
+ this.getMoreOptions.maxAwaitTimeMS = maxTimeMS;
+ return this;
+ }
+ /**
+ * Controls the `getMore.batchSize` field
+ * @param batchSize - the number documents to return in the `nextBatch`
+ */
+ setBatchSize(batchSize) {
+ this.getMoreOptions.batchSize = batchSize;
+ return this;
+ }
+ /** Unsupported for RunCommandCursor */
+ clone() {
+ throw new error_1.MongoAPIError('Clone not supported, create a new cursor with db.runCursorCommand');
+ }
+ /** Unsupported for RunCommandCursor: readConcern must be configured directly on command document */
+ withReadConcern(_) {
+ throw new error_1.MongoAPIError('RunCommandCursor does not support readConcern it must be attached to the command being run');
+ }
+ /** Unsupported for RunCommandCursor: various cursor flags must be configured directly on command document */
+ addCursorFlag(_, __) {
+ throw new error_1.MongoAPIError('RunCommandCursor does not support cursor flags, they must be attached to the command being run');
+ }
+ /**
+ * Unsupported for RunCommandCursor: maxTimeMS must be configured directly on command document
+ */
+ maxTimeMS(_) {
+ throw new error_1.MongoAPIError('maxTimeMS must be configured on the command document directly, to configure getMore.maxTimeMS use cursor.setMaxTimeMS()');
+ }
+ /** Unsupported for RunCommandCursor: batchSize must be configured directly on command document */
+ batchSize(_) {
+ throw new error_1.MongoAPIError('batchSize must be configured on the command document directly, to configure getMore.batchSize use cursor.setBatchSize()');
+ }
+ /** @internal */
+ constructor(db, command, options = {}) {
+ super(db.client, (0, utils_1.ns)(db.namespace), options);
+ this.getMoreOptions = {};
+ this.db = db;
+ this.command = Object.freeze({ ...command });
+ }
+ /** @internal */
+ async _initialize(session) {
+ const operation = new run_command_1.RunCursorCommandOperation(this.db.s.namespace, this.command, {
+ ...this.cursorOptions,
+ session: session,
+ readPreference: this.cursorOptions.readPreference
+ });
+ const response = await (0, execute_operation_1.executeOperation)(this.client, operation, this.timeoutContext);
+ return {
+ server: operation.server,
+ session,
+ response
+ };
+ }
+ /** @internal */
+ async getMore() {
+ if (!this.session) {
+ throw new error_1.MongoRuntimeError('Unexpected null session. A cursor creating command should have set this');
+ }
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ const getMoreOperation = new get_more_1.GetMoreOperation(this.namespace, this.id, this.server, {
+ ...this.cursorOptions,
+ session: this.session,
+ ...this.getMoreOptions
+ });
+ return await (0, execute_operation_1.executeOperation)(this.client, getMoreOperation, this.timeoutContext);
+ }
+}
+exports.RunCommandCursor = RunCommandCursor;
+//# sourceMappingURL=run_command_cursor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/cursor/run_command_cursor.js.map b/node_modules/mongodb/lib/cursor/run_command_cursor.js.map
new file mode 100644
index 00000000..7840979f
--- /dev/null
+++ b/node_modules/mongodb/lib/cursor/run_command_cursor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"run_command_cursor.js","sourceRoot":"","sources":["../../src/cursor/run_command_cursor.ts"],"names":[],"mappings":";;;AAGA,oCAA4D;AAC5D,uEAAmE;AACnE,qDAA0D;AAC1D,2DAAsE;AAItE,oCAA8B;AAC9B,uDAI2B;AA+C3B,cAAc;AACd,MAAa,gBAAiB,SAAQ,gCAAc;IAQlD;;;OAGG;IACI,UAAU,CAAC,OAAY;QAC5B,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,SAAiB;QACnC,IAAI,CAAC,cAAc,CAAC,cAAc,GAAG,SAAS,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,SAAiB;QACnC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,SAAS,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uCAAuC;IACvB,KAAK;QACnB,MAAM,IAAI,qBAAa,CAAC,mEAAmE,CAAC,CAAC;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,MAAM;YACxB,OAAO;YACP,QAAQ;SACT,CAAC;IACJ,CAAC;IAED,gBAAgB;IACP,KAAK,CAAC,OAAO;QACpB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,yBAAiB,CACzB,yEAAyE,CAC1E,CAAC;QACJ,CAAC;QAED,oEAAoE;QACpE,MAAM,gBAAgB,GAAG,IAAI,2BAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAG,EAAE,IAAI,CAAC,MAAO,EAAE;YACpF,GAAG,IAAI,CAAC,aAAa;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,IAAI,CAAC,cAAc;SACvB,CAAC,CAAC;QAEH,OAAO,MAAM,IAAA,oCAAgB,EAAC,IAAI,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACpF,CAAC;CACF;AAlHD,4CAkHC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/db.js b/node_modules/mongodb/lib/db.js
new file mode 100644
index 00000000..06a53d6a
--- /dev/null
+++ b/node_modules/mongodb/lib/db.js
@@ -0,0 +1,419 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Db = void 0;
+const admin_1 = require("./admin");
+const bson_1 = require("./bson");
+const change_stream_1 = require("./change_stream");
+const collection_1 = require("./collection");
+const CONSTANTS = require("./constants");
+const aggregation_cursor_1 = require("./cursor/aggregation_cursor");
+const list_collections_cursor_1 = require("./cursor/list_collections_cursor");
+const run_command_cursor_1 = require("./cursor/run_command_cursor");
+const error_1 = require("./error");
+const create_collection_1 = require("./operations/create_collection");
+const drop_1 = require("./operations/drop");
+const execute_operation_1 = require("./operations/execute_operation");
+const indexes_1 = require("./operations/indexes");
+const profiling_level_1 = require("./operations/profiling_level");
+const remove_user_1 = require("./operations/remove_user");
+const rename_1 = require("./operations/rename");
+const run_command_1 = require("./operations/run_command");
+const set_profiling_level_1 = require("./operations/set_profiling_level");
+const stats_1 = require("./operations/stats");
+const read_concern_1 = require("./read_concern");
+const read_preference_1 = require("./read_preference");
+const utils_1 = require("./utils");
+const write_concern_1 = require("./write_concern");
+// Allowed parameters
+const DB_OPTIONS_ALLOW_LIST = [
+ 'writeConcern',
+ 'readPreference',
+ 'readPreferenceTags',
+ 'native_parser',
+ 'forceServerObjectId',
+ 'pkFactory',
+ 'serializeFunctions',
+ 'raw',
+ 'authSource',
+ 'ignoreUndefined',
+ 'readConcern',
+ 'retryMiliSeconds',
+ 'numberOfRetries',
+ 'useBigInt64',
+ 'promoteBuffers',
+ 'promoteLongs',
+ 'bsonRegExp',
+ 'enableUtf8Validation',
+ 'promoteValues',
+ 'compression',
+ 'retryWrites',
+ 'timeoutMS'
+];
+/**
+ * The **Db** class is a class that represents a MongoDB Database.
+ * @public
+ *
+ * @example
+ * ```ts
+ * import { MongoClient } from 'mongodb';
+ *
+ * interface Pet {
+ * name: string;
+ * kind: 'dog' | 'cat' | 'fish';
+ * }
+ *
+ * const client = new MongoClient('mongodb://localhost:27017');
+ * const db = client.db();
+ *
+ * // Create a collection that validates our union
+ * await db.createCollection('pets', {
+ * validator: { $expr: { $in: ['$kind', ['dog', 'cat', 'fish']] } }
+ * })
+ * ```
+ */
+class Db {
+ static { this.SYSTEM_NAMESPACE_COLLECTION = CONSTANTS.SYSTEM_NAMESPACE_COLLECTION; }
+ static { this.SYSTEM_INDEX_COLLECTION = CONSTANTS.SYSTEM_INDEX_COLLECTION; }
+ static { this.SYSTEM_PROFILE_COLLECTION = CONSTANTS.SYSTEM_PROFILE_COLLECTION; }
+ static { this.SYSTEM_USER_COLLECTION = CONSTANTS.SYSTEM_USER_COLLECTION; }
+ static { this.SYSTEM_COMMAND_COLLECTION = CONSTANTS.SYSTEM_COMMAND_COLLECTION; }
+ static { this.SYSTEM_JS_COLLECTION = CONSTANTS.SYSTEM_JS_COLLECTION; }
+ /**
+ * Creates a new Db instance.
+ *
+ * Db name cannot contain a dot, the server may apply more restrictions when an operation is run.
+ *
+ * @param client - The MongoClient for the database.
+ * @param databaseName - The name of the database this instance represents.
+ * @param options - Optional settings for Db construction.
+ */
+ constructor(client, databaseName, options) {
+ options = options ?? {};
+ // Filter the options
+ options = (0, utils_1.filterOptions)(options, DB_OPTIONS_ALLOW_LIST);
+ // Ensure there are no dots in database name
+ if (typeof databaseName === 'string' && databaseName.includes('.')) {
+ throw new error_1.MongoInvalidArgumentError(`Database names cannot contain the character '.'`);
+ }
+ // Internal state of the db object
+ this.s = {
+ // Options
+ options,
+ // Unpack read preference
+ readPreference: read_preference_1.ReadPreference.fromOptions(options),
+ // Merge bson options
+ bsonOptions: (0, bson_1.resolveBSONOptions)(options, client),
+ // Set up the primary key factory or fallback to ObjectId
+ pkFactory: options?.pkFactory ?? utils_1.DEFAULT_PK_FACTORY,
+ // ReadConcern
+ readConcern: read_concern_1.ReadConcern.fromOptions(options),
+ writeConcern: write_concern_1.WriteConcern.fromOptions(options),
+ // Namespace
+ namespace: new utils_1.MongoDBNamespace(databaseName)
+ };
+ this.client = client;
+ }
+ get databaseName() {
+ return this.s.namespace.db;
+ }
+ // Options
+ get options() {
+ return this.s.options;
+ }
+ /**
+ * Check if a secondary can be used (because the read preference is *not* set to primary)
+ */
+ get secondaryOk() {
+ return this.s.readPreference?.preference !== 'primary' || false;
+ }
+ get readConcern() {
+ return this.s.readConcern;
+ }
+ /**
+ * The current readPreference of the Db. If not explicitly defined for
+ * this Db, will be inherited from the parent MongoClient
+ */
+ get readPreference() {
+ if (this.s.readPreference == null) {
+ return this.client.readPreference;
+ }
+ return this.s.readPreference;
+ }
+ get bsonOptions() {
+ return this.s.bsonOptions;
+ }
+ // get the write Concern
+ get writeConcern() {
+ return this.s.writeConcern;
+ }
+ get namespace() {
+ return this.s.namespace.toString();
+ }
+ get timeoutMS() {
+ return this.s.options?.timeoutMS;
+ }
+ /**
+ * Create a new collection on a server with the specified options. Use this to create capped collections.
+ * More information about command options available at https://www.mongodb.com/docs/manual/reference/command/create/
+ *
+ * Collection namespace validation is performed server-side.
+ *
+ * @param name - The name of the collection to create
+ * @param options - Optional settings for the command
+ */
+ async createCollection(name, options) {
+ options = (0, utils_1.resolveOptions)(this, options);
+ return await (0, create_collection_1.createCollections)(this, name, options);
+ }
+ /**
+ * Execute a command
+ *
+ * @remarks
+ * This command does not inherit options from the MongoClient.
+ *
+ * The driver will ensure the following fields are attached to the command sent to the server:
+ * - `lsid` - sourced from an implicit session or options.session
+ * - `$readPreference` - defaults to primary or can be configured by options.readPreference
+ * - `$db` - sourced from the name of this database
+ *
+ * If the client has a serverApi setting:
+ * - `apiVersion`
+ * - `apiStrict`
+ * - `apiDeprecationErrors`
+ *
+ * When in a transaction:
+ * - `readConcern` - sourced from readConcern set on the TransactionOptions
+ * - `writeConcern` - sourced from writeConcern set on the TransactionOptions
+ *
+ * Attaching any of the above fields to the command will have no effect as the driver will overwrite the value.
+ *
+ * @param command - The command to run
+ * @param options - Optional settings for the command
+ */
+ async command(command, options) {
+ // Intentionally, we do not inherit options from parent for this operation.
+ return await (0, execute_operation_1.executeOperation)(this.client, new run_command_1.RunCommandOperation(this.s.namespace, command, (0, utils_1.resolveOptions)(undefined, {
+ ...(0, bson_1.resolveBSONOptions)(options),
+ timeoutMS: options?.timeoutMS ?? this.timeoutMS,
+ session: options?.session,
+ readPreference: options?.readPreference,
+ signal: options?.signal
+ })));
+ }
+ /**
+ * Execute an aggregation framework pipeline against the database.
+ *
+ * @param pipeline - An array of aggregation stages to be executed
+ * @param options - Optional settings for the command
+ */
+ aggregate(pipeline = [], options) {
+ return new aggregation_cursor_1.AggregationCursor(this.client, this.s.namespace, pipeline, (0, utils_1.resolveOptions)(this, options));
+ }
+ /** Return the Admin db instance */
+ admin() {
+ return new admin_1.Admin(this);
+ }
+ /**
+ * Returns a reference to a MongoDB Collection. If it does not exist it will be created implicitly.
+ *
+ * Collection namespace validation is performed server-side.
+ *
+ * @param name - the collection name we wish to access.
+ * @returns return the new Collection instance
+ */
+ collection(name, options = {}) {
+ if (typeof options === 'function') {
+ throw new error_1.MongoInvalidArgumentError('The callback form of this helper has been removed.');
+ }
+ return new collection_1.Collection(this, name, (0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * Get all the db statistics.
+ *
+ * @param options - Optional settings for the command
+ */
+ async stats(options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new stats_1.DbStatsOperation(this, (0, utils_1.resolveOptions)(this, options)));
+ }
+ listCollections(filter = {}, options = {}) {
+ return new list_collections_cursor_1.ListCollectionsCursor(this, filter, (0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * Rename a collection.
+ *
+ * @remarks
+ * This operation does not inherit options from the MongoClient.
+ *
+ * @param fromCollection - Name of current collection to rename
+ * @param toCollection - New name of of the collection
+ * @param options - Optional settings for the command
+ */
+ async renameCollection(fromCollection, toCollection, options) {
+ // Intentionally, we do not inherit options from parent for this operation.
+ return await (0, execute_operation_1.executeOperation)(this.client, new rename_1.RenameOperation(this.collection(fromCollection), toCollection, (0, utils_1.resolveOptions)(undefined, {
+ ...options,
+ readPreference: read_preference_1.ReadPreference.primary
+ })));
+ }
+ /**
+ * Drop a collection from the database, removing it permanently. New accesses will create a new collection.
+ *
+ * @param name - Name of collection to drop
+ * @param options - Optional settings for the command
+ */
+ async dropCollection(name, options) {
+ options = (0, utils_1.resolveOptions)(this, options);
+ return await (0, drop_1.dropCollections)(this, name, options);
+ }
+ /**
+ * Drop a database, removing it permanently from the server.
+ *
+ * @param options - Optional settings for the command
+ */
+ async dropDatabase(options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new drop_1.DropDatabaseOperation(this, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Fetch all collections for the current db.
+ *
+ * @param options - Optional settings for the command
+ */
+ async collections(options) {
+ options = (0, utils_1.resolveOptions)(this, options);
+ const collections = await this.listCollections({}, { ...options, nameOnly: true }).toArray();
+ return collections
+ .filter(
+ // Filter collections removing any illegal ones
+ ({ name }) => !name.includes('$'))
+ .map(({ name }) => new collection_1.Collection(this, name, this.s.options));
+ }
+ /**
+ * Creates an index on the db and collection.
+ *
+ * @param name - Name of the collection to create the index on.
+ * @param indexSpec - Specify the field to index, or an index specification
+ * @param options - Optional settings for the command
+ */
+ async createIndex(name, indexSpec, options) {
+ const indexes = await (0, execute_operation_1.executeOperation)(this.client, indexes_1.CreateIndexesOperation.fromIndexSpecification(this, name, indexSpec, options));
+ return indexes[0];
+ }
+ /**
+ * Remove a user from a database
+ *
+ * @param username - The username to remove
+ * @param options - Optional settings for the command
+ */
+ async removeUser(username, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new remove_user_1.RemoveUserOperation(this, username, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Set the current profiling level of MongoDB
+ *
+ * @param level - The new profiling level (off, slow_only, all).
+ * @param options - Optional settings for the command
+ */
+ async setProfilingLevel(level, options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new set_profiling_level_1.SetProfilingLevelOperation(this, level, (0, utils_1.resolveOptions)(this, options)));
+ }
+ /**
+ * Retrieve the current profiling Level for MongoDB
+ *
+ * @param options - Optional settings for the command
+ */
+ async profilingLevel(options) {
+ return await (0, execute_operation_1.executeOperation)(this.client, new profiling_level_1.ProfilingLevelOperation(this, (0, utils_1.resolveOptions)(this, options)));
+ }
+ async indexInformation(name, options) {
+ return await this.collection(name).indexInformation((0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * Create a new Change Stream, watching for new changes (insertions, updates,
+ * replacements, deletions, and invalidations) in this database. Will ignore all
+ * changes to system collections.
+ *
+ * @remarks
+ * watch() accepts two generic arguments for distinct use cases:
+ * - The first is to provide the schema that may be defined for all the collections within this database
+ * - The second is to override the shape of the change stream document entirely, if it is not provided the type will default to ChangeStreamDocument of the first argument
+ *
+ * @remarks
+ * When `timeoutMS` is configured for a change stream, it will have different behaviour depending
+ * on whether the change stream is in iterator mode or emitter mode. In both cases, a change
+ * stream will time out if it does not receive a change event within `timeoutMS` of the last change
+ * event.
+ *
+ * Note that if a change stream is consistently timing out when watching a collection, database or
+ * client that is being changed, then this may be due to the server timing out before it can finish
+ * processing the existing oplog. To address this, restart the change stream with a higher
+ * `timeoutMS`.
+ *
+ * If the change stream times out the initial aggregate operation to establish the change stream on
+ * the server, then the client will close the change stream. If the getMore calls to the server
+ * time out, then the change stream will be left open, but will throw a MongoOperationTimeoutError
+ * when in iterator mode and emit an error event that returns a MongoOperationTimeoutError in
+ * emitter mode.
+ *
+ * To determine whether or not the change stream is still open following a timeout, check the
+ * {@link ChangeStream.closed} getter.
+ *
+ * @example
+ * In iterator mode, if a next() call throws a timeout error, it will attempt to resume the change stream.
+ * The next call can just be retried after this succeeds.
+ * ```ts
+ * const changeStream = collection.watch([], { timeoutMS: 100 });
+ * try {
+ * await changeStream.next();
+ * } catch (e) {
+ * if (e instanceof MongoOperationTimeoutError && !changeStream.closed) {
+ * await changeStream.next();
+ * }
+ * throw e;
+ * }
+ * ```
+ *
+ * @example
+ * In emitter mode, if the change stream goes `timeoutMS` without emitting a change event, it will
+ * emit an error event that returns a MongoOperationTimeoutError, but will not close the change
+ * stream unless the resume attempt fails. There is no need to re-establish change listeners as
+ * this will automatically continue emitting change events once the resume attempt completes.
+ *
+ * ```ts
+ * const changeStream = collection.watch([], { timeoutMS: 100 });
+ * changeStream.on('change', console.log);
+ * changeStream.on('error', e => {
+ * if (e instanceof MongoOperationTimeoutError && !changeStream.closed) {
+ * // do nothing
+ * } else {
+ * changeStream.close();
+ * }
+ * });
+ * ```
+ * @param pipeline - An array of {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/|aggregation pipeline stages} through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.
+ * @param options - Optional settings for the command
+ * @typeParam TSchema - Type of the data being detected by the change stream
+ * @typeParam TChange - Type of the whole change stream document emitted
+ */
+ watch(pipeline = [], options = {}) {
+ // Allow optionally not specifying a pipeline
+ if (!Array.isArray(pipeline)) {
+ options = pipeline;
+ pipeline = [];
+ }
+ return new change_stream_1.ChangeStream(this, pipeline, (0, utils_1.resolveOptions)(this, options));
+ }
+ /**
+ * A low level cursor API providing basic driver functionality:
+ * - ClientSession management
+ * - ReadPreference for server selection
+ * - Running getMores automatically when a local batch is exhausted
+ *
+ * @param command - The command that will start a cursor on the server.
+ * @param options - Configurations for running the command, bson options will apply to getMores
+ */
+ runCursorCommand(command, options) {
+ return new run_command_cursor_1.RunCommandCursor(this, command, options);
+ }
+}
+exports.Db = Db;
+//# sourceMappingURL=db.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/db.js.map b/node_modules/mongodb/lib/db.js.map
new file mode 100644
index 00000000..115b2f6b
--- /dev/null
+++ b/node_modules/mongodb/lib/db.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,iCAAsF;AACtF,mDAAoG;AACpG,6CAAkE;AAClE,yCAAyC;AACzC,oEAAgE;AAChE,8EAAyE;AACzE,oEAA6F;AAC7F,mCAAoD;AAIpD,sEAAiG;AACjG,4CAK2B;AAC3B,sEAAkE;AAClE,kDAO8B;AAE9B,kEAAmG;AACnG,0DAAuF;AACvF,gDAA0E;AAC1E,0DAAuF;AACvF,0EAI0C;AAC1C,8CAA2E;AAC3E,iDAA6C;AAC7C,uDAA4E;AAC5E,mCAA8F;AAC9F,mDAAyE;AAEzE,qBAAqB;AACrB,MAAM,qBAAqB,GAAG;IAC5B,cAAc;IACd,gBAAgB;IAChB,oBAAoB;IACpB,eAAe;IACf,qBAAqB;IACrB,WAAW;IACX,oBAAoB;IACpB,KAAK;IACL,YAAY;IACZ,iBAAiB;IACjB,aAAa;IACb,kBAAkB;IAClB,iBAAiB;IACjB,aAAa;IACb,gBAAgB;IAChB,cAAc;IACd,YAAY;IACZ,sBAAsB;IACtB,eAAe;IACf,aAAa;IACb,aAAa;IACb,WAAW;CACZ,CAAC;AAkCF;;;;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OAAO,MAAM,IAAA,oCAAgB,EAC3B,IAAI,CAAC,MAAM,EACX,IAAI,yCAAuB,CAAC,IAAI,EAAE,IAAA,sBAAc,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CACjE,CAAC;IACJ,CAAC;IAqBD,KAAK,CAAC,gBAAgB,CACpB,IAAY,EACZ,OAAiC;QAEjC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,IAAA,sBAAc,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkEG;IACH,KAAK,CAGH,WAAuB,EAAE,EAAE,UAA+B,EAAE;QAC5D,6CAA6C;QAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,OAAO,GAAG,QAAQ,CAAC;YACnB,QAAQ,GAAG,EAAE,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,4BAAY,CAAmB,IAAI,EAAE,QAAQ,EAAE,IAAA,sBAAc,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;;;OAQG;IACH,gBAAgB,CAAC,OAAiB,EAAE,OAAiC;QACnE,OAAO,IAAI,qCAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;;AA/eH,gBAgfC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/deps.js b/node_modules/mongodb/lib/deps.js
new file mode 100644
index 00000000..61fad657
--- /dev/null
+++ b/node_modules/mongodb/lib/deps.js
@@ -0,0 +1,112 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.getKerberos = getKerberos;
+exports.getZstdLibrary = getZstdLibrary;
+exports.getAwsCredentialProvider = getAwsCredentialProvider;
+exports.getGcpMetadata = getGcpMetadata;
+exports.getSnappy = getSnappy;
+exports.getSocks = getSocks;
+exports.getMongoDBClientEncryption = getMongoDBClientEncryption;
+const error_1 = require("./error");
+function makeErrorModule(error) {
+ const props = error ? { kModuleError: error } : {};
+ return new Proxy(props, {
+ get: (_, key) => {
+ if (key === 'kModuleError') {
+ return error;
+ }
+ throw error;
+ },
+ set: () => {
+ throw error;
+ }
+ });
+}
+function getKerberos() {
+ let kerberos;
+ try {
+ // Ensure you always wrap an optional require in the try block NODE-3199
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ kerberos = require('kerberos');
+ }
+ catch (error) {
+ kerberos = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `kerberos` not found. Please install it to enable kerberos authentication', { cause: error, dependencyName: 'kerberos' }));
+ }
+ return kerberos;
+}
+function getZstdLibrary() {
+ let ZStandard;
+ try {
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ ZStandard = require('@mongodb-js/zstd');
+ }
+ catch (error) {
+ ZStandard = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `@mongodb-js/zstd` not found. Please install it to enable zstd compression', { cause: error, dependencyName: 'zstd' }));
+ }
+ return ZStandard;
+}
+function getAwsCredentialProvider() {
+ try {
+ // Ensure you always wrap an optional require in the try block NODE-3199
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ const credentialProvider = require('@aws-sdk/credential-providers');
+ return credentialProvider;
+ }
+ catch (error) {
+ return makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `@aws-sdk/credential-providers` not found.' +
+ ' Please install it to enable getting aws credentials via the official sdk.', { cause: error, dependencyName: '@aws-sdk/credential-providers' }));
+ }
+}
+function getGcpMetadata() {
+ try {
+ // Ensure you always wrap an optional require in the try block NODE-3199
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ const credentialProvider = require('gcp-metadata');
+ return credentialProvider;
+ }
+ catch (error) {
+ return makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `gcp-metadata` not found.' +
+ ' Please install it to enable getting gcp credentials via the official sdk.', { cause: error, dependencyName: 'gcp-metadata' }));
+ }
+}
+function getSnappy() {
+ try {
+ // Ensure you always wrap an optional require in the try block NODE-3199
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ const value = require('snappy');
+ return value;
+ }
+ catch (error) {
+ const kModuleError = new error_1.MongoMissingDependencyError('Optional module `snappy` not found. Please install it to enable snappy compression', { cause: error, dependencyName: 'snappy' });
+ return { kModuleError };
+ }
+}
+function getSocks() {
+ try {
+ // Ensure you always wrap an optional require in the try block NODE-3199
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ const value = require('socks');
+ return value;
+ }
+ catch (error) {
+ const kModuleError = new error_1.MongoMissingDependencyError('Optional module `socks` not found. Please install it to connections over a SOCKS5 proxy', { cause: error, dependencyName: 'socks' });
+ return { kModuleError };
+ }
+}
+/** A utility function to get the instance of mongodb-client-encryption, if it exists. */
+function getMongoDBClientEncryption() {
+ let mongodbClientEncryption = null;
+ try {
+ // NOTE(NODE-3199): Ensure you always wrap an optional require literally in the try block
+ // Cannot be moved to helper utility function, bundlers search and replace the actual require call
+ // in a way that makes this line throw at bundle time, not runtime, catching here will make bundling succeed
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ mongodbClientEncryption = require('mongodb-client-encryption');
+ }
+ catch (error) {
+ const kModuleError = new error_1.MongoMissingDependencyError('Optional module `mongodb-client-encryption` not found. Please install it to use auto encryption or ClientEncryption.', { cause: error, dependencyName: 'mongodb-client-encryption' });
+ return { kModuleError };
+ }
+ return mongodbClientEncryption;
+}
+//# sourceMappingURL=deps.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/deps.js.map b/node_modules/mongodb/lib/deps.js.map
new file mode 100644
index 00000000..d8a5fc75
--- /dev/null
+++ b/node_modules/mongodb/lib/deps.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"deps.js","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":";;AAqBA,kCAeC;AA0BD,wCAe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AAO,CAAC,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,IAAI,mCAA2B,CAClD,yFAAyF,EACzF,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,CAC1C,CAAC;QACF,OAAO,EAAE,YAAY,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,yFAAyF;AACzF,SAAgB,0BAA0B;IAGxC,IAAI,uBAAuB,GAAG,IAAI,CAAC;IAEnC,IAAI,CAAC;QACH,yFAAyF;QACzF,kGAAkG;QAClG,4GAA4G;QAC5G,iEAAiE;QACjE,uBAAuB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,IAAI,mCAA2B,CAClD,sHAAsH,EACtH,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,CAC9D,CAAC;QACF,OAAO,EAAE,YAAY,EAAE,CAAC;IAC1B,CAAC;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/encrypter.js b/node_modules/mongodb/lib/encrypter.js
new file mode 100644
index 00000000..132b669b
--- /dev/null
+++ b/node_modules/mongodb/lib/encrypter.js
@@ -0,0 +1,106 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Encrypter = void 0;
+const auto_encrypter_1 = require("./client-side-encryption/auto_encrypter");
+const constants_1 = require("./constants");
+const deps_1 = require("./deps");
+const error_1 = require("./error");
+const mongo_client_1 = require("./mongo_client");
+/** @internal */
+class Encrypter {
+ constructor(client, uri, options) {
+ if (typeof options.autoEncryption !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Option "autoEncryption" must be specified');
+ }
+ // initialize to null, if we call getInternalClient, we may set this it is important to not overwrite those function calls.
+ this.internalClient = null;
+ this.bypassAutoEncryption = !!options.autoEncryption.bypassAutoEncryption;
+ this.needsConnecting = false;
+ if (options.maxPoolSize === 0 && options.autoEncryption.keyVaultClient == null) {
+ options.autoEncryption.keyVaultClient = client;
+ }
+ else if (options.autoEncryption.keyVaultClient == null) {
+ options.autoEncryption.keyVaultClient = this.getInternalClient(client, uri, options);
+ }
+ if (this.bypassAutoEncryption) {
+ options.autoEncryption.metadataClient = undefined;
+ }
+ else if (options.maxPoolSize === 0) {
+ options.autoEncryption.metadataClient = client;
+ }
+ else {
+ options.autoEncryption.metadataClient = this.getInternalClient(client, uri, options);
+ }
+ if (options.proxyHost) {
+ options.autoEncryption.proxyOptions = {
+ proxyHost: options.proxyHost,
+ proxyPort: options.proxyPort,
+ proxyUsername: options.proxyUsername,
+ proxyPassword: options.proxyPassword
+ };
+ }
+ this.autoEncrypter = new auto_encrypter_1.AutoEncrypter(client, options.autoEncryption);
+ }
+ getInternalClient(client, uri, options) {
+ let internalClient = this.internalClient;
+ if (internalClient == null) {
+ const clonedOptions = {};
+ for (const key of [
+ ...Object.getOwnPropertyNames(options),
+ ...Object.getOwnPropertySymbols(options)
+ ]) {
+ if (['autoEncryption', 'minPoolSize', 'servers', 'caseTranslate', 'dbName'].includes(key))
+ continue;
+ Reflect.set(clonedOptions, key, Reflect.get(options, key));
+ }
+ clonedOptions.minPoolSize = 0;
+ internalClient = new mongo_client_1.MongoClient(uri, clonedOptions);
+ this.internalClient = internalClient;
+ for (const eventName of constants_1.MONGO_CLIENT_EVENTS) {
+ for (const listener of client.listeners(eventName)) {
+ internalClient.on(eventName, listener);
+ }
+ }
+ client.on('newListener', (eventName, listener) => {
+ internalClient?.on(eventName, listener);
+ });
+ this.needsConnecting = true;
+ }
+ return internalClient;
+ }
+ async connectInternalClient() {
+ const internalClient = this.internalClient;
+ if (this.needsConnecting && internalClient != null) {
+ this.needsConnecting = false;
+ await internalClient.connect();
+ }
+ }
+ async close(client) {
+ let error;
+ try {
+ await this.autoEncrypter.close();
+ }
+ catch (autoEncrypterError) {
+ error = autoEncrypterError;
+ }
+ const internalClient = this.internalClient;
+ if (internalClient != null && client !== internalClient) {
+ return await internalClient.close();
+ }
+ if (error != null) {
+ throw error;
+ }
+ }
+ static checkForMongoCrypt() {
+ const mongodbClientEncryption = (0, deps_1.getMongoDBClientEncryption)();
+ if ('kModuleError' in mongodbClientEncryption) {
+ throw new error_1.MongoMissingDependencyError('Auto-encryption requested, but the module is not installed. ' +
+ 'Please add `mongodb-client-encryption` as a dependency of your project', {
+ cause: mongodbClientEncryption['kModuleError'],
+ dependencyName: 'mongodb-client-encryption'
+ });
+ }
+ }
+}
+exports.Encrypter = Encrypter;
+//# sourceMappingURL=encrypter.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/encrypter.js.map b/node_modules/mongodb/lib/encrypter.js.map
new file mode 100644
index 00000000..b80f9d62
--- /dev/null
+++ b/node_modules/mongodb/lib/encrypter.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"encrypter.js","sourceRoot":"","sources":["../src/encrypter.ts"],"names":[],"mappings":";;;AAAA,4EAAoG;AACpG,2CAAkD;AAClD,iCAAoD;AACpD,mCAAiF;AACjF,iDAAsE;AAQtE,gBAAgB;AAChB,MAAa,SAAS;IAMpB,YAAY,MAAmB,EAAE,GAAW,EAAE,OAA2B;QACvE,IAAI,OAAO,OAAO,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;YAC/C,MAAM,IAAI,iCAAyB,CAAC,2CAA2C,CAAC,CAAC;QACnF,CAAC;QACD,2HAA2H;QAC3H,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAE3B,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,oBAAoB,CAAC;QAC1E,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAE7B,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC,cAAc,IAAI,IAAI,EAAE,CAAC;Y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KAAK,CAAC,MAAmB;QAC7B,IAAI,KAAK,CAAC;QACV,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QACnC,CAAC;QAAC,OAAO,kBAAkB,EAAE,CAAC;YAC5B,KAAK,GAAG,kBAAkB,CAAC;QAC7B,CAAC;QACD,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC3C,IAAI,cAAc,IAAI,IAAI,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;YACxD,OAAO,MAAM,cAAc,CAAC,KAAK,EAAE,CAAC;QACtC,CAAC;QACD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,MAAM,CAAC,kBAAkB;QACvB,MAAM,uBAAuB,GAAG,IAAA,iCAA0B,GAAE,CAAC;QAC7D,IAAI,cAAc,IAAI,uBAAuB,EAAE,CAAC;YAC9C,MAAM,IAAI,mCAA2B,CACnC,8DAA8D;gBAC5D,wEAAwE,EAC1E;gBACE,KAAK,EAAE,uBAAuB,CAAC,cAAc,CAAC;gBAC9C,cAAc,EAAE,2BAA2B;aAC5C,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAjHD,8BAiHC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/error.js b/node_modules/mongodb/lib/error.js
new file mode 100644
index 00000000..04c4d6b4
--- /dev/null
+++ b/node_modules/mongodb/lib/error.js
@@ -0,0 +1,1380 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongoWriteConcernError = exports.MongoServerSelectionError = exports.MongoSystemError = exports.MongoMissingDependencyError = exports.MongoMissingCredentialsError = exports.MongoCompatibilityError = exports.MongoInvalidArgumentError = exports.MongoParseError = exports.MongoNetworkTimeoutError = exports.MongoNetworkError = exports.MongoClientClosedError = exports.MongoTopologyClosedError = exports.MongoCursorExhaustedError = exports.MongoServerClosedError = exports.MongoCursorInUseError = exports.MongoOperationTimeoutError = exports.MongoUnexpectedServerResponseError = exports.MongoGridFSChunkError = exports.MongoGridFSStreamError = exports.MongoTailableCursorError = exports.MongoChangeStreamError = exports.MongoClientBulkWriteExecutionError = exports.MongoClientBulkWriteCursorError = exports.MongoClientBulkWriteError = exports.MongoGCPError = exports.MongoAzureError = exports.MongoOIDCError = exports.MongoAWSError = exports.MongoKerberosError = exports.MongoExpiredSessionError = exports.MongoTransactionError = exports.MongoNotConnectedError = exports.MongoDecompressionError = exports.MongoBatchReExecutionError = exports.MongoStalePrimaryError = exports.MongoRuntimeError = exports.MongoAPIError = exports.MongoDriverError = exports.MongoServerError = exports.MongoError = exports.MongoErrorLabel = exports.GET_MORE_RESUMABLE_CODES = exports.MONGODB_ERROR_CODES = exports.NODE_IS_RECOVERING_ERROR_MESSAGE = exports.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE = exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE = void 0;
+exports.needsRetryableWriteLabel = needsRetryableWriteLabel;
+exports.isRetryableWriteError = isRetryableWriteError;
+exports.isRetryableReadError = isRetryableReadError;
+exports.isNodeShuttingDownError = isNodeShuttingDownError;
+exports.isStateChangeError = isStateChangeError;
+exports.isNetworkTimeoutError = isNetworkTimeoutError;
+exports.isResumableError = isResumableError;
+/**
+ * @internal
+ * The legacy error message from the server that indicates the node is not a writable primary
+ * https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
+ */
+exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE = new RegExp('not master', 'i');
+/**
+ * @internal
+ * The legacy error message from the server that indicates the node is not a primary or secondary
+ * https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
+ */
+exports.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE = new RegExp('not master or secondary', 'i');
+/**
+ * @internal
+ * The error message from the server that indicates the node is recovering
+ * https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
+ */
+exports.NODE_IS_RECOVERING_ERROR_MESSAGE = new RegExp('node is recovering', 'i');
+/** @internal MongoDB Error Codes */
+exports.MONGODB_ERROR_CODES = Object.freeze({
+ HostUnreachable: 6,
+ HostNotFound: 7,
+ AuthenticationFailed: 18,
+ NetworkTimeout: 89,
+ ShutdownInProgress: 91,
+ PrimarySteppedDown: 189,
+ ExceededTimeLimit: 262,
+ SocketException: 9001,
+ NotWritablePrimary: 10107,
+ InterruptedAtShutdown: 11600,
+ InterruptedDueToReplStateChange: 11602,
+ NotPrimaryNoSecondaryOk: 13435,
+ NotPrimaryOrSecondary: 13436,
+ StaleShardVersion: 63,
+ StaleEpoch: 150,
+ StaleConfig: 13388,
+ RetryChangeStream: 234,
+ FailedToSatisfyReadPreference: 133,
+ CursorNotFound: 43,
+ LegacyNotPrimary: 10058,
+ // WriteConcernTimeout is WriteConcernFailed on pre-8.1 servers
+ WriteConcernTimeout: 64,
+ NamespaceNotFound: 26,
+ IllegalOperation: 20,
+ MaxTimeMSExpired: 50,
+ UnknownReplWriteConcern: 79,
+ UnsatisfiableWriteConcern: 100,
+ Reauthenticate: 391,
+ ReadConcernMajorityNotAvailableYet: 134
+});
+// From spec https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/change-streams/change-streams.md#resumable-error
+exports.GET_MORE_RESUMABLE_CODES = new Set([
+ exports.MONGODB_ERROR_CODES.HostUnreachable,
+ exports.MONGODB_ERROR_CODES.HostNotFound,
+ exports.MONGODB_ERROR_CODES.NetworkTimeout,
+ exports.MONGODB_ERROR_CODES.ShutdownInProgress,
+ exports.MONGODB_ERROR_CODES.PrimarySteppedDown,
+ exports.MONGODB_ERROR_CODES.ExceededTimeLimit,
+ exports.MONGODB_ERROR_CODES.SocketException,
+ exports.MONGODB_ERROR_CODES.NotWritablePrimary,
+ exports.MONGODB_ERROR_CODES.InterruptedAtShutdown,
+ exports.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,
+ exports.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,
+ exports.MONGODB_ERROR_CODES.NotPrimaryOrSecondary,
+ exports.MONGODB_ERROR_CODES.StaleShardVersion,
+ exports.MONGODB_ERROR_CODES.StaleEpoch,
+ exports.MONGODB_ERROR_CODES.StaleConfig,
+ exports.MONGODB_ERROR_CODES.RetryChangeStream,
+ exports.MONGODB_ERROR_CODES.FailedToSatisfyReadPreference,
+ exports.MONGODB_ERROR_CODES.CursorNotFound
+]);
+/** @public */
+exports.MongoErrorLabel = Object.freeze({
+ RetryableWriteError: 'RetryableWriteError',
+ TransientTransactionError: 'TransientTransactionError',
+ UnknownTransactionCommitResult: 'UnknownTransactionCommitResult',
+ ResumableChangeStreamError: 'ResumableChangeStreamError',
+ HandshakeError: 'HandshakeError',
+ ResetPool: 'ResetPool',
+ PoolRequestedRetry: 'PoolRequestedRetry',
+ InterruptInUseConnections: 'InterruptInUseConnections',
+ NoWritesPerformed: 'NoWritesPerformed',
+ RetryableError: 'RetryableError',
+ SystemOverloadedError: 'SystemOverloadedError'
+});
+function isAggregateError(e) {
+ return e != null && typeof e === 'object' && 'errors' in e && Array.isArray(e.errors);
+}
+/**
+ * @public
+ * @category Error
+ *
+ * @privateRemarks
+ * mongodb-client-encryption has a dependency on this error, it uses the constructor with a string argument
+ */
+class MongoError extends Error {
+ get errorLabels() {
+ return Array.from(this.errorLabelSet);
+ }
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ /** @internal */
+ this.errorLabelSet = new Set();
+ }
+ /** @internal */
+ static buildErrorMessage(e) {
+ if (typeof e === 'string') {
+ return e;
+ }
+ if (isAggregateError(e) && e.message.length === 0) {
+ return e.errors.length === 0
+ ? 'AggregateError has an empty errors array. Please check the `cause` property for more information.'
+ : e.errors.map(({ message }) => message).join(', ');
+ }
+ return e != null && typeof e === 'object' && 'message' in e && typeof e.message === 'string'
+ ? e.message
+ : 'empty error message';
+ }
+ get name() {
+ return 'MongoError';
+ }
+ /** Legacy name for server error responses */
+ get errmsg() {
+ return this.message;
+ }
+ /**
+ * Checks the error to see if it has an error label
+ *
+ * @param label - The error label to check for
+ * @returns returns true if the error has the provided error label
+ */
+ hasErrorLabel(label) {
+ return this.errorLabelSet.has(label);
+ }
+ addErrorLabel(label) {
+ this.errorLabelSet.add(label);
+ }
+}
+exports.MongoError = MongoError;
+/**
+ * An error coming from the mongo server
+ *
+ * @public
+ * @category Error
+ */
+class MongoServerError extends MongoError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message.message || message.errmsg || message.$err || 'n/a');
+ if (message.errorLabels) {
+ for (const label of message.errorLabels)
+ this.addErrorLabel(label);
+ }
+ this.errorResponse = message;
+ for (const name in message) {
+ if (name !== 'errorLabels' &&
+ name !== 'errmsg' &&
+ name !== 'message' &&
+ name !== 'errorResponse') {
+ this[name] = message[name];
+ }
+ }
+ }
+ get name() {
+ return 'MongoServerError';
+ }
+}
+exports.MongoServerError = MongoServerError;
+/**
+ * An error generated by the driver
+ *
+ * @public
+ * @category Error
+ */
+class MongoDriverError extends MongoError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ }
+ get name() {
+ return 'MongoDriverError';
+ }
+}
+exports.MongoDriverError = MongoDriverError;
+/**
+ * An error generated when the driver API is used incorrectly
+ *
+ * @privateRemarks
+ * Should **never** be directly instantiated
+ *
+ * @public
+ * @category Error
+ */
+class MongoAPIError extends MongoDriverError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ }
+ get name() {
+ return 'MongoAPIError';
+ }
+}
+exports.MongoAPIError = MongoAPIError;
+/**
+ * An error generated when the driver encounters unexpected input
+ * or reaches an unexpected/invalid internal state.
+ *
+ * @privateRemarks
+ * Should **never** be directly instantiated.
+ *
+ * @public
+ * @category Error
+ */
+class MongoRuntimeError extends MongoDriverError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ }
+ get name() {
+ return 'MongoRuntimeError';
+ }
+}
+exports.MongoRuntimeError = MongoRuntimeError;
+/**
+ * An error generated when a primary server is marked stale, never directly thrown
+ *
+ * @public
+ * @category Error
+ */
+class MongoStalePrimaryError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ }
+ get name() {
+ return 'MongoStalePrimaryError';
+ }
+}
+exports.MongoStalePrimaryError = MongoStalePrimaryError;
+/**
+ * An error generated when a batch command is re-executed after one of the commands in the batch
+ * has failed
+ *
+ * @public
+ * @category Error
+ */
+class MongoBatchReExecutionError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message = 'This batch has already been executed, create new batch to execute') {
+ super(message);
+ }
+ get name() {
+ return 'MongoBatchReExecutionError';
+ }
+}
+exports.MongoBatchReExecutionError = MongoBatchReExecutionError;
+/**
+ * An error generated when the driver fails to decompress
+ * data received from the server.
+ *
+ * @public
+ * @category Error
+ */
+class MongoDecompressionError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoDecompressionError';
+ }
+}
+exports.MongoDecompressionError = MongoDecompressionError;
+/**
+ * An error thrown when the user attempts to operate on a database or collection through a MongoClient
+ * that has not yet successfully called the "connect" method
+ *
+ * @public
+ * @category Error
+ */
+class MongoNotConnectedError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoNotConnectedError';
+ }
+}
+exports.MongoNotConnectedError = MongoNotConnectedError;
+/**
+ * An error generated when the user makes a mistake in the usage of transactions.
+ * (e.g. attempting to commit a transaction with a readPreference other than primary)
+ *
+ * @public
+ * @category Error
+ */
+class MongoTransactionError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoTransactionError';
+ }
+}
+exports.MongoTransactionError = MongoTransactionError;
+/**
+ * An error generated when the user attempts to operate
+ * on a session that has expired or has been closed.
+ *
+ * @public
+ * @category Error
+ */
+class MongoExpiredSessionError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message = 'Cannot use a session that has ended') {
+ super(message);
+ }
+ get name() {
+ return 'MongoExpiredSessionError';
+ }
+}
+exports.MongoExpiredSessionError = MongoExpiredSessionError;
+/**
+ * A error generated when the user attempts to authenticate
+ * via Kerberos, but fails to connect to the Kerberos client.
+ *
+ * @public
+ * @category Error
+ */
+class MongoKerberosError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoKerberosError';
+ }
+}
+exports.MongoKerberosError = MongoKerberosError;
+/**
+ * A error generated when the user attempts to authenticate
+ * via AWS, but fails
+ *
+ * @public
+ * @category Error
+ */
+class MongoAWSError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ }
+ get name() {
+ return 'MongoAWSError';
+ }
+}
+exports.MongoAWSError = MongoAWSError;
+/**
+ * A error generated when the user attempts to authenticate
+ * via OIDC callbacks, but fails.
+ *
+ * @public
+ * @category Error
+ */
+class MongoOIDCError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoOIDCError';
+ }
+}
+exports.MongoOIDCError = MongoOIDCError;
+/**
+ * A error generated when the user attempts to authenticate
+ * via Azure, but fails.
+ *
+ * @public
+ * @category Error
+ */
+class MongoAzureError extends MongoOIDCError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoAzureError';
+ }
+}
+exports.MongoAzureError = MongoAzureError;
+/**
+ * A error generated when the user attempts to authenticate
+ * via GCP, but fails.
+ *
+ * @public
+ * @category Error
+ */
+class MongoGCPError extends MongoOIDCError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoGCPError';
+ }
+}
+exports.MongoGCPError = MongoGCPError;
+/**
+ * An error indicating that an error occurred when executing the bulk write.
+ *
+ * @public
+ * @category Error
+ */
+class MongoClientBulkWriteError extends MongoServerError {
+ /**
+ * Initialize the client bulk write error.
+ * @param message - The error message.
+ */
+ constructor(message) {
+ super(message);
+ this.writeConcernErrors = [];
+ this.writeErrors = new Map();
+ }
+ get name() {
+ return 'MongoClientBulkWriteError';
+ }
+}
+exports.MongoClientBulkWriteError = MongoClientBulkWriteError;
+/**
+ * An error indicating that an error occurred when processing bulk write results.
+ *
+ * @public
+ * @category Error
+ */
+class MongoClientBulkWriteCursorError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoClientBulkWriteCursorError';
+ }
+}
+exports.MongoClientBulkWriteCursorError = MongoClientBulkWriteCursorError;
+/**
+ * An error indicating that an error occurred on the client when executing a client bulk write.
+ *
+ * @public
+ * @category Error
+ */
+class MongoClientBulkWriteExecutionError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoClientBulkWriteExecutionError';
+ }
+}
+exports.MongoClientBulkWriteExecutionError = MongoClientBulkWriteExecutionError;
+/**
+ * An error generated when a ChangeStream operation fails to execute.
+ *
+ * @public
+ * @category Error
+ */
+class MongoChangeStreamError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoChangeStreamError';
+ }
+}
+exports.MongoChangeStreamError = MongoChangeStreamError;
+/**
+ * An error thrown when the user calls a function or method not supported on a tailable cursor
+ *
+ * @public
+ * @category Error
+ */
+class MongoTailableCursorError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message = 'Tailable cursor does not support this operation') {
+ super(message);
+ }
+ get name() {
+ return 'MongoTailableCursorError';
+ }
+}
+exports.MongoTailableCursorError = MongoTailableCursorError;
+/** An error generated when a GridFSStream operation fails to execute.
+ *
+ * @public
+ * @category Error
+ */
+class MongoGridFSStreamError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoGridFSStreamError';
+ }
+}
+exports.MongoGridFSStreamError = MongoGridFSStreamError;
+/**
+ * An error generated when a malformed or invalid chunk is
+ * encountered when reading from a GridFSStream.
+ *
+ * @public
+ * @category Error
+ */
+class MongoGridFSChunkError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoGridFSChunkError';
+ }
+}
+exports.MongoGridFSChunkError = MongoGridFSChunkError;
+/**
+ * An error generated when a **parsable** unexpected response comes from the server.
+ * This is generally an error where the driver in a state expecting a certain behavior to occur in
+ * the next message from MongoDB but it receives something else.
+ * This error **does not** represent an issue with wire message formatting.
+ *
+ * #### Example
+ * When an operation fails, it is the driver's job to retry it. It must perform serverSelection
+ * again to make sure that it attempts the operation against a server in a good state. If server
+ * selection returns a server that does not support retryable operations, this error is used.
+ * This scenario is unlikely as retryable support would also have been determined on the first attempt
+ * but it is possible the state change could report a selectable server that does not support retries.
+ *
+ * @public
+ * @category Error
+ */
+class MongoUnexpectedServerResponseError extends MongoRuntimeError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ }
+ get name() {
+ return 'MongoUnexpectedServerResponseError';
+ }
+}
+exports.MongoUnexpectedServerResponseError = MongoUnexpectedServerResponseError;
+/**
+ * @public
+ * @category Error
+ *
+ * The `MongoOperationTimeoutError` class represents an error that occurs when an operation could not be completed within the specified `timeoutMS`.
+ * It is generated by the driver in support of the "client side operation timeout" feature so inherits from `MongoDriverError`.
+ * When `timeoutMS` is enabled `MongoServerError`s relating to `MaxTimeExpired` errors will be converted to `MongoOperationTimeoutError`
+ *
+ * @example
+ * ```ts
+ * try {
+ * await blogs.insertOne(blogPost, { timeoutMS: 60_000 })
+ * } catch (error) {
+ * if (error instanceof MongoOperationTimeoutError) {
+ * console.log(`Oh no! writer's block!`, error);
+ * }
+ * }
+ * ```
+ */
+class MongoOperationTimeoutError extends MongoDriverError {
+ get name() {
+ return 'MongoOperationTimeoutError';
+ }
+}
+exports.MongoOperationTimeoutError = MongoOperationTimeoutError;
+/**
+ * An error thrown when the user attempts to add options to a cursor that has already been
+ * initialized
+ *
+ * @public
+ * @category Error
+ */
+class MongoCursorInUseError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message = 'Cursor is already initialized') {
+ super(message);
+ }
+ get name() {
+ return 'MongoCursorInUseError';
+ }
+}
+exports.MongoCursorInUseError = MongoCursorInUseError;
+/**
+ * An error generated when an attempt is made to operate
+ * on a closed/closing server.
+ *
+ * @public
+ * @category Error
+ */
+class MongoServerClosedError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message = 'Server is closed') {
+ super(message);
+ }
+ get name() {
+ return 'MongoServerClosedError';
+ }
+}
+exports.MongoServerClosedError = MongoServerClosedError;
+/**
+ * An error thrown when an attempt is made to read from a cursor that has been exhausted
+ *
+ * @public
+ * @category Error
+ */
+class MongoCursorExhaustedError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message || 'Cursor is exhausted');
+ }
+ get name() {
+ return 'MongoCursorExhaustedError';
+ }
+}
+exports.MongoCursorExhaustedError = MongoCursorExhaustedError;
+/**
+ * An error generated when an attempt is made to operate on a
+ * dropped, or otherwise unavailable, database.
+ *
+ * @public
+ * @category Error
+ */
+class MongoTopologyClosedError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message = 'Topology is closed') {
+ super(message);
+ }
+ get name() {
+ return 'MongoTopologyClosedError';
+ }
+}
+exports.MongoTopologyClosedError = MongoTopologyClosedError;
+/**
+ * An error generated when the MongoClient is closed and async
+ * operations are interrupted.
+ *
+ * @public
+ * @category Error
+ */
+class MongoClientClosedError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor() {
+ super('Operation interrupted because client was closed');
+ }
+ get name() {
+ return 'MongoClientClosedError';
+ }
+}
+exports.MongoClientClosedError = MongoClientClosedError;
+/**
+ * An error indicating an issue with the network, including TCP errors and timeouts.
+ * @public
+ * @category Error
+ */
+class MongoNetworkError extends MongoError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, { cause: options?.cause });
+ this.beforeHandshake = !!options?.beforeHandshake;
+ }
+ get name() {
+ return 'MongoNetworkError';
+ }
+}
+exports.MongoNetworkError = MongoNetworkError;
+/**
+ * An error indicating a network timeout occurred
+ * @public
+ * @category Error
+ *
+ * @privateRemarks
+ * mongodb-client-encryption has a dependency on this error with an instanceof check
+ */
+class MongoNetworkTimeoutError extends MongoNetworkError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ }
+ get name() {
+ return 'MongoNetworkTimeoutError';
+ }
+}
+exports.MongoNetworkTimeoutError = MongoNetworkTimeoutError;
+/**
+ * An error used when attempting to parse a value (like a connection string)
+ * @public
+ * @category Error
+ */
+class MongoParseError extends MongoDriverError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoParseError';
+ }
+}
+exports.MongoParseError = MongoParseError;
+/**
+ * An error generated when the user supplies malformed or unexpected arguments
+ * or when a required argument or field is not provided.
+ *
+ *
+ * @public
+ * @category Error
+ */
+class MongoInvalidArgumentError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ }
+ get name() {
+ return 'MongoInvalidArgumentError';
+ }
+}
+exports.MongoInvalidArgumentError = MongoInvalidArgumentError;
+/**
+ * An error generated when a feature that is not enabled or allowed for the current server
+ * configuration is used
+ *
+ *
+ * @public
+ * @category Error
+ */
+class MongoCompatibilityError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoCompatibilityError';
+ }
+}
+exports.MongoCompatibilityError = MongoCompatibilityError;
+/**
+ * An error generated when the user fails to provide authentication credentials before attempting
+ * to connect to a mongo server instance.
+ *
+ *
+ * @public
+ * @category Error
+ */
+class MongoMissingCredentialsError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message) {
+ super(message);
+ }
+ get name() {
+ return 'MongoMissingCredentialsError';
+ }
+}
+exports.MongoMissingCredentialsError = MongoMissingCredentialsError;
+/**
+ * An error generated when a required module or dependency is not present in the local environment
+ *
+ * @public
+ * @category Error
+ */
+class MongoMissingDependencyError extends MongoAPIError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, options) {
+ super(message, options);
+ this.dependencyName = options.dependencyName;
+ }
+ get name() {
+ return 'MongoMissingDependencyError';
+ }
+}
+exports.MongoMissingDependencyError = MongoMissingDependencyError;
+/**
+ * An error signifying a general system issue
+ * @public
+ * @category Error
+ */
+class MongoSystemError extends MongoError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, reason) {
+ if (reason && reason.error) {
+ super(MongoError.buildErrorMessage(reason.error.message || reason.error), {
+ cause: reason.error
+ });
+ }
+ else {
+ super(message);
+ }
+ if (reason) {
+ this.reason = reason;
+ }
+ this.code = reason.error?.code;
+ }
+ get name() {
+ return 'MongoSystemError';
+ }
+}
+exports.MongoSystemError = MongoSystemError;
+/**
+ * An error signifying a client-side server selection error
+ * @public
+ * @category Error
+ */
+class MongoServerSelectionError extends MongoSystemError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(message, reason) {
+ super(message, reason);
+ }
+ get name() {
+ return 'MongoServerSelectionError';
+ }
+}
+exports.MongoServerSelectionError = MongoServerSelectionError;
+/**
+ * An error thrown when the server reports a writeConcernError
+ * @public
+ * @category Error
+ */
+class MongoWriteConcernError extends MongoServerError {
+ /**
+ * **Do not use this constructor!**
+ *
+ * Meant for internal use only.
+ *
+ * @remarks
+ * This class is only meant to be constructed within the driver. This constructor is
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
+ *
+ * @public
+ **/
+ constructor(result) {
+ super({ ...result.writeConcernError, ...result });
+ this.errInfo = result.writeConcernError.errInfo;
+ this.result = result;
+ }
+ get name() {
+ return 'MongoWriteConcernError';
+ }
+}
+exports.MongoWriteConcernError = MongoWriteConcernError;
+// https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.md#retryable-error
+const RETRYABLE_READ_ERROR_CODES = new Set([
+ exports.MONGODB_ERROR_CODES.HostUnreachable,
+ exports.MONGODB_ERROR_CODES.HostNotFound,
+ exports.MONGODB_ERROR_CODES.NetworkTimeout,
+ exports.MONGODB_ERROR_CODES.ShutdownInProgress,
+ exports.MONGODB_ERROR_CODES.PrimarySteppedDown,
+ exports.MONGODB_ERROR_CODES.SocketException,
+ exports.MONGODB_ERROR_CODES.NotWritablePrimary,
+ exports.MONGODB_ERROR_CODES.InterruptedAtShutdown,
+ exports.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,
+ exports.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,
+ exports.MONGODB_ERROR_CODES.NotPrimaryOrSecondary,
+ exports.MONGODB_ERROR_CODES.ExceededTimeLimit,
+ exports.MONGODB_ERROR_CODES.ReadConcernMajorityNotAvailableYet
+]);
+// see: https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.md#terms
+const RETRYABLE_WRITE_ERROR_CODES = RETRYABLE_READ_ERROR_CODES;
+function needsRetryableWriteLabel(error, maxWireVersion, serverType) {
+ // pre-4.4 server, then the driver adds an error label for every valid case
+ // execute operation will only inspect the label, code/message logic is handled here
+ if (error instanceof MongoNetworkError) {
+ return true;
+ }
+ if (error instanceof MongoError) {
+ if ((maxWireVersion >= 9 || isRetryableWriteError(error)) &&
+ !error.hasErrorLabel(exports.MongoErrorLabel.HandshakeError)) {
+ // If we already have the error label no need to add it again. 4.4+ servers add the label.
+ // In the case where we have a handshake error, need to fall down to the logic checking
+ // the codes.
+ return false;
+ }
+ }
+ if (error instanceof MongoWriteConcernError) {
+ if (serverType === 'Mongos' && maxWireVersion < 9) {
+ // use original top-level code from server response
+ return RETRYABLE_WRITE_ERROR_CODES.has(error.result.code ?? 0);
+ }
+ const code = error.result.writeConcernError.code ?? Number(error.code);
+ return RETRYABLE_WRITE_ERROR_CODES.has(Number.isNaN(code) ? 0 : code);
+ }
+ if (error instanceof MongoError) {
+ return RETRYABLE_WRITE_ERROR_CODES.has(Number(error.code));
+ }
+ const isNotWritablePrimaryError = exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(error.message);
+ if (isNotWritablePrimaryError) {
+ return true;
+ }
+ const isNodeIsRecoveringError = exports.NODE_IS_RECOVERING_ERROR_MESSAGE.test(error.message);
+ if (isNodeIsRecoveringError) {
+ return true;
+ }
+ return false;
+}
+function isRetryableWriteError(error) {
+ return (error.hasErrorLabel(exports.MongoErrorLabel.RetryableWriteError) ||
+ error.hasErrorLabel(exports.MongoErrorLabel.PoolRequestedRetry));
+}
+/** Determines whether an error is something the driver should attempt to retry */
+function isRetryableReadError(error) {
+ const hasRetryableErrorCode = typeof error.code === 'number' ? RETRYABLE_READ_ERROR_CODES.has(error.code) : false;
+ if (hasRetryableErrorCode) {
+ return true;
+ }
+ if (error instanceof MongoNetworkError) {
+ return true;
+ }
+ const isNotWritablePrimaryError = exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(error.message);
+ if (isNotWritablePrimaryError) {
+ return true;
+ }
+ const isNodeIsRecoveringError = exports.NODE_IS_RECOVERING_ERROR_MESSAGE.test(error.message);
+ if (isNodeIsRecoveringError) {
+ return true;
+ }
+ return false;
+}
+const SDAM_RECOVERING_CODES = new Set([
+ exports.MONGODB_ERROR_CODES.ShutdownInProgress,
+ exports.MONGODB_ERROR_CODES.PrimarySteppedDown,
+ exports.MONGODB_ERROR_CODES.InterruptedAtShutdown,
+ exports.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,
+ exports.MONGODB_ERROR_CODES.NotPrimaryOrSecondary
+]);
+const SDAM_NOT_PRIMARY_CODES = new Set([
+ exports.MONGODB_ERROR_CODES.NotWritablePrimary,
+ exports.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,
+ exports.MONGODB_ERROR_CODES.LegacyNotPrimary
+]);
+const SDAM_NODE_SHUTTING_DOWN_ERROR_CODES = new Set([
+ exports.MONGODB_ERROR_CODES.InterruptedAtShutdown,
+ exports.MONGODB_ERROR_CODES.ShutdownInProgress
+]);
+function isRecoveringError(err) {
+ if (typeof err.code === 'number') {
+ // If any error code exists, we ignore the error.message
+ return SDAM_RECOVERING_CODES.has(err.code);
+ }
+ return (exports.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE.test(err.message) ||
+ exports.NODE_IS_RECOVERING_ERROR_MESSAGE.test(err.message));
+}
+function isNotWritablePrimaryError(err) {
+ if (typeof err.code === 'number') {
+ // If any error code exists, we ignore the error.message
+ return SDAM_NOT_PRIMARY_CODES.has(err.code);
+ }
+ if (isRecoveringError(err)) {
+ return false;
+ }
+ return exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(err.message);
+}
+function isNodeShuttingDownError(err) {
+ return !!(typeof err.code === 'number' && SDAM_NODE_SHUTTING_DOWN_ERROR_CODES.has(err.code));
+}
+/**
+ * Determines whether SDAM can recover from a given error. If it cannot
+ * then the pool will be cleared, and server state will completely reset
+ * locally.
+ *
+ * @see https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
+ */
+function isStateChangeError(error) {
+ return isRecoveringError(error) || isNotWritablePrimaryError(error);
+}
+function isNetworkTimeoutError(err) {
+ return !!(err instanceof MongoNetworkError && err.message.match(/timed out/));
+}
+function isResumableError(error, wireVersion) {
+ if (error == null || !(error instanceof MongoError)) {
+ return false;
+ }
+ if (error instanceof MongoNetworkError) {
+ return true;
+ }
+ if (error instanceof MongoServerSelectionError) {
+ return true;
+ }
+ if (wireVersion != null && wireVersion >= 9) {
+ // DRIVERS-1308: For 4.4 drivers running against 4.4 servers, drivers will add a special case to treat the CursorNotFound error code as resumable
+ if (error.code === exports.MONGODB_ERROR_CODES.CursorNotFound) {
+ return true;
+ }
+ return error.hasErrorLabel(exports.MongoErrorLabel.ResumableChangeStreamError);
+ }
+ if (typeof error.code === 'number') {
+ return exports.GET_MORE_RESUMABLE_CODES.has(error.code);
+ }
+ return false;
+}
+//# sourceMappingURL=error.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/error.js.map b/node_modules/mongodb/lib/error.js.map
new file mode 100644
index 00000000..9b30190d
--- /dev/null
+++ b/node_modules/mongodb/lib/error.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";;;AAo3CA,4DA+CC;AAED,sDAKC;AAGD,oDAsBC;AA8CD,0DAEC;AASD,gDAEC;AAED,sDAEC;AAED,4CA0BC;AAlhDD;;;;GAIG;AACU,QAAA,yCAAyC,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;AAEvF;;;;GAIG;AACU,QAAA,6CAA6C,GAAG,IAAI,MAAM,CACrE,yBAAyB,EACzB,GAAG,CACJ,CAAC;AAEF;;;;GAIG;AACU,QAAA,gCAAgC,GAAG,IAAI,MAAM,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;AAEtF,oCAAoC;AACvB,QAAA,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,eAAe,EAAE,CAAC;IAClB,YAAY,EAAE,CAAC;IACf,oBAAoB,EAAE,EAAE;IACxB,cAAc,EAAE,EAAE;IAClB,kBAAkB,EAAE,EAAE;IACtB,kBAAkB,EAAE,GAAG;IACvB,iBAAiB,EAAE,GAAG;IACtB,eAAe,EAAE,IAAI;IACrB,kBAAkB,EAAE,KAAK;IACzB,qBAAqB,EAAE,KAAK;IAC5B,+BAA+B,EAAE,KAAK;IACtC,uBAAuB,EAAE,KAAK;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,iBAAiB,EAAE,EAAE;IACrB,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,KAAK;IAClB,iBAAiB,EAAE,GAAG;IACtB,6BAA6B,EAAE,GAAG;IAClC,cAAc,EAAE,EAAE;IAClB,gBAAgB,EAAE,KAAK;IACvB,+DAA+D;IAC/D,mBAAmB,EAAE,EAAE;IACvB,iBAAiB,EAAE,EAAE;IACrB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACp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,EAAE,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,KAAK,YAAY,yBAAyB,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,WAAW,IAAI,IAAI,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC;QAC5C,iJAAiJ;QACjJ,IAAI,KAAK,CAAC,IAAI,KAAK,2BAAmB,CAAC,cAAc,EAAE,CAAC;YACtD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,uBAAe,CAAC,0BAA0B,CAAC,CAAC;IACzE,CAAC;IAED,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,gCAAwB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/explain.js b/node_modules/mongodb/lib/explain.js
new file mode 100644
index 00000000..e9a6dbdb
--- /dev/null
+++ b/node_modules/mongodb/lib/explain.js
@@ -0,0 +1,59 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Explain = exports.ExplainVerbosity = void 0;
+exports.validateExplainTimeoutOptions = validateExplainTimeoutOptions;
+exports.decorateWithExplain = decorateWithExplain;
+const error_1 = require("./error");
+/** @public */
+exports.ExplainVerbosity = Object.freeze({
+ queryPlanner: 'queryPlanner',
+ queryPlannerExtended: 'queryPlannerExtended',
+ executionStats: 'executionStats',
+ allPlansExecution: 'allPlansExecution'
+});
+/** @internal */
+class Explain {
+ constructor(verbosity, maxTimeMS) {
+ if (typeof verbosity === 'boolean') {
+ this.verbosity = verbosity
+ ? exports.ExplainVerbosity.allPlansExecution
+ : exports.ExplainVerbosity.queryPlanner;
+ }
+ else {
+ this.verbosity = verbosity;
+ }
+ this.maxTimeMS = maxTimeMS;
+ }
+ static fromOptions({ explain } = {}) {
+ if (explain == null)
+ return;
+ if (typeof explain === 'boolean' || typeof explain === 'string') {
+ return new Explain(explain);
+ }
+ const { verbosity, maxTimeMS } = explain;
+ return new Explain(verbosity, maxTimeMS);
+ }
+}
+exports.Explain = Explain;
+function validateExplainTimeoutOptions(options, explain) {
+ const { maxTimeMS, timeoutMS } = options;
+ if (timeoutMS != null && (maxTimeMS != null || explain?.maxTimeMS != null)) {
+ throw new error_1.MongoAPIError('Cannot use maxTimeMS with timeoutMS for explain commands.');
+ }
+}
+/**
+ * Applies an explain to a given command.
+ * @internal
+ *
+ * @param command - the command on which to apply the explain
+ * @param options - the options containing the explain verbosity
+ */
+function decorateWithExplain(command, explain) {
+ const { verbosity, maxTimeMS } = explain;
+ const baseCommand = { explain: command, verbosity };
+ if (typeof maxTimeMS === 'number') {
+ baseCommand.maxTimeMS = maxTimeMS;
+ }
+ return baseCommand;
+}
+//# sourceMappingURL=explain.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/explain.js.map b/node_modules/mongodb/lib/explain.js.map
new file mode 100644
index 00000000..adc2e47e
--- /dev/null
+++ b/node_modules/mongodb/lib/explain.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"explain.js","sourceRoot":"","sources":["../src/explain.ts"],"names":[],"mappings":";;;AA4FA,sEAKC;AASD,kDAiBC;AA1HD,mCAAwC;AAExC,cAAc;AACD,QAAA,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,YAAY,EAAE,cAAc;IAC5B,oBAAoB,EAAE,sBAAsB;IAC5C,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;CAC9B,CAAC,CAAC;AAsDZ,gBAAgB;AAChB,MAAa,OAAO;IAIlB,YAAoB,SAA+B,EAAE,SAAkB;QACrE,IAAI,OAAO,SAAS,KAAK,SAAS,EAAE,CAAC;YACnC,IAA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CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/gridfs/download.js b/node_modules/mongodb/lib/gridfs/download.js
new file mode 100644
index 00000000..a5b65ead
--- /dev/null
+++ b/node_modules/mongodb/lib/gridfs/download.js
@@ -0,0 +1,306 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.GridFSBucketReadStream = void 0;
+const stream_1 = require("stream");
+const bson_1 = require("../bson");
+const abstract_cursor_1 = require("../cursor/abstract_cursor");
+const error_1 = require("../error");
+const timeout_1 = require("../timeout");
+/**
+ * A readable stream that enables you to read buffers from GridFS.
+ *
+ * Do not instantiate this class directly. Use `openDownloadStream()` instead.
+ * @public
+ */
+class GridFSBucketReadStream extends stream_1.Readable {
+ /**
+ * Fires when the stream loaded the file document corresponding to the provided id.
+ * @event
+ */
+ static { this.FILE = 'file'; }
+ /**
+ * @param chunks - Handle for chunks collection
+ * @param files - Handle for files collection
+ * @param readPreference - The read preference to use
+ * @param filter - The filter to use to find the file document
+ * @internal
+ */
+ constructor(chunks, files, readPreference, filter, options) {
+ super({ emitClose: true });
+ this.s = {
+ bytesToTrim: 0,
+ bytesToSkip: 0,
+ bytesRead: 0,
+ chunks,
+ expected: 0,
+ files,
+ filter,
+ init: false,
+ expectedEnd: 0,
+ options: {
+ start: 0,
+ end: 0,
+ ...options
+ },
+ readPreference,
+ timeoutContext: options?.timeoutMS != null
+ ? new timeout_1.CSOTTimeoutContext({ timeoutMS: options.timeoutMS, serverSelectionTimeoutMS: 0 })
+ : undefined
+ };
+ }
+ /**
+ * Reads from the cursor and pushes to the stream.
+ * Private Impl, do not call directly
+ * @internal
+ */
+ _read() {
+ if (this.destroyed)
+ return;
+ waitForFile(this, () => doRead(this));
+ }
+ /**
+ * Sets the 0-based offset in bytes to start streaming from. Throws
+ * an error if this stream has entered flowing mode
+ * (e.g. if you've already called `on('data')`)
+ *
+ * @param start - 0-based offset in bytes to start streaming from
+ */
+ start(start = 0) {
+ throwIfInitialized(this);
+ this.s.options.start = start;
+ return this;
+ }
+ /**
+ * Sets the 0-based offset in bytes to start streaming from. Throws
+ * an error if this stream has entered flowing mode
+ * (e.g. if you've already called `on('data')`)
+ *
+ * @param end - Offset in bytes to stop reading at
+ */
+ end(end = 0) {
+ throwIfInitialized(this);
+ this.s.options.end = end;
+ return this;
+ }
+ /**
+ * Marks this stream as aborted (will never push another `data` event)
+ * and kills the underlying cursor. Will emit the 'end' event, and then
+ * the 'close' event once the cursor is successfully killed.
+ */
+ async abort() {
+ this.push(null);
+ this.destroy();
+ const remainingTimeMS = this.s.timeoutContext?.getRemainingTimeMSOrThrow();
+ await this.s.cursor?.close({ timeoutMS: remainingTimeMS });
+ }
+}
+exports.GridFSBucketReadStream = GridFSBucketReadStream;
+function throwIfInitialized(stream) {
+ if (stream.s.init) {
+ throw new error_1.MongoGridFSStreamError('Options cannot be changed after the stream is initialized');
+ }
+}
+function doRead(stream) {
+ if (stream.destroyed)
+ return;
+ if (!stream.s.cursor)
+ return;
+ if (!stream.s.file)
+ return;
+ const handleReadResult = (doc) => {
+ if (stream.destroyed)
+ return;
+ if (!doc) {
+ stream.push(null);
+ stream.s.cursor?.close().then(undefined, error => stream.destroy(error));
+ return;
+ }
+ if (!stream.s.file)
+ return;
+ const bytesRemaining = stream.s.file.length - stream.s.bytesRead;
+ const expectedN = stream.s.expected++;
+ const expectedLength = Math.min(stream.s.file.chunkSize, bytesRemaining);
+ if (doc.n > expectedN) {
+ return stream.destroy(new error_1.MongoGridFSChunkError(`ChunkIsMissing: Got unexpected n: ${doc.n}, expected: ${expectedN}`));
+ }
+ if (doc.n < expectedN) {
+ return stream.destroy(new error_1.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${doc.n}, expected: ${expectedN}`));
+ }
+ let buf = bson_1.ByteUtils.isUint8Array(doc.data) ? doc.data : doc.data.buffer;
+ if (buf.byteLength !== expectedLength) {
+ if (bytesRemaining <= 0) {
+ return stream.destroy(new error_1.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${doc.n}, expected file length ${stream.s.file.length} bytes but already read ${stream.s.bytesRead} bytes`));
+ }
+ return stream.destroy(new error_1.MongoGridFSChunkError(`ChunkIsWrongSize: Got unexpected length: ${buf.byteLength}, expected: ${expectedLength}`));
+ }
+ stream.s.bytesRead += buf.byteLength;
+ if (buf.byteLength === 0) {
+ return stream.push(null);
+ }
+ let sliceStart = null;
+ let sliceEnd = null;
+ if (stream.s.bytesToSkip != null) {
+ sliceStart = stream.s.bytesToSkip;
+ stream.s.bytesToSkip = 0;
+ }
+ const atEndOfStream = expectedN === stream.s.expectedEnd - 1;
+ const bytesLeftToRead = stream.s.options.end - stream.s.bytesToSkip;
+ if (atEndOfStream && stream.s.bytesToTrim != null) {
+ sliceEnd = stream.s.file.chunkSize - stream.s.bytesToTrim;
+ }
+ else if (stream.s.options.end && bytesLeftToRead < doc.data.byteLength) {
+ sliceEnd = bytesLeftToRead;
+ }
+ if (sliceStart != null || sliceEnd != null) {
+ buf = buf.slice(sliceStart || 0, sliceEnd || buf.byteLength);
+ }
+ stream.push(buf);
+ return;
+ };
+ stream.s.cursor.next().then(handleReadResult, error => {
+ if (stream.destroyed)
+ return;
+ stream.destroy(error);
+ });
+}
+function init(stream) {
+ const findOneOptions = {};
+ if (stream.s.readPreference) {
+ findOneOptions.readPreference = stream.s.readPreference;
+ }
+ if (stream.s.options && stream.s.options.sort) {
+ findOneOptions.sort = stream.s.options.sort;
+ }
+ if (stream.s.options && stream.s.options.skip) {
+ findOneOptions.skip = stream.s.options.skip;
+ }
+ const handleReadResult = (doc) => {
+ if (stream.destroyed)
+ return;
+ if (!doc) {
+ const identifier = stream.s.filter._id
+ ? stream.s.filter._id.toString()
+ : stream.s.filter.filename;
+ const errmsg = `FileNotFound: file ${identifier} was not found`;
+ // TODO(NODE-3483)
+ const err = new error_1.MongoRuntimeError(errmsg);
+ err.code = 'ENOENT'; // TODO: NODE-3338 set property as part of constructor
+ return stream.destroy(err);
+ }
+ // If document is empty, kill the stream immediately and don't
+ // execute any reads
+ if (doc.length <= 0) {
+ stream.push(null);
+ return;
+ }
+ if (stream.destroyed) {
+ // If user destroys the stream before we have a cursor, wait
+ // until the query is done to say we're 'closed' because we can't
+ // cancel a query.
+ stream.destroy();
+ return;
+ }
+ try {
+ stream.s.bytesToSkip = handleStartOption(stream, doc, stream.s.options);
+ }
+ catch (error) {
+ return stream.destroy(error);
+ }
+ const filter = { files_id: doc._id };
+ // Currently (MongoDB 3.4.4) skip function does not support the index,
+ // it needs to retrieve all the documents first and then skip them. (CS-25811)
+ // As work around we use $gte on the "n" field.
+ if (stream.s.options && stream.s.options.start != null) {
+ const skip = Math.floor(stream.s.options.start / doc.chunkSize);
+ if (skip > 0) {
+ filter['n'] = { $gte: skip };
+ }
+ }
+ let remainingTimeMS;
+ try {
+ remainingTimeMS = stream.s.timeoutContext?.getRemainingTimeMSOrThrow(`Download timed out after ${stream.s.timeoutContext?.timeoutMS}ms`);
+ }
+ catch (error) {
+ return stream.destroy(error);
+ }
+ stream.s.cursor = stream.s.chunks
+ .find(filter, {
+ timeoutMode: stream.s.options.timeoutMS != null ? abstract_cursor_1.CursorTimeoutMode.LIFETIME : undefined,
+ timeoutMS: remainingTimeMS
+ })
+ .sort({ n: 1 });
+ if (stream.s.readPreference) {
+ stream.s.cursor.withReadPreference(stream.s.readPreference);
+ }
+ stream.s.expectedEnd = Math.ceil(doc.length / doc.chunkSize);
+ stream.s.file = doc;
+ try {
+ stream.s.bytesToTrim = handleEndOption(stream, doc, stream.s.cursor, stream.s.options);
+ }
+ catch (error) {
+ return stream.destroy(error);
+ }
+ stream.emit(GridFSBucketReadStream.FILE, doc);
+ return;
+ };
+ let remainingTimeMS;
+ try {
+ remainingTimeMS = stream.s.timeoutContext?.getRemainingTimeMSOrThrow(`Download timed out after ${stream.s.timeoutContext?.timeoutMS}ms`);
+ }
+ catch (error) {
+ if (!stream.destroyed)
+ stream.destroy(error);
+ return;
+ }
+ findOneOptions.timeoutMS = remainingTimeMS;
+ stream.s.files.findOne(stream.s.filter, findOneOptions).then(handleReadResult, error => {
+ if (stream.destroyed)
+ return;
+ stream.destroy(error);
+ });
+}
+function waitForFile(stream, callback) {
+ if (stream.s.file) {
+ return callback();
+ }
+ if (!stream.s.init) {
+ init(stream);
+ stream.s.init = true;
+ }
+ stream.once('file', () => {
+ callback();
+ });
+}
+function handleStartOption(stream, doc, options) {
+ if (options && options.start != null) {
+ if (options.start > doc.length) {
+ throw new error_1.MongoInvalidArgumentError(`Stream start (${options.start}) must not be more than the length of the file (${doc.length})`);
+ }
+ if (options.start < 0) {
+ throw new error_1.MongoInvalidArgumentError(`Stream start (${options.start}) must not be negative`);
+ }
+ if (options.end != null && options.end < options.start) {
+ throw new error_1.MongoInvalidArgumentError(`Stream start (${options.start}) must not be greater than stream end (${options.end})`);
+ }
+ stream.s.bytesRead = Math.floor(options.start / doc.chunkSize) * doc.chunkSize;
+ stream.s.expected = Math.floor(options.start / doc.chunkSize);
+ return options.start - stream.s.bytesRead;
+ }
+ throw new error_1.MongoInvalidArgumentError('Start option must be defined');
+}
+function handleEndOption(stream, doc, cursor, options) {
+ if (options && options.end != null) {
+ if (options.end > doc.length) {
+ throw new error_1.MongoInvalidArgumentError(`Stream end (${options.end}) must not be more than the length of the file (${doc.length})`);
+ }
+ if (options.start == null || options.start < 0) {
+ throw new error_1.MongoInvalidArgumentError(`Stream end (${options.end}) must not be negative`);
+ }
+ const start = options.start != null ? Math.floor(options.start / doc.chunkSize) : 0;
+ cursor.limit(Math.ceil(options.end / doc.chunkSize) - start);
+ stream.s.expectedEnd = Math.ceil(options.end / doc.chunkSize);
+ return Math.ceil(options.end / doc.chunkSize) * doc.chunkSize - options.end;
+ }
+ throw new error_1.MongoInvalidArgumentError('End option must be defined');
+}
+//# sourceMappingURL=download.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/gridfs/download.js.map b/node_modules/mongodb/lib/gridfs/download.js.map
new file mode 100644
index 00000000..be07a570
--- /dev/null
+++ b/node_modules/mongodb/lib/gridfs/download.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"download.js","sourceRoot":"","sources":["../../src/gridfs/download.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAElC,kCAAkE;AAElE,+DAA8D;AAE9D,oCAKkB;AAIlB,wCAAgD;AA4FhD;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,iBAAQ;IAIlD;;;OAGG;aACa,SAAI,GAAG,MAAe,CAAC;IAEvC;;;;;;OAMG;IACH,YACE,MAA+B,EAC/B,KAA6B,EAC7B,cAA0C,EAC1C,MAAgB,EAChB,OAAuC;QAEvC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3B,IAAI,CAAC,CAAC,GAAG;YACP,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,CAAC;YACd,SAAS,EAAE,CAAC;YACZ,MAAM;YACN,QAAQ,EAAE,CAAC;YACX,KAAK;YACL,MAAM;YACN,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,CAAC;YACd,OAAO,EAAE;gBACP,KAAK,EAAE,CAAC;gBACR,GAAG,EAAE,CAAC;gBACN,GAAG,OAAO;aACX;YACD,cAAc;YACd,cAAc,EACZ,OAAO,EAAE,SAAS,IAAI,IAAI;gBACxB,CAAC,CAAC,IAAI,4BAAkB,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,wBAAwB,EAAE,CAAC,EAAE,CAAC;gBACvF,CAAC,CAAC,SAAS;SAChB,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACM,KAAK;QACZ,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,GAAG,CAAC;QACb,kBAAkB,CAAC,IAAI,CAAC,CA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odb/lib/gridfs/index.js
new file mode 100644
index 00000000..c9184cbe
--- /dev/null
+++ b/node_modules/mongodb/lib/gridfs/index.js
@@ -0,0 +1,164 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.GridFSBucket = void 0;
+const error_1 = require("../error");
+const mongo_types_1 = require("../mongo_types");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const write_concern_1 = require("../write_concern");
+const download_1 = require("./download");
+const upload_1 = require("./upload");
+const DEFAULT_GRIDFS_BUCKET_OPTIONS = {
+ bucketName: 'fs',
+ chunkSizeBytes: 255 * 1024
+};
+/**
+ * Constructor for a streaming GridFS interface
+ * @public
+ */
+class GridFSBucket extends mongo_types_1.TypedEventEmitter {
+ /**
+ * When the first call to openUploadStream is made, the upload stream will
+ * check to see if it needs to create the proper indexes on the chunks and
+ * files collections. This event is fired either when 1) it determines that
+ * no index creation is necessary, 2) when it successfully creates the
+ * necessary indexes.
+ * @event
+ */
+ static { this.INDEX = 'index'; }
+ constructor(db, options) {
+ super();
+ this.on('error', utils_1.noop);
+ this.setMaxListeners(0);
+ const privateOptions = (0, utils_1.resolveOptions)(db, {
+ ...DEFAULT_GRIDFS_BUCKET_OPTIONS,
+ ...options,
+ writeConcern: write_concern_1.WriteConcern.fromOptions(options)
+ });
+ this.s = {
+ db,
+ options: privateOptions,
+ _chunksCollection: db.collection(privateOptions.bucketName + '.chunks'),
+ _filesCollection: db.collection(privateOptions.bucketName + '.files'),
+ checkedIndexes: false,
+ calledOpenUploadStream: false
+ };
+ }
+ /**
+ * Returns a writable stream (GridFSBucketWriteStream) for writing
+ * buffers to GridFS. The stream's 'id' property contains the resulting
+ * file's id.
+ *
+ * @param filename - The value of the 'filename' key in the files doc
+ * @param options - Optional settings.
+ */
+ openUploadStream(filename, options) {
+ return new upload_1.GridFSBucketWriteStream(this, filename, {
+ timeoutMS: this.s.options.timeoutMS,
+ ...options
+ });
+ }
+ /**
+ * Returns a writable stream (GridFSBucketWriteStream) for writing
+ * buffers to GridFS for a custom file id. The stream's 'id' property contains the resulting
+ * file's id.
+ */
+ openUploadStreamWithId(id, filename, options) {
+ return new upload_1.GridFSBucketWriteStream(this, filename, {
+ timeoutMS: this.s.options.timeoutMS,
+ ...options,
+ id
+ });
+ }
+ /** Returns a readable stream (GridFSBucketReadStream) for streaming file data from GridFS. */
+ openDownloadStream(id, options) {
+ return new download_1.GridFSBucketReadStream(this.s._chunksCollection, this.s._filesCollection, this.s.options.readPreference, { _id: id }, { timeoutMS: this.s.options.timeoutMS, ...options });
+ }
+ /**
+ * Deletes a file with the given id
+ *
+ * @param id - The id of the file doc
+ */
+ async delete(id, options) {
+ const { timeoutMS } = (0, utils_1.resolveOptions)(this.s.db, options);
+ let timeoutContext = undefined;
+ if (timeoutMS) {
+ timeoutContext = new timeout_1.CSOTTimeoutContext({
+ timeoutMS,
+ serverSelectionTimeoutMS: this.s.db.client.s.options.serverSelectionTimeoutMS
+ });
+ }
+ const { deletedCount } = await this.s._filesCollection.deleteOne({ _id: id }, { timeoutMS: timeoutContext?.remainingTimeMS });
+ const remainingTimeMS = timeoutContext?.remainingTimeMS;
+ if (remainingTimeMS != null && remainingTimeMS <= 0)
+ throw new error_1.MongoOperationTimeoutError(`Timed out after ${timeoutMS}ms`);
+ // Delete orphaned chunks before returning FileNotFound
+ await this.s._chunksCollection.deleteMany({ files_id: id }, { timeoutMS: remainingTimeMS });
+ if (deletedCount === 0) {
+ // TODO(NODE-3483): Replace with more appropriate error
+ // Consider creating new error MongoGridFSFileNotFoundError
+ throw new error_1.MongoRuntimeError(`File not found for id ${id}`);
+ }
+ }
+ /** Convenience wrapper around find on the files collection */
+ find(filter = {}, options = {}) {
+ return this.s._filesCollection.find(filter, options);
+ }
+ /**
+ * Returns a readable stream (GridFSBucketReadStream) for streaming the
+ * file with the given name from GridFS. If there are multiple files with
+ * the same name, this will stream the most recent file with the given name
+ * (as determined by the `uploadDate` field). You can set the `revision`
+ * option to change this behavior.
+ */
+ openDownloadStreamByName(filename, options) {
+ let sort = { uploadDate: -1 };
+ let skip = undefined;
+ if (options && options.revision != null) {
+ if (options.revision >= 0) {
+ sort = { uploadDate: 1 };
+ skip = options.revision;
+ }
+ else {
+ skip = -options.revision - 1;
+ }
+ }
+ return new download_1.GridFSBucketReadStream(this.s._chunksCollection, this.s._filesCollection, this.s.options.readPreference, { filename }, { timeoutMS: this.s.options.timeoutMS, ...options, sort, skip });
+ }
+ /**
+ * Renames the file with the given _id to the given string
+ *
+ * @param id - the id of the file to rename
+ * @param filename - new name for the file
+ */
+ async rename(id, filename, options) {
+ const filter = { _id: id };
+ const update = { $set: { filename } };
+ const { matchedCount } = await this.s._filesCollection.updateOne(filter, update, options);
+ if (matchedCount === 0) {
+ throw new error_1.MongoRuntimeError(`File with id ${id} not found`);
+ }
+ }
+ /** Removes this bucket's files collection, followed by its chunks collection. */
+ async drop(options) {
+ const { timeoutMS } = (0, utils_1.resolveOptions)(this.s.db, options);
+ let timeoutContext = undefined;
+ if (timeoutMS) {
+ timeoutContext = new timeout_1.CSOTTimeoutContext({
+ timeoutMS,
+ serverSelectionTimeoutMS: this.s.db.client.s.options.serverSelectionTimeoutMS
+ });
+ }
+ if (timeoutContext) {
+ await this.s._filesCollection.drop({ timeoutMS: timeoutContext.remainingTimeMS });
+ const remainingTimeMS = timeoutContext.getRemainingTimeMSOrThrow(`Timed out after ${timeoutMS}ms`);
+ await this.s._chunksCollection.drop({ timeoutMS: remainingTimeMS });
+ }
+ else {
+ await this.s._filesCollection.drop();
+ await this.s._chunksCollection.drop();
+ }
+ }
+}
+exports.GridFSBucket = GridFSBucket;
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/gridfs/index.js.map b/node_modules/mongodb/lib/gridfs/index.js.map
new file mode 100644
index 00000000..9b5676b7
--- /dev/null
+++ b/node_modules/mongodb/lib/gridfs/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gridfs/index.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,CAC9D,mBAAmB,SAAS,IAAI,CACjC,CAAC;YACF,MAAM,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;YACrC,MAAM,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QACxC,CAAC;IACH,CAAC;;AA7LH,oCA8LC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/gridfs/upload.js b/node_modules/mongodb/lib/gridfs/upload.js
new file mode 100644
index 00000000..7b8b163a
--- /dev/null
+++ b/node_modules/mongodb/lib/gridfs/upload.js
@@ -0,0 +1,358 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.GridFSBucketWriteStream = void 0;
+const stream_1 = require("stream");
+const bson_1 = require("../bson");
+const abstract_cursor_1 = require("../cursor/abstract_cursor");
+const error_1 = require("../error");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const write_concern_1 = require("./../write_concern");
+/**
+ * A writable stream that enables you to write buffers to GridFS.
+ *
+ * Do not instantiate this class directly. Use `openUploadStream()` instead.
+ * @public
+ */
+class GridFSBucketWriteStream extends stream_1.Writable {
+ /**
+ * @param bucket - Handle for this stream's corresponding bucket
+ * @param filename - The value of the 'filename' key in the files doc
+ * @param options - Optional settings.
+ * @internal
+ */
+ constructor(bucket, filename, options) {
+ super();
+ /**
+ * The document containing information about the inserted file.
+ * This property is defined _after_ the finish event has been emitted.
+ * It will remain `null` if an error occurs.
+ *
+ * @example
+ * ```ts
+ * fs.createReadStream('file.txt')
+ * .pipe(bucket.openUploadStream('file.txt'))
+ * .on('finish', function () {
+ * console.log(this.gridFSFile)
+ * })
+ * ```
+ */
+ this.gridFSFile = null;
+ options = options ?? {};
+ this.bucket = bucket;
+ this.chunks = bucket.s._chunksCollection;
+ this.filename = filename;
+ this.files = bucket.s._filesCollection;
+ this.options = options;
+ this.writeConcern = write_concern_1.WriteConcern.fromOptions(options) || bucket.s.options.writeConcern;
+ // Signals the write is all done
+ this.done = false;
+ this.id = options.id ? options.id : new bson_1.ObjectId();
+ // properly inherit the default chunksize from parent
+ this.chunkSizeBytes = options.chunkSizeBytes || this.bucket.s.options.chunkSizeBytes;
+ this.bufToStore = bson_1.ByteUtils.allocate(this.chunkSizeBytes);
+ this.length = 0;
+ this.n = 0;
+ this.pos = 0;
+ this.state = {
+ streamEnd: false,
+ outstandingRequests: 0,
+ errored: false,
+ aborted: false
+ };
+ if (options.timeoutMS != null)
+ this.timeoutContext = new timeout_1.CSOTTimeoutContext({
+ timeoutMS: options.timeoutMS,
+ serverSelectionTimeoutMS: (0, utils_1.resolveTimeoutOptions)(this.bucket.s.db.client, {})
+ .serverSelectionTimeoutMS
+ });
+ }
+ /**
+ * @internal
+ *
+ * The stream is considered constructed when the indexes are done being created
+ */
+ _construct(callback) {
+ if (!this.bucket.s.calledOpenUploadStream) {
+ this.bucket.s.calledOpenUploadStream = true;
+ checkIndexes(this).then(() => {
+ this.bucket.s.checkedIndexes = true;
+ this.bucket.emit('index');
+ callback();
+ }, error => {
+ if (error instanceof error_1.MongoOperationTimeoutError) {
+ return handleError(this, error, callback);
+ }
+ (0, utils_1.squashError)(error);
+ callback();
+ });
+ }
+ else {
+ return queueMicrotask(callback);
+ }
+ }
+ /**
+ * @internal
+ * Write a buffer to the stream.
+ *
+ * @param chunk - Buffer to write
+ * @param encoding - Optional encoding for the buffer
+ * @param callback - Function to call when the chunk was added to the buffer, or if the entire chunk was persisted to MongoDB if this chunk caused a flush.
+ */
+ _write(chunk, encoding, callback) {
+ doWrite(this, chunk, encoding, callback);
+ }
+ /** @internal */
+ _final(callback) {
+ if (this.state.streamEnd) {
+ return queueMicrotask(callback);
+ }
+ this.state.streamEnd = true;
+ writeRemnant(this, callback);
+ }
+ /**
+ * Places this write stream into an aborted state (all future writes fail)
+ * and deletes all chunks that have already been written.
+ */
+ async abort() {
+ if (this.state.streamEnd) {
+ // TODO(NODE-3485): Replace with MongoGridFSStreamClosed
+ throw new error_1.MongoAPIError('Cannot abort a stream that has already completed');
+ }
+ if (this.state.aborted) {
+ // TODO(NODE-3485): Replace with MongoGridFSStreamClosed
+ throw new error_1.MongoAPIError('Cannot call abort() on a stream twice');
+ }
+ this.state.aborted = true;
+ const remainingTimeMS = this.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${this.timeoutContext?.timeoutMS}ms`);
+ await this.chunks.deleteMany({ files_id: this.id }, { timeoutMS: remainingTimeMS });
+ }
+}
+exports.GridFSBucketWriteStream = GridFSBucketWriteStream;
+function handleError(stream, error, callback) {
+ if (stream.state.errored) {
+ queueMicrotask(callback);
+ return;
+ }
+ stream.state.errored = true;
+ queueMicrotask(() => callback(error));
+}
+function createChunkDoc(filesId, n, data) {
+ return {
+ _id: new bson_1.ObjectId(),
+ files_id: filesId,
+ n,
+ data
+ };
+}
+async function checkChunksIndex(stream) {
+ const index = { files_id: 1, n: 1 };
+ let remainingTimeMS;
+ remainingTimeMS = stream.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`);
+ let indexes;
+ try {
+ indexes = await stream.chunks
+ .listIndexes({
+ timeoutMode: remainingTimeMS != null ? abstract_cursor_1.CursorTimeoutMode.LIFETIME : undefined,
+ timeoutMS: remainingTimeMS
+ })
+ .toArray();
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoError && error.code === error_1.MONGODB_ERROR_CODES.NamespaceNotFound) {
+ indexes = [];
+ }
+ else {
+ throw error;
+ }
+ }
+ const hasChunksIndex = !!indexes.find(index => {
+ const keys = Object.keys(index.key);
+ if (keys.length === 2 && index.key.files_id === 1 && index.key.n === 1) {
+ return true;
+ }
+ return false;
+ });
+ if (!hasChunksIndex) {
+ remainingTimeMS = stream.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`);
+ await stream.chunks.createIndex(index, {
+ ...stream.writeConcern,
+ background: true,
+ unique: true,
+ timeoutMS: remainingTimeMS
+ });
+ }
+}
+function checkDone(stream, callback) {
+ if (stream.done) {
+ return queueMicrotask(callback);
+ }
+ if (stream.state.streamEnd && stream.state.outstandingRequests === 0 && !stream.state.errored) {
+ // Set done so we do not trigger duplicate createFilesDoc
+ stream.done = true;
+ // Create a new files doc
+ const gridFSFile = createFilesDoc(stream.id, stream.length, stream.chunkSizeBytes, stream.filename, stream.options.metadata);
+ if (isAborted(stream, callback)) {
+ return;
+ }
+ const remainingTimeMS = stream.timeoutContext?.remainingTimeMS;
+ if (remainingTimeMS != null && remainingTimeMS <= 0) {
+ return handleError(stream, new error_1.MongoOperationTimeoutError(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`), callback);
+ }
+ stream.files
+ .insertOne(gridFSFile, { writeConcern: stream.writeConcern, timeoutMS: remainingTimeMS })
+ .then(() => {
+ stream.gridFSFile = gridFSFile;
+ callback();
+ }, error => {
+ return handleError(stream, error, callback);
+ });
+ return;
+ }
+ queueMicrotask(callback);
+}
+async function checkIndexes(stream) {
+ let remainingTimeMS = stream.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`);
+ const doc = await stream.files.findOne({}, {
+ projection: { _id: 1 },
+ timeoutMS: remainingTimeMS
+ });
+ if (doc != null) {
+ // If at least one document exists assume the collection has the required index
+ return;
+ }
+ const index = { filename: 1, uploadDate: 1 };
+ let indexes;
+ remainingTimeMS = stream.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`);
+ const listIndexesOptions = {
+ timeoutMode: remainingTimeMS != null ? abstract_cursor_1.CursorTimeoutMode.LIFETIME : undefined,
+ timeoutMS: remainingTimeMS
+ };
+ try {
+ indexes = await stream.files.listIndexes(listIndexesOptions).toArray();
+ }
+ catch (error) {
+ if (error instanceof error_1.MongoError && error.code === error_1.MONGODB_ERROR_CODES.NamespaceNotFound) {
+ indexes = [];
+ }
+ else {
+ throw error;
+ }
+ }
+ const hasFileIndex = !!indexes.find(index => {
+ const keys = Object.keys(index.key);
+ if (keys.length === 2 && index.key.filename === 1 && index.key.uploadDate === 1) {
+ return true;
+ }
+ return false;
+ });
+ if (!hasFileIndex) {
+ remainingTimeMS = stream.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`);
+ await stream.files.createIndex(index, { background: false, timeoutMS: remainingTimeMS });
+ }
+ await checkChunksIndex(stream);
+}
+function createFilesDoc(_id, length, chunkSize, filename, metadata) {
+ const ret = {
+ _id,
+ length,
+ chunkSize,
+ uploadDate: new Date(),
+ filename
+ };
+ if (metadata) {
+ ret.metadata = metadata;
+ }
+ return ret;
+}
+function doWrite(stream, chunk, encoding, callback) {
+ if (isAborted(stream, callback)) {
+ return;
+ }
+ const inputBuf = typeof chunk === 'string' ? bson_1.ByteUtils.fromUTF8(chunk) : bson_1.ByteUtils.toLocalBufferType(chunk);
+ stream.length += inputBuf.length;
+ // Input is small enough to fit in our buffer
+ if (stream.pos + inputBuf.length < stream.chunkSizeBytes) {
+ bson_1.ByteUtils.copy(inputBuf, stream.bufToStore, stream.pos);
+ stream.pos += inputBuf.length;
+ queueMicrotask(callback);
+ return;
+ }
+ // Otherwise, buffer is too big for current chunk, so we need to flush
+ // to MongoDB.
+ let inputBufRemaining = inputBuf.length;
+ let spaceRemaining = stream.chunkSizeBytes - stream.pos;
+ let numToCopy = Math.min(spaceRemaining, inputBuf.length);
+ let outstandingRequests = 0;
+ while (inputBufRemaining > 0) {
+ const inputBufPos = inputBuf.length - inputBufRemaining;
+ bson_1.ByteUtils.copy(inputBuf, stream.bufToStore, stream.pos, inputBufPos, inputBufPos + numToCopy);
+ stream.pos += numToCopy;
+ spaceRemaining -= numToCopy;
+ let doc;
+ if (spaceRemaining === 0) {
+ doc = createChunkDoc(stream.id, stream.n, new Uint8Array(stream.bufToStore));
+ const remainingTimeMS = stream.timeoutContext?.remainingTimeMS;
+ if (remainingTimeMS != null && remainingTimeMS <= 0) {
+ return handleError(stream, new error_1.MongoOperationTimeoutError(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`), callback);
+ }
+ ++stream.state.outstandingRequests;
+ ++outstandingRequests;
+ if (isAborted(stream, callback)) {
+ return;
+ }
+ stream.chunks
+ .insertOne(doc, { writeConcern: stream.writeConcern, timeoutMS: remainingTimeMS })
+ .then(() => {
+ --stream.state.outstandingRequests;
+ --outstandingRequests;
+ if (!outstandingRequests) {
+ checkDone(stream, callback);
+ }
+ }, error => {
+ return handleError(stream, error, callback);
+ });
+ spaceRemaining = stream.chunkSizeBytes;
+ stream.pos = 0;
+ ++stream.n;
+ }
+ inputBufRemaining -= numToCopy;
+ numToCopy = Math.min(spaceRemaining, inputBufRemaining);
+ }
+}
+function writeRemnant(stream, callback) {
+ // Buffer is empty, so don't bother to insert
+ if (stream.pos === 0) {
+ return checkDone(stream, callback);
+ }
+ // Create a new buffer to make sure the buffer isn't bigger than it needs
+ // to be.
+ const remnant = bson_1.ByteUtils.allocate(stream.pos);
+ bson_1.ByteUtils.copy(stream.bufToStore, remnant, 0, 0, stream.pos);
+ const doc = createChunkDoc(stream.id, stream.n, remnant);
+ // If the stream was aborted, do not write remnant
+ if (isAborted(stream, callback)) {
+ return;
+ }
+ const remainingTimeMS = stream.timeoutContext?.remainingTimeMS;
+ if (remainingTimeMS != null && remainingTimeMS <= 0) {
+ return handleError(stream, new error_1.MongoOperationTimeoutError(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`), callback);
+ }
+ ++stream.state.outstandingRequests;
+ stream.chunks
+ .insertOne(doc, { writeConcern: stream.writeConcern, timeoutMS: remainingTimeMS })
+ .then(() => {
+ --stream.state.outstandingRequests;
+ checkDone(stream, callback);
+ }, error => {
+ return handleError(stream, error, callback);
+ });
+}
+function isAborted(stream, callback) {
+ if (stream.state.aborted) {
+ queueMicrotask(() => callback(new error_1.MongoAPIError('Stream has been aborted')));
+ return true;
+ }
+ return false;
+}
+//# sourceMappingURL=upload.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/gridfs/upload.js.map b/node_modules/mongodb/lib/gridfs/upload.js.map
new file mode 100644
index 00000000..7dac992f
--- /dev/null
+++ b/node_modules/mongodb/lib/gridfs/upload.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/gridfs/upload.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAElC,kCAA6D;AAE7D,+DAA8D;AAC9D,oCAKkB;AAClB,wCAAgD;AAChD,oCAA6E;AAE7E,sDAAkD;AA2BlD;;;;;GAKG;AACH,MAAa,uBAAwB,SAAQ,iBAAQ;IAuDnD;;;;;OAKG;IACH,YAAY,MAAoB,EAAE,QAAgB,EAAE,OAAwC;QAC1F,KAAK,EAAE,CAAC;QAzBV;;;;;;;;;;;;;WAaG;QACH,eAAU,GAAsB,IAAI,CAAC;QAanC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;QACvF,gCAAgC;QAChC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAElB,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAA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D,OAAO,KAAK,CAAC;AACf,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/index.js b/node_modules/mongodb/lib/index.js
new file mode 100644
index 00000000..3f4f7344
--- /dev/null
+++ b/node_modules/mongodb/lib/index.js
@@ -0,0 +1,193 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongoRuntimeError = exports.MongoParseError = exports.MongoOperationTimeoutError = exports.MongoOIDCError = exports.MongoNotConnectedError = exports.MongoNetworkTimeoutError = exports.MongoNetworkError = exports.MongoMissingDependencyError = exports.MongoMissingCredentialsError = exports.MongoKerberosError = exports.MongoInvalidArgumentError = exports.MongoGridFSStreamError = exports.MongoGridFSChunkError = exports.MongoGCPError = exports.MongoExpiredSessionError = exports.MongoError = exports.MongoDriverError = exports.MongoDecompressionError = exports.MongoCursorInUseError = exports.MongoCursorExhaustedError = exports.MongoCompatibilityError = exports.MongoClientClosedError = exports.MongoClientBulkWriteExecutionError = exports.MongoClientBulkWriteError = exports.MongoClientBulkWriteCursorError = exports.MongoChangeStreamError = exports.MongoBatchReExecutionError = exports.MongoAzureError = exports.MongoAWSError = exports.MongoAPIError = exports.ExplainableCursor = exports.ChangeStreamCursor = exports.ClientEncryption = exports.MongoBulkWriteError = exports.UUID = exports.Timestamp = exports.ObjectId = exports.MinKey = exports.MaxKey = exports.Long = exports.Int32 = exports.Double = exports.Decimal128 = exports.DBRef = exports.Code = exports.BSONType = exports.BSONSymbol = exports.BSONRegExp = exports.Binary = exports.BSON = void 0;
+exports.CommandStartedEvent = exports.CommandFailedEvent = exports.WriteConcern = exports.ReadPreference = exports.ReadConcern = exports.TopologyType = exports.ServerType = exports.ReadPreferenceMode = exports.ReadConcernLevel = exports.ProfilingLevel = exports.ReturnDocument = exports.SeverityLevel = exports.MongoLoggableComponent = exports.ServerApiVersion = exports.ExplainVerbosity = exports.MongoErrorLabel = exports.CursorTimeoutMode = exports.CURSOR_FLAGS = exports.Compressor = exports.AuthMechanism = exports.GSSAPICanonicalizationValue = exports.AutoEncryptionLoggerLevel = exports.BatchType = exports.UnorderedBulkOperation = exports.OrderedBulkOperation = exports.MongoClient = exports.ListIndexesCursor = exports.ListCollectionsCursor = exports.GridFSBucketWriteStream = exports.GridFSBucketReadStream = exports.GridFSBucket = exports.FindCursor = exports.Db = exports.Collection = exports.ClientSession = exports.ChangeStream = exports.CancellationToken = exports.AggregationCursor = exports.Admin = exports.AbstractCursor = exports.MongoWriteConcernError = exports.MongoUnexpectedServerResponseError = exports.MongoTransactionError = exports.MongoTopologyClosedError = exports.MongoTailableCursorError = exports.MongoSystemError = exports.MongoStalePrimaryError = exports.MongoServerSelectionError = exports.MongoServerError = exports.MongoServerClosedError = void 0;
+exports.MongoClientAuthProviders = exports.MongoCryptKMSRequestNetworkTimeoutError = exports.MongoCryptInvalidArgumentError = exports.MongoCryptError = exports.MongoCryptCreateEncryptedCollectionError = exports.MongoCryptCreateDataKeyError = exports.MongoCryptAzureKMSRequestError = exports.SrvPollingEvent = exports.WaitingForSuitableServerEvent = exports.ServerSelectionSucceededEvent = exports.ServerSelectionStartedEvent = exports.ServerSelectionFailedEvent = exports.ServerSelectionEvent = exports.TopologyOpeningEvent = exports.TopologyDescriptionChangedEvent = exports.TopologyClosedEvent = exports.ServerOpeningEvent = exports.ServerHeartbeatSucceededEvent = exports.ServerHeartbeatStartedEvent = exports.ServerHeartbeatFailedEvent = exports.ServerDescriptionChangedEvent = exports.ServerClosedEvent = exports.ConnectionReadyEvent = exports.ConnectionPoolReadyEvent = exports.ConnectionPoolMonitoringEvent = exports.ConnectionPoolCreatedEvent = exports.ConnectionPoolClosedEvent = exports.ConnectionPoolClearedEvent = exports.ConnectionCreatedEvent = exports.ConnectionClosedEvent = exports.ConnectionCheckOutStartedEvent = exports.ConnectionCheckOutFailedEvent = exports.ConnectionCheckedOutEvent = exports.ConnectionCheckedInEvent = exports.CommandSucceededEvent = void 0;
+const admin_1 = require("./admin");
+Object.defineProperty(exports, "Admin", { enumerable: true, get: function () { return admin_1.Admin; } });
+const ordered_1 = require("./bulk/ordered");
+Object.defineProperty(exports, "OrderedBulkOperation", { enumerable: true, get: function () { return ordered_1.OrderedBulkOperation; } });
+const unordered_1 = require("./bulk/unordered");
+Object.defineProperty(exports, "UnorderedBulkOperation", { enumerable: true, get: function () { return unordered_1.UnorderedBulkOperation; } });
+const change_stream_1 = require("./change_stream");
+Object.defineProperty(exports, "ChangeStream", { enumerable: true, get: function () { return change_stream_1.ChangeStream; } });
+const collection_1 = require("./collection");
+Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return collection_1.Collection; } });
+const abstract_cursor_1 = require("./cursor/abstract_cursor");
+Object.defineProperty(exports, "AbstractCursor", { enumerable: true, get: function () { return abstract_cursor_1.AbstractCursor; } });
+const aggregation_cursor_1 = require("./cursor/aggregation_cursor");
+Object.defineProperty(exports, "AggregationCursor", { enumerable: true, get: function () { return aggregation_cursor_1.AggregationCursor; } });
+const find_cursor_1 = require("./cursor/find_cursor");
+Object.defineProperty(exports, "FindCursor", { enumerable: true, get: function () { return find_cursor_1.FindCursor; } });
+const list_collections_cursor_1 = require("./cursor/list_collections_cursor");
+Object.defineProperty(exports, "ListCollectionsCursor", { enumerable: true, get: function () { return list_collections_cursor_1.ListCollectionsCursor; } });
+const list_indexes_cursor_1 = require("./cursor/list_indexes_cursor");
+Object.defineProperty(exports, "ListIndexesCursor", { enumerable: true, get: function () { return list_indexes_cursor_1.ListIndexesCursor; } });
+const db_1 = require("./db");
+Object.defineProperty(exports, "Db", { enumerable: true, get: function () { return db_1.Db; } });
+const gridfs_1 = require("./gridfs");
+Object.defineProperty(exports, "GridFSBucket", { enumerable: true, get: function () { return gridfs_1.GridFSBucket; } });
+const download_1 = require("./gridfs/download");
+Object.defineProperty(exports, "GridFSBucketReadStream", { enumerable: true, get: function () { return download_1.GridFSBucketReadStream; } });
+const upload_1 = require("./gridfs/upload");
+Object.defineProperty(exports, "GridFSBucketWriteStream", { enumerable: true, get: function () { return upload_1.GridFSBucketWriteStream; } });
+const mongo_client_1 = require("./mongo_client");
+Object.defineProperty(exports, "MongoClient", { enumerable: true, get: function () { return mongo_client_1.MongoClient; } });
+const mongo_types_1 = require("./mongo_types");
+Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return mongo_types_1.CancellationToken; } });
+const sessions_1 = require("./sessions");
+Object.defineProperty(exports, "ClientSession", { enumerable: true, get: function () { return sessions_1.ClientSession; } });
+/** @public */
+var bson_1 = require("./bson");
+Object.defineProperty(exports, "BSON", { enumerable: true, get: function () { return bson_1.BSON; } });
+var bson_2 = require("./bson");
+Object.defineProperty(exports, "Binary", { enumerable: true, get: function () { return bson_2.Binary; } });
+Object.defineProperty(exports, "BSONRegExp", { enumerable: true, get: function () { return bson_2.BSONRegExp; } });
+Object.defineProperty(exports, "BSONSymbol", { enumerable: true, get: function () { return bson_2.BSONSymbol; } });
+Object.defineProperty(exports, "BSONType", { enumerable: true, get: function () { return bson_2.BSONType; } });
+Object.defineProperty(exports, "Code", { enumerable: true, get: function () { return bson_2.Code; } });
+Object.defineProperty(exports, "DBRef", { enumerable: true, get: function () { return bson_2.DBRef; } });
+Object.defineProperty(exports, "Decimal128", { enumerable: true, get: function () { return bson_2.Decimal128; } });
+Object.defineProperty(exports, "Double", { enumerable: true, get: function () { return bson_2.Double; } });
+Object.defineProperty(exports, "Int32", { enumerable: true, get: function () { return bson_2.Int32; } });
+Object.defineProperty(exports, "Long", { enumerable: true, get: function () { return bson_2.Long; } });
+Object.defineProperty(exports, "MaxKey", { enumerable: true, get: function () { return bson_2.MaxKey; } });
+Object.defineProperty(exports, "MinKey", { enumerable: true, get: function () { return bson_2.MinKey; } });
+Object.defineProperty(exports, "ObjectId", { enumerable: true, get: function () { return bson_2.ObjectId; } });
+Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return bson_2.Timestamp; } });
+Object.defineProperty(exports, "UUID", { enumerable: true, get: function () { return bson_2.UUID; } });
+var common_1 = require("./bulk/common");
+Object.defineProperty(exports, "MongoBulkWriteError", { enumerable: true, get: function () { return common_1.MongoBulkWriteError; } });
+var client_encryption_1 = require("./client-side-encryption/client_encryption");
+Object.defineProperty(exports, "ClientEncryption", { enumerable: true, get: function () { return client_encryption_1.ClientEncryption; } });
+var change_stream_cursor_1 = require("./cursor/change_stream_cursor");
+Object.defineProperty(exports, "ChangeStreamCursor", { enumerable: true, get: function () { return change_stream_cursor_1.ChangeStreamCursor; } });
+var explainable_cursor_1 = require("./cursor/explainable_cursor");
+Object.defineProperty(exports, "ExplainableCursor", { enumerable: true, get: function () { return explainable_cursor_1.ExplainableCursor; } });
+var error_1 = require("./error");
+Object.defineProperty(exports, "MongoAPIError", { enumerable: true, get: function () { return error_1.MongoAPIError; } });
+Object.defineProperty(exports, "MongoAWSError", { enumerable: true, get: function () { return error_1.MongoAWSError; } });
+Object.defineProperty(exports, "MongoAzureError", { enumerable: true, get: function () { return error_1.MongoAzureError; } });
+Object.defineProperty(exports, "MongoBatchReExecutionError", { enumerable: true, get: function () { return error_1.MongoBatchReExecutionError; } });
+Object.defineProperty(exports, "MongoChangeStreamError", { enumerable: true, get: function () { return error_1.MongoChangeStreamError; } });
+Object.defineProperty(exports, "MongoClientBulkWriteCursorError", { enumerable: true, get: function () { return error_1.MongoClientBulkWriteCursorError; } });
+Object.defineProperty(exports, "MongoClientBulkWriteError", { enumerable: true, get: function () { return error_1.MongoClientBulkWriteError; } });
+Object.defineProperty(exports, "MongoClientBulkWriteExecutionError", { enumerable: true, get: function () { return error_1.MongoClientBulkWriteExecutionError; } });
+Object.defineProperty(exports, "MongoClientClosedError", { enumerable: true, get: function () { return error_1.MongoClientClosedError; } });
+Object.defineProperty(exports, "MongoCompatibilityError", { enumerable: true, get: function () { return error_1.MongoCompatibilityError; } });
+Object.defineProperty(exports, "MongoCursorExhaustedError", { enumerable: true, get: function () { return error_1.MongoCursorExhaustedError; } });
+Object.defineProperty(exports, "MongoCursorInUseError", { enumerable: true, get: function () { return error_1.MongoCursorInUseError; } });
+Object.defineProperty(exports, "MongoDecompressionError", { enumerable: true, get: function () { return error_1.MongoDecompressionError; } });
+Object.defineProperty(exports, "MongoDriverError", { enumerable: true, get: function () { return error_1.MongoDriverError; } });
+Object.defineProperty(exports, "MongoError", { enumerable: true, get: function () { return error_1.MongoError; } });
+Object.defineProperty(exports, "MongoExpiredSessionError", { enumerable: true, get: function () { return error_1.MongoExpiredSessionError; } });
+Object.defineProperty(exports, "MongoGCPError", { enumerable: true, get: function () { return error_1.MongoGCPError; } });
+Object.defineProperty(exports, "MongoGridFSChunkError", { enumerable: true, get: function () { return error_1.MongoGridFSChunkError; } });
+Object.defineProperty(exports, "MongoGridFSStreamError", { enumerable: true, get: function () { return error_1.MongoGridFSStreamError; } });
+Object.defineProperty(exports, "MongoInvalidArgumentError", { enumerable: true, get: function () { return error_1.MongoInvalidArgumentError; } });
+Object.defineProperty(exports, "MongoKerberosError", { enumerable: true, get: function () { return error_1.MongoKerberosError; } });
+Object.defineProperty(exports, "MongoMissingCredentialsError", { enumerable: true, get: function () { return error_1.MongoMissingCredentialsError; } });
+Object.defineProperty(exports, "MongoMissingDependencyError", { enumerable: true, get: function () { return error_1.MongoMissingDependencyError; } });
+Object.defineProperty(exports, "MongoNetworkError", { enumerable: true, get: function () { return error_1.MongoNetworkError; } });
+Object.defineProperty(exports, "MongoNetworkTimeoutError", { enumerable: true, get: function () { return error_1.MongoNetworkTimeoutError; } });
+Object.defineProperty(exports, "MongoNotConnectedError", { enumerable: true, get: function () { return error_1.MongoNotConnectedError; } });
+Object.defineProperty(exports, "MongoOIDCError", { enumerable: true, get: function () { return error_1.MongoOIDCError; } });
+Object.defineProperty(exports, "MongoOperationTimeoutError", { enumerable: true, get: function () { return error_1.MongoOperationTimeoutError; } });
+Object.defineProperty(exports, "MongoParseError", { enumerable: true, get: function () { return error_1.MongoParseError; } });
+Object.defineProperty(exports, "MongoRuntimeError", { enumerable: true, get: function () { return error_1.MongoRuntimeError; } });
+Object.defineProperty(exports, "MongoServerClosedError", { enumerable: true, get: function () { return error_1.MongoServerClosedError; } });
+Object.defineProperty(exports, "MongoServerError", { enumerable: true, get: function () { return error_1.MongoServerError; } });
+Object.defineProperty(exports, "MongoServerSelectionError", { enumerable: true, get: function () { return error_1.MongoServerSelectionError; } });
+Object.defineProperty(exports, "MongoStalePrimaryError", { enumerable: true, get: function () { return error_1.MongoStalePrimaryError; } });
+Object.defineProperty(exports, "MongoSystemError", { enumerable: true, get: function () { return error_1.MongoSystemError; } });
+Object.defineProperty(exports, "MongoTailableCursorError", { enumerable: true, get: function () { return error_1.MongoTailableCursorError; } });
+Object.defineProperty(exports, "MongoTopologyClosedError", { enumerable: true, get: function () { return error_1.MongoTopologyClosedError; } });
+Object.defineProperty(exports, "MongoTransactionError", { enumerable: true, get: function () { return error_1.MongoTransactionError; } });
+Object.defineProperty(exports, "MongoUnexpectedServerResponseError", { enumerable: true, get: function () { return error_1.MongoUnexpectedServerResponseError; } });
+Object.defineProperty(exports, "MongoWriteConcernError", { enumerable: true, get: function () { return error_1.MongoWriteConcernError; } });
+// enums
+var common_2 = require("./bulk/common");
+Object.defineProperty(exports, "BatchType", { enumerable: true, get: function () { return common_2.BatchType; } });
+var auto_encrypter_1 = require("./client-side-encryption/auto_encrypter");
+Object.defineProperty(exports, "AutoEncryptionLoggerLevel", { enumerable: true, get: function () { return auto_encrypter_1.AutoEncryptionLoggerLevel; } });
+var gssapi_1 = require("./cmap/auth/gssapi");
+Object.defineProperty(exports, "GSSAPICanonicalizationValue", { enumerable: true, get: function () { return gssapi_1.GSSAPICanonicalizationValue; } });
+var providers_1 = require("./cmap/auth/providers");
+Object.defineProperty(exports, "AuthMechanism", { enumerable: true, get: function () { return providers_1.AuthMechanism; } });
+var compression_1 = require("./cmap/wire_protocol/compression");
+Object.defineProperty(exports, "Compressor", { enumerable: true, get: function () { return compression_1.Compressor; } });
+var abstract_cursor_2 = require("./cursor/abstract_cursor");
+Object.defineProperty(exports, "CURSOR_FLAGS", { enumerable: true, get: function () { return abstract_cursor_2.CURSOR_FLAGS; } });
+Object.defineProperty(exports, "CursorTimeoutMode", { enumerable: true, get: function () { return abstract_cursor_2.CursorTimeoutMode; } });
+var error_2 = require("./error");
+Object.defineProperty(exports, "MongoErrorLabel", { enumerable: true, get: function () { return error_2.MongoErrorLabel; } });
+var explain_1 = require("./explain");
+Object.defineProperty(exports, "ExplainVerbosity", { enumerable: true, get: function () { return explain_1.ExplainVerbosity; } });
+var mongo_client_2 = require("./mongo_client");
+Object.defineProperty(exports, "ServerApiVersion", { enumerable: true, get: function () { return mongo_client_2.ServerApiVersion; } });
+var mongo_logger_1 = require("./mongo_logger");
+Object.defineProperty(exports, "MongoLoggableComponent", { enumerable: true, get: function () { return mongo_logger_1.MongoLoggableComponent; } });
+Object.defineProperty(exports, "SeverityLevel", { enumerable: true, get: function () { return mongo_logger_1.SeverityLevel; } });
+var find_and_modify_1 = require("./operations/find_and_modify");
+Object.defineProperty(exports, "ReturnDocument", { enumerable: true, get: function () { return find_and_modify_1.ReturnDocument; } });
+var set_profiling_level_1 = require("./operations/set_profiling_level");
+Object.defineProperty(exports, "ProfilingLevel", { enumerable: true, get: function () { return set_profiling_level_1.ProfilingLevel; } });
+var read_concern_1 = require("./read_concern");
+Object.defineProperty(exports, "ReadConcernLevel", { enumerable: true, get: function () { return read_concern_1.ReadConcernLevel; } });
+var read_preference_1 = require("./read_preference");
+Object.defineProperty(exports, "ReadPreferenceMode", { enumerable: true, get: function () { return read_preference_1.ReadPreferenceMode; } });
+var common_3 = require("./sdam/common");
+Object.defineProperty(exports, "ServerType", { enumerable: true, get: function () { return common_3.ServerType; } });
+Object.defineProperty(exports, "TopologyType", { enumerable: true, get: function () { return common_3.TopologyType; } });
+var read_concern_2 = require("./read_concern");
+Object.defineProperty(exports, "ReadConcern", { enumerable: true, get: function () { return read_concern_2.ReadConcern; } });
+var read_preference_2 = require("./read_preference");
+Object.defineProperty(exports, "ReadPreference", { enumerable: true, get: function () { return read_preference_2.ReadPreference; } });
+var write_concern_1 = require("./write_concern");
+Object.defineProperty(exports, "WriteConcern", { enumerable: true, get: function () { return write_concern_1.WriteConcern; } });
+// events
+var command_monitoring_events_1 = require("./cmap/command_monitoring_events");
+Object.defineProperty(exports, "CommandFailedEvent", { enumerable: true, get: function () { return command_monitoring_events_1.CommandFailedEvent; } });
+Object.defineProperty(exports, "CommandStartedEvent", { enumerable: true, get: function () { return command_monitoring_events_1.CommandStartedEvent; } });
+Object.defineProperty(exports, "CommandSucceededEvent", { enumerable: true, get: function () { return command_monitoring_events_1.CommandSucceededEvent; } });
+var connection_pool_events_1 = require("./cmap/connection_pool_events");
+Object.defineProperty(exports, "ConnectionCheckedInEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionCheckedInEvent; } });
+Object.defineProperty(exports, "ConnectionCheckedOutEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionCheckedOutEvent; } });
+Object.defineProperty(exports, "ConnectionCheckOutFailedEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionCheckOutFailedEvent; } });
+Object.defineProperty(exports, "ConnectionCheckOutStartedEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionCheckOutStartedEvent; } });
+Object.defineProperty(exports, "ConnectionClosedEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionClosedEvent; } });
+Object.defineProperty(exports, "ConnectionCreatedEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionCreatedEvent; } });
+Object.defineProperty(exports, "ConnectionPoolClearedEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionPoolClearedEvent; } });
+Object.defineProperty(exports, "ConnectionPoolClosedEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionPoolClosedEvent; } });
+Object.defineProperty(exports, "ConnectionPoolCreatedEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionPoolCreatedEvent; } });
+Object.defineProperty(exports, "ConnectionPoolMonitoringEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionPoolMonitoringEvent; } });
+Object.defineProperty(exports, "ConnectionPoolReadyEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionPoolReadyEvent; } });
+Object.defineProperty(exports, "ConnectionReadyEvent", { enumerable: true, get: function () { return connection_pool_events_1.ConnectionReadyEvent; } });
+var events_1 = require("./sdam/events");
+Object.defineProperty(exports, "ServerClosedEvent", { enumerable: true, get: function () { return events_1.ServerClosedEvent; } });
+Object.defineProperty(exports, "ServerDescriptionChangedEvent", { enumerable: true, get: function () { return events_1.ServerDescriptionChangedEvent; } });
+Object.defineProperty(exports, "ServerHeartbeatFailedEvent", { enumerable: true, get: function () { return events_1.ServerHeartbeatFailedEvent; } });
+Object.defineProperty(exports, "ServerHeartbeatStartedEvent", { enumerable: true, get: function () { return events_1.ServerHeartbeatStartedEvent; } });
+Object.defineProperty(exports, "ServerHeartbeatSucceededEvent", { enumerable: true, get: function () { return events_1.ServerHeartbeatSucceededEvent; } });
+Object.defineProperty(exports, "ServerOpeningEvent", { enumerable: true, get: function () { return events_1.ServerOpeningEvent; } });
+Object.defineProperty(exports, "TopologyClosedEvent", { enumerable: true, get: function () { return events_1.TopologyClosedEvent; } });
+Object.defineProperty(exports, "TopologyDescriptionChangedEvent", { enumerable: true, get: function () { return events_1.TopologyDescriptionChangedEvent; } });
+Object.defineProperty(exports, "TopologyOpeningEvent", { enumerable: true, get: function () { return events_1.TopologyOpeningEvent; } });
+var server_selection_events_1 = require("./sdam/server_selection_events");
+Object.defineProperty(exports, "ServerSelectionEvent", { enumerable: true, get: function () { return server_selection_events_1.ServerSelectionEvent; } });
+Object.defineProperty(exports, "ServerSelectionFailedEvent", { enumerable: true, get: function () { return server_selection_events_1.ServerSelectionFailedEvent; } });
+Object.defineProperty(exports, "ServerSelectionStartedEvent", { enumerable: true, get: function () { return server_selection_events_1.ServerSelectionStartedEvent; } });
+Object.defineProperty(exports, "ServerSelectionSucceededEvent", { enumerable: true, get: function () { return server_selection_events_1.ServerSelectionSucceededEvent; } });
+Object.defineProperty(exports, "WaitingForSuitableServerEvent", { enumerable: true, get: function () { return server_selection_events_1.WaitingForSuitableServerEvent; } });
+var srv_polling_1 = require("./sdam/srv_polling");
+Object.defineProperty(exports, "SrvPollingEvent", { enumerable: true, get: function () { return srv_polling_1.SrvPollingEvent; } });
+var errors_1 = require("./client-side-encryption/errors");
+Object.defineProperty(exports, "MongoCryptAzureKMSRequestError", { enumerable: true, get: function () { return errors_1.MongoCryptAzureKMSRequestError; } });
+Object.defineProperty(exports, "MongoCryptCreateDataKeyError", { enumerable: true, get: function () { return errors_1.MongoCryptCreateDataKeyError; } });
+Object.defineProperty(exports, "MongoCryptCreateEncryptedCollectionError", { enumerable: true, get: function () { return errors_1.MongoCryptCreateEncryptedCollectionError; } });
+Object.defineProperty(exports, "MongoCryptError", { enumerable: true, get: function () { return errors_1.MongoCryptError; } });
+Object.defineProperty(exports, "MongoCryptInvalidArgumentError", { enumerable: true, get: function () { return errors_1.MongoCryptInvalidArgumentError; } });
+Object.defineProperty(exports, "MongoCryptKMSRequestNetworkTimeoutError", { enumerable: true, get: function () { return errors_1.MongoCryptKMSRequestNetworkTimeoutError; } });
+var mongo_client_auth_providers_1 = require("./mongo_client_auth_providers");
+Object.defineProperty(exports, "MongoClientAuthProviders", { enumerable: true, get: function () { return mongo_client_auth_providers_1.MongoClientAuthProviders; } });
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/index.js.map b/node_modules/mongodb/lib/index.js.map
new file mode 100644
index 00000000..c7cf02c9
--- /dev/null
+++ b/node_modules/mongodb/lib/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,mCAAgC;AA4F9B,sFA5FO,aAAK,OA4FP;AA3FP,4CAAsD;AAyGpD,qGAzGO,8BAAoB,OAyGP;AAxGtB,gDAA0D;AA0GxD,uGA1GO,kCAAsB,OA0GP;AAzGxB,mDAA+C;AA4F7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AAA,iBAAiB,OAAA;AACjB,uHAAA,6BAA6B,OAAA;AAC7B,oHAAA,0BAA0B,OAAA;AAC1B,qHAAA,2BAA2B,OAAA;AAC3B,uHAAA,6BAA6B,OAAA;AAC7B,4GAAA,kBAAkB,OAAA;AAClB,6GAAA,mBAAmB,OAAA;AACnB,yHAAA,+BAA+B,OAAA;AAC/B,8GAAA,oBAAoB,OAAA;AAEtB,0EAMwC;AALtC,+HAAA,oBAAoB,OAAA;AACpB,qIAAA,0BAA0B,OAAA;AAC1B,sIAAA,2BAA2B,OAAA;AAC3B,wIAAA,6BAA6B,OAAA;AAC7B,wIAAA,6BAA6B,OAAA;AAE/B,kDAAqD;AAA5C,8GAAA,eAAe,OAAA;AAyExB,0DAOyC;AANvC,wHAAA,8BAA8B,OAAA;AAC9B,sHAAA,4BAA4B,OAAA;AAC5B,kIAAA,wCAAwC,OAAA;AACxC,yGAAA,eAAe,OAAA;AACf,wHAAA,8BAA8B,OAAA;AAC9B,iIAAA,uCAAuC,OAAA;AAkKzC,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/mongo_client.js b/node_modules/mongodb/lib/mongo_client.js
new file mode 100644
index 00000000..f2579158
--- /dev/null
+++ b/node_modules/mongodb/lib/mongo_client.js
@@ -0,0 +1,557 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongoClient = exports.ServerApiVersion = void 0;
+const fs_1 = require("fs");
+const _1 = require(".");
+const bson_1 = require("./bson");
+const change_stream_1 = require("./change_stream");
+const mongo_credentials_1 = require("./cmap/auth/mongo_credentials");
+const providers_1 = require("./cmap/auth/providers");
+const client_metadata_1 = require("./cmap/handshake/client_metadata");
+const connection_string_1 = require("./connection_string");
+const constants_1 = require("./constants");
+const db_1 = require("./db");
+const error_1 = require("./error");
+const mongo_client_auth_providers_1 = require("./mongo_client_auth_providers");
+const mongo_logger_1 = require("./mongo_logger");
+const mongo_types_1 = require("./mongo_types");
+const executor_1 = require("./operations/client_bulk_write/executor");
+const end_sessions_1 = require("./operations/end_sessions");
+const execute_operation_1 = require("./operations/execute_operation");
+const read_preference_1 = require("./read_preference");
+const server_selection_1 = require("./sdam/server_selection");
+const topology_1 = require("./sdam/topology");
+const sessions_1 = require("./sessions");
+const utils_1 = require("./utils");
+/** @public */
+exports.ServerApiVersion = Object.freeze({
+ v1: '1'
+});
+/**
+ * @public
+ *
+ * The **MongoClient** class is a class that allows for making Connections to MongoDB.
+ *
+ * **NOTE:** The programmatically provided options take precedence over the URI options.
+ *
+ * @remarks
+ *
+ * A MongoClient is the entry point to connecting to a MongoDB server.
+ *
+ * It handles a multitude of features on your application's behalf:
+ * - **Server Host Connection Configuration**: A MongoClient is responsible for reading TLS cert, ca, and crl files if provided.
+ * - **SRV Record Polling**: A "`mongodb+srv`" style connection string is used to have the MongoClient resolve DNS SRV records of all server hostnames which the driver periodically monitors for changes and adjusts its current view of hosts correspondingly.
+ * - **Server Monitoring**: The MongoClient automatically keeps monitoring the health of server nodes in your cluster to reach out to the correct and lowest latency one available.
+ * - **Connection Pooling**: To avoid paying the cost of rebuilding a connection to the server on every operation the MongoClient keeps idle connections preserved for reuse.
+ * - **Session Pooling**: The MongoClient creates logical sessions that enable retryable writes, causal consistency, and transactions. It handles pooling these sessions for reuse in subsequent operations.
+ * - **Cursor Operations**: A MongoClient's cursors use the health monitoring system to send the request for more documents to the same server the query began on.
+ * - **Mongocryptd process**: When using auto encryption, a MongoClient will launch a `mongocryptd` instance for handling encryption if the mongocrypt shared library isn't in use.
+ *
+ * There are many more features of a MongoClient that are not listed above.
+ *
+ * In order to enable these features, a number of asynchronous Node.js resources are established by the driver: Timers, FS Requests, Sockets, etc.
+ * For details on cleanup, please refer to the MongoClient `close()` documentation.
+ *
+ * @example
+ * ```ts
+ * import { MongoClient } from 'mongodb';
+ * // Enable command monitoring for debugging
+ * const client = new MongoClient('mongodb://localhost:27017?appName=mflix', { monitorCommands: true });
+ * ```
+ */
+class MongoClient extends mongo_types_1.TypedEventEmitter {
+ constructor(url, options) {
+ super();
+ this.driverInfoList = [];
+ this.on('error', utils_1.noop);
+ this.options = (0, connection_string_1.parseOptions)(url, this, options);
+ this.appendMetadata(this.options.driverInfo);
+ const shouldSetLogger = Object.values(this.options.mongoLoggerOptions.componentSeverities).some(value => value !== mongo_logger_1.SeverityLevel.OFF);
+ this.mongoLogger = shouldSetLogger
+ ? new mongo_logger_1.MongoLogger(this.options.mongoLoggerOptions)
+ : undefined;
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
+ const client = this;
+ // The internal state
+ this.s = {
+ url,
+ bsonOptions: (0, bson_1.resolveBSONOptions)(this.options),
+ namespace: (0, utils_1.ns)('admin'),
+ hasBeenClosed: false,
+ sessionPool: new sessions_1.ServerSessionPool(this),
+ activeSessions: new Set(),
+ activeCursors: new Set(),
+ authProviders: new mongo_client_auth_providers_1.MongoClientAuthProviders(),
+ get options() {
+ return client.options;
+ },
+ get readConcern() {
+ return client.options.readConcern;
+ },
+ get writeConcern() {
+ return client.options.writeConcern;
+ },
+ get readPreference() {
+ return client.options.readPreference;
+ },
+ get isMongoClient() {
+ return true;
+ }
+ };
+ this.checkForNonGenuineHosts();
+ }
+ /**
+ * @experimental
+ * An alias for {@link MongoClient.close|MongoClient.close()}.
+ */
+ async [Symbol.asyncDispose]() {
+ await this.close();
+ }
+ /**
+ * Append metadata to the client metadata after instantiation.
+ * @param driverInfo - Information about the application or library.
+ */
+ appendMetadata(driverInfo) {
+ const isDuplicateDriverInfo = this.driverInfoList.some(info => (0, client_metadata_1.isDriverInfoEqual)(info, driverInfo));
+ if (isDuplicateDriverInfo)
+ return;
+ this.driverInfoList.push(driverInfo);
+ this.options.metadata = (0, client_metadata_1.makeClientMetadata)(this.driverInfoList, this.options)
+ .then(undefined, utils_1.squashError)
+ .then(result => result ?? {}); // ensure Promise
+ }
+ /** @internal */
+ checkForNonGenuineHosts() {
+ const documentDBHostnames = this.options.hosts.filter((hostAddress) => (0, utils_1.isHostMatch)(utils_1.DOCUMENT_DB_CHECK, hostAddress.host));
+ const srvHostIsDocumentDB = (0, utils_1.isHostMatch)(utils_1.DOCUMENT_DB_CHECK, this.options.srvHost);
+ const cosmosDBHostnames = this.options.hosts.filter((hostAddress) => (0, utils_1.isHostMatch)(utils_1.COSMOS_DB_CHECK, hostAddress.host));
+ const srvHostIsCosmosDB = (0, utils_1.isHostMatch)(utils_1.COSMOS_DB_CHECK, this.options.srvHost);
+ if (documentDBHostnames.length !== 0 || srvHostIsDocumentDB) {
+ this.mongoLogger?.info('client', utils_1.DOCUMENT_DB_MSG);
+ }
+ else if (cosmosDBHostnames.length !== 0 || srvHostIsCosmosDB) {
+ this.mongoLogger?.info('client', utils_1.COSMOS_DB_MSG);
+ }
+ }
+ get serverApi() {
+ return this.options.serverApi && Object.freeze({ ...this.options.serverApi });
+ }
+ /**
+ * Intended for APM use only
+ * @internal
+ */
+ get monitorCommands() {
+ return this.options.monitorCommands;
+ }
+ set monitorCommands(value) {
+ this.options.monitorCommands = value;
+ }
+ /** @internal */
+ get autoEncrypter() {
+ return this.options.autoEncrypter;
+ }
+ get readConcern() {
+ return this.s.readConcern;
+ }
+ get writeConcern() {
+ return this.s.writeConcern;
+ }
+ get readPreference() {
+ return this.s.readPreference;
+ }
+ get bsonOptions() {
+ return this.s.bsonOptions;
+ }
+ get timeoutMS() {
+ return this.s.options.timeoutMS;
+ }
+ /**
+ * Executes a client bulk write operation, available on server 8.0+.
+ * @param models - The client bulk write models.
+ * @param options - The client bulk write options.
+ * @returns A ClientBulkWriteResult for acknowledged writes and ok: 1 for unacknowledged writes.
+ */
+ async bulkWrite(models, options) {
+ if (this.autoEncrypter) {
+ throw new error_1.MongoInvalidArgumentError('MongoClient bulkWrite does not currently support automatic encryption.');
+ }
+ // We do not need schema type information past this point ("as any" is fine)
+ return await new executor_1.ClientBulkWriteExecutor(this, models, (0, utils_1.resolveOptions)(this, options)).execute();
+ }
+ /**
+ * An optional method to verify a handful of assumptions that are generally useful at application boot-time before using a MongoClient.
+ * For detailed information about the connect process see the MongoClient.connect static method documentation.
+ *
+ * @param url - The MongoDB connection string (supports `mongodb://` and `mongodb+srv://` schemes)
+ * @param options - Optional configuration options for the client
+ *
+ * @see https://www.mongodb.com/docs/manual/reference/connection-string/
+ */
+ async connect() {
+ if (this.connectionLock) {
+ return await this.connectionLock;
+ }
+ try {
+ this.connectionLock = this._connect();
+ await this.connectionLock;
+ }
+ finally {
+ // release
+ this.connectionLock = undefined;
+ }
+ return this;
+ }
+ /**
+ * Create a topology to open the connection, must be locked to avoid topology leaks in concurrency scenario.
+ * Locking is enforced by the connect method.
+ *
+ * @internal
+ */
+ async _connect() {
+ if (this.topology && this.topology.isConnected()) {
+ return this;
+ }
+ const options = this.options;
+ if (options.tls) {
+ if (typeof options.tlsCAFile === 'string') {
+ options.ca ??= await fs_1.promises.readFile(options.tlsCAFile);
+ }
+ if (typeof options.tlsCRLFile === 'string') {
+ options.crl ??= await fs_1.promises.readFile(options.tlsCRLFile);
+ }
+ if (typeof options.tlsCertificateKeyFile === 'string') {
+ if (!options.key || !options.cert) {
+ const contents = await fs_1.promises.readFile(options.tlsCertificateKeyFile);
+ options.key ??= contents;
+ options.cert ??= contents;
+ }
+ }
+ }
+ if (typeof options.srvHost === 'string') {
+ const hosts = await (0, connection_string_1.resolveSRVRecord)(options);
+ for (const [index, host] of hosts.entries()) {
+ options.hosts[index] = host;
+ }
+ }
+ // It is important to perform validation of hosts AFTER SRV resolution, to check the real hostname,
+ // but BEFORE we even attempt connecting with a potentially not allowed hostname
+ if (options.credentials?.mechanism === providers_1.AuthMechanism.MONGODB_OIDC) {
+ const allowedHosts = options.credentials?.mechanismProperties?.ALLOWED_HOSTS || mongo_credentials_1.DEFAULT_ALLOWED_HOSTS;
+ const isServiceAuth = !!options.credentials?.mechanismProperties?.ENVIRONMENT;
+ if (!isServiceAuth) {
+ for (const host of options.hosts) {
+ if (!(0, utils_1.hostMatchesWildcards)(host.toHostPort().host, allowedHosts)) {
+ throw new error_1.MongoInvalidArgumentError(`Host '${host}' is not valid for OIDC authentication with ALLOWED_HOSTS of '${allowedHosts.join(',')}'`);
+ }
+ }
+ }
+ }
+ this.topology = new topology_1.Topology(this, options.hosts, options);
+ // Events can be emitted before initialization is complete so we have to
+ // save the reference to the topology on the client ASAP if the event handlers need to access it
+ this.topology.once(topology_1.Topology.OPEN, () => this.emit('open', this));
+ for (const event of constants_1.MONGO_CLIENT_EVENTS) {
+ this.topology.on(event, (...args) => this.emit(event, ...args));
+ }
+ const topologyConnect = async () => {
+ try {
+ await this.topology?.connect(options);
+ }
+ catch (error) {
+ this.topology?.close();
+ throw error;
+ }
+ };
+ if (this.autoEncrypter) {
+ await this.autoEncrypter?.init();
+ await topologyConnect();
+ await options.encrypter.connectInternalClient();
+ }
+ else {
+ await topologyConnect();
+ }
+ return this;
+ }
+ /**
+ * Cleans up resources managed by the MongoClient.
+ *
+ * The close method clears and closes all resources whose lifetimes are managed by the MongoClient.
+ * Please refer to the `MongoClient` class documentation for a high level overview of the client's key features and responsibilities.
+ *
+ * **However,** the close method does not handle the cleanup of resources explicitly created by the user.
+ * Any user-created driver resource with its own `close()` method should be explicitly closed by the user before calling MongoClient.close().
+ * This method is written as a "best effort" attempt to leave behind the least amount of resources server-side when possible.
+ *
+ * The following list defines ideal preconditions and consequent pitfalls if they are not met.
+ * The MongoClient, ClientSession, Cursors and ChangeStreams all support [explicit resource management](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html).
+ * By using explicit resource management to manage the lifetime of driver resources instead of manually managing their lifetimes, the pitfalls outlined below can be avoided.
+ *
+ * The close method performs the following in the order listed:
+ * - Client-side:
+ * - **Close in-use connections**: Any connections that are currently waiting on a response from the server will be closed.
+ * This is performed _first_ to avoid reaching the next step (server-side clean up) and having no available connections to check out.
+ * - _Ideal_: All operations have been awaited or cancelled, and the outcomes, regardless of success or failure, have been processed before closing the client servicing the operation.
+ * - _Pitfall_: When `client.close()` is called and all connections are in use, after closing them, the client must create new connections for cleanup operations, which comes at the cost of new TLS/TCP handshakes and authentication steps.
+ * - Server-side:
+ * - **Close active cursors**: All cursors that haven't been completed will have a `killCursor` operation sent to the server they were initialized on, freeing the server-side resource.
+ * - _Ideal_: Cursors are explicitly closed or completed before `client.close()` is called.
+ * - _Pitfall_: `killCursors` may have to build a new connection if the in-use closure ended all pooled connections.
+ * - **End active sessions**: In-use sessions created with `client.startSession()` or `client.withSession()` or implicitly by the driver will have their `.endSession()` method called.
+ * Contrary to the name of the method, `endSession()` returns the session to the client's pool of sessions rather than end them on the server.
+ * - _Ideal_: Transaction outcomes are awaited and their corresponding explicit sessions are ended before `client.close()` is called.
+ * - _Pitfall_: **This step aborts in-progress transactions**. It is advisable to observe the outcome of a transaction before closing your client.
+ * - **End all pooled sessions**: The `endSessions` command with all session IDs the client has pooled is sent to the server to inform the cluster it can clean them up.
+ * - _Ideal_: No user intervention is expected.
+ * - _Pitfall_: None.
+ *
+ * The remaining shutdown is of the MongoClient resources that are intended to be entirely internal but is documented here as their existence relates to the JS event loop.
+ *
+ * - Client-side (again):
+ * - **Stop all server monitoring**: Connections kept live for detecting cluster changes and roundtrip time measurements are shutdown.
+ * - **Close all pooled connections**: Each server node in the cluster has a corresponding connection pool and all connections in the pool are closed. Any operations waiting to check out a connection will have an error thrown instead of a connection returned.
+ * - **Clear out server selection queue**: Any operations that are in the process of waiting for a server to be selected will have an error thrown instead of a server returned.
+ * - **Close encryption-related resources**: An internal MongoClient created for communicating with `mongocryptd` or other encryption purposes is closed. (Using this same method of course!)
+ *
+ * After the close method completes there should be no MongoClient related resources [ref-ed in Node.js' event loop](https://docs.libuv.org/en/v1.x/handle.html#reference-counting).
+ * This should allow Node.js to exit gracefully if MongoClient resources were the only active handles in the event loop.
+ *
+ * @param _force - currently an unused flag that has no effect. Defaults to `false`.
+ */
+ async close(_force = false) {
+ if (this.closeLock) {
+ return await this.closeLock;
+ }
+ try {
+ this.closeLock = this._close();
+ await this.closeLock;
+ }
+ finally {
+ // release
+ this.closeLock = undefined;
+ }
+ }
+ /* @internal */
+ async _close() {
+ // There's no way to set hasBeenClosed back to false
+ Object.defineProperty(this.s, 'hasBeenClosed', {
+ value: true,
+ enumerable: true,
+ configurable: false,
+ writable: false
+ });
+ this.topology?.closeCheckedOutConnections();
+ const activeCursorCloses = Array.from(this.s.activeCursors, cursor => cursor.close());
+ this.s.activeCursors.clear();
+ await Promise.all(activeCursorCloses);
+ const activeSessionEnds = Array.from(this.s.activeSessions, session => session.endSession());
+ this.s.activeSessions.clear();
+ await Promise.all(activeSessionEnds);
+ if (this.topology == null) {
+ return;
+ }
+ const supportsSessions = this.topology.description.type === _1.TopologyType.LoadBalanced ||
+ this.topology.description.logicalSessionTimeoutMinutes != null;
+ if (supportsSessions) {
+ await endSessions(this, this.topology);
+ }
+ // clear out references to old topology
+ const topology = this.topology;
+ this.topology = undefined;
+ topology.close();
+ const { encrypter } = this.options;
+ if (encrypter) {
+ await encrypter.close(this);
+ }
+ async function endSessions(client, { description: topologyDescription }) {
+ // If we would attempt to select a server and get nothing back we short circuit
+ // to avoid the server selection timeout.
+ const selector = (0, server_selection_1.readPreferenceServerSelector)(read_preference_1.ReadPreference.primaryPreferred);
+ const serverDescriptions = Array.from(topologyDescription.servers.values());
+ const servers = selector(topologyDescription, serverDescriptions, new server_selection_1.DeprioritizedServers());
+ if (servers.length !== 0) {
+ const endSessions = Array.from(client.s.sessionPool.sessions, ({ id }) => id);
+ if (endSessions.length !== 0) {
+ try {
+ await (0, execute_operation_1.executeOperation)(client, new end_sessions_1.EndSessionsOperation(endSessions));
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ }
+ }
+ }
+ }
+ /**
+ * Create a new Db instance sharing the current socket connections.
+ *
+ * @param dbName - The name of the database we want to use. If not provided, use database name from connection string.
+ * @param options - Optional settings for Db construction
+ */
+ db(dbName, options) {
+ options = options ?? {};
+ // Default to db from connection string if not provided
+ if (!dbName) {
+ dbName = this.s.options.dbName;
+ }
+ // Copy the options and add out internal override of the not shared flag
+ const finalOptions = Object.assign({}, this.options, options);
+ // Return the db object
+ const db = new db_1.Db(this, dbName, finalOptions);
+ // Return the database
+ return db;
+ }
+ /**
+ * Creates a new MongoClient instance and immediately connects it to MongoDB.
+ * This convenience method combines `new MongoClient(url, options)` and `client.connect()` in a single step.
+ *
+ * Connect can be helpful to detect configuration issues early by validating:
+ * - **DNS Resolution**: Verifies that SRV records and hostnames in the connection string resolve DNS entries
+ * - **Network Connectivity**: Confirms that host addresses are reachable and ports are open
+ * - **TLS Configuration**: Validates SSL/TLS certificates, CA files, and encryption settings are correct
+ * - **Authentication**: Verifies that provided credentials are valid
+ * - **Server Compatibility**: Ensures the MongoDB server version is supported by this driver version
+ * - **Load Balancer Setup**: For load-balanced deployments, confirms the service is properly configured
+ *
+ * @returns A promise that resolves to the same MongoClient instance once connected
+ *
+ * @remarks
+ * **Connection is Optional:** Calling `connect` is optional since any operation method (`find`, `insertOne`, etc.)
+ * will automatically perform these same validation steps if the client is not already connected.
+ * However, explicitly calling `connect` can make sense for:
+ * - **Fail-fast Error Detection**: Non-transient connection issues (hostname unresolved, port refused connection) are discovered immediately rather than during your first operation
+ * - **Predictable Performance**: Eliminates first connection overhead from your first database operation
+ *
+ * @remarks
+ * **Connection Pooling Impact:** Calling `connect` will populate the connection pool with one connection
+ * to a server selected by the client's configured `readPreference` (defaults to primary).
+ *
+ * @remarks
+ * **Timeout Behavior:** When using `timeoutMS`, the connection establishment time does not count against
+ * the timeout for subsequent operations. This means `connect` runs without a `timeoutMS` limit, while
+ * your database operations will still respect the configured timeout. If you need predictable operation
+ * timing with `timeoutMS`, call `connect` explicitly before performing operations.
+ *
+ * @see https://www.mongodb.com/docs/manual/reference/connection-string/
+ */
+ static async connect(url, options) {
+ const client = new this(url, options);
+ return await client.connect();
+ }
+ /**
+ * Creates a new ClientSession. When using the returned session in an operation
+ * a corresponding ServerSession will be created.
+ *
+ * @remarks
+ * A ClientSession instance may only be passed to operations being performed on the same
+ * MongoClient it was started from.
+ */
+ startSession(options) {
+ const session = new sessions_1.ClientSession(this, this.s.sessionPool, { explicit: true, ...options }, this.options);
+ this.s.activeSessions.add(session);
+ session.once('ended', () => {
+ this.s.activeSessions.delete(session);
+ });
+ return session;
+ }
+ async withSession(optionsOrExecutor, executor) {
+ const options = {
+ // Always define an owner
+ owner: Symbol(),
+ // If it's an object inherit the options
+ ...(typeof optionsOrExecutor === 'object' ? optionsOrExecutor : {})
+ };
+ const withSessionCallback = typeof optionsOrExecutor === 'function' ? optionsOrExecutor : executor;
+ if (withSessionCallback == null) {
+ throw new error_1.MongoInvalidArgumentError('Missing required callback parameter');
+ }
+ const session = this.startSession(options);
+ try {
+ return await withSessionCallback(session);
+ }
+ finally {
+ try {
+ await session.endSession();
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ }
+ }
+ /**
+ * Create a new Change Stream, watching for new changes (insertions, updates,
+ * replacements, deletions, and invalidations) in this cluster. Will ignore all
+ * changes to system collections, as well as the local, admin, and config databases.
+ *
+ * @remarks
+ * watch() accepts two generic arguments for distinct use cases:
+ * - The first is to provide the schema that may be defined for all the data within the current cluster
+ * - The second is to override the shape of the change stream document entirely, if it is not provided the type will default to ChangeStreamDocument of the first argument
+ *
+ * @remarks
+ * When `timeoutMS` is configured for a change stream, it will have different behaviour depending
+ * on whether the change stream is in iterator mode or emitter mode. In both cases, a change
+ * stream will time out if it does not receive a change event within `timeoutMS` of the last change
+ * event.
+ *
+ * Note that if a change stream is consistently timing out when watching a collection, database or
+ * client that is being changed, then this may be due to the server timing out before it can finish
+ * processing the existing oplog. To address this, restart the change stream with a higher
+ * `timeoutMS`.
+ *
+ * If the change stream times out the initial aggregate operation to establish the change stream on
+ * the server, then the client will close the change stream. If the getMore calls to the server
+ * time out, then the change stream will be left open, but will throw a MongoOperationTimeoutError
+ * when in iterator mode and emit an error event that returns a MongoOperationTimeoutError in
+ * emitter mode.
+ *
+ * To determine whether or not the change stream is still open following a timeout, check the
+ * {@link ChangeStream.closed} getter.
+ *
+ * @example
+ * In iterator mode, if a next() call throws a timeout error, it will attempt to resume the change stream.
+ * The next call can just be retried after this succeeds.
+ * ```ts
+ * const changeStream = collection.watch([], { timeoutMS: 100 });
+ * try {
+ * await changeStream.next();
+ * } catch (e) {
+ * if (e instanceof MongoOperationTimeoutError && !changeStream.closed) {
+ * await changeStream.next();
+ * }
+ * throw e;
+ * }
+ * ```
+ *
+ * @example
+ * In emitter mode, if the change stream goes `timeoutMS` without emitting a change event, it will
+ * emit an error event that returns a MongoOperationTimeoutError, but will not close the change
+ * stream unless the resume attempt fails. There is no need to re-establish change listeners as
+ * this will automatically continue emitting change events once the resume attempt completes.
+ *
+ * ```ts
+ * const changeStream = collection.watch([], { timeoutMS: 100 });
+ * changeStream.on('change', console.log);
+ * changeStream.on('error', e => {
+ * if (e instanceof MongoOperationTimeoutError && !changeStream.closed) {
+ * // do nothing
+ * } else {
+ * changeStream.close();
+ * }
+ * });
+ * ```
+ * @param pipeline - An array of {@link https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/|aggregation pipeline stages} through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.
+ * @param options - Optional settings for the command
+ * @typeParam TSchema - Type of the data being detected by the change stream
+ * @typeParam TChange - Type of the whole change stream document emitted
+ */
+ watch(pipeline = [], options = {}) {
+ // Allow optionally not specifying a pipeline
+ if (!Array.isArray(pipeline)) {
+ options = pipeline;
+ pipeline = [];
+ }
+ return new change_stream_1.ChangeStream(this, pipeline, (0, utils_1.resolveOptions)(this, options));
+ }
+}
+exports.MongoClient = MongoClient;
+//# sourceMappingURL=mongo_client.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/mongo_client.js.map b/node_modules/mongodb/lib/mongo_client.js.map
new file mode 100644
index 00000000..20dbeeed
--- /dev/null
+++ b/node_modules/mongodb/lib/mongo_client.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"mongo_client.js","sourceRoot":"","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pE,CAAC;QAEF,MAAM,mBAAmB,GACvB,OAAO,iBAAiB,KAAK,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC;QAEzE,IAAI,mBAAmB,IAAI,IAAI,EAAE,CAAC;YAChC,MAAM,IAAI,iCAAyB,CAAC,qCAAqC,CAAC,CAAC;QAC7E,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAE3C,IAAI,CAAC;YACH,OAAO,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;YAC7B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAA,mBAAW,EAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkEG;IACH,KAAK,CAGH,WAAuB,EAAE,EAAE,UAA+B,EAAE;QAC5D,6CAA6C;QAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,OAAO,GAAG,QAAQ,CAAC;YACnB,QAAQ,GAAG,EAAE,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,4BAAY,CAAmB,IAAI,EAAE,QAAQ,EAAE,IAAA,sBAAc,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3F,CAAC;CACF;AA5mBD,kCA4mBC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/mongo_client_auth_providers.js b/node_modules/mongodb/lib/mongo_client_auth_providers.js
new file mode 100644
index 00000000..55b3cb6b
--- /dev/null
+++ b/node_modules/mongodb/lib/mongo_client_auth_providers.js
@@ -0,0 +1,80 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongoClientAuthProviders = void 0;
+const gssapi_1 = require("./cmap/auth/gssapi");
+const mongodb_aws_1 = require("./cmap/auth/mongodb_aws");
+const mongodb_oidc_1 = require("./cmap/auth/mongodb_oidc");
+const automated_callback_workflow_1 = require("./cmap/auth/mongodb_oidc/automated_callback_workflow");
+const human_callback_workflow_1 = require("./cmap/auth/mongodb_oidc/human_callback_workflow");
+const token_cache_1 = require("./cmap/auth/mongodb_oidc/token_cache");
+const plain_1 = require("./cmap/auth/plain");
+const providers_1 = require("./cmap/auth/providers");
+const scram_1 = require("./cmap/auth/scram");
+const x509_1 = require("./cmap/auth/x509");
+const error_1 = require("./error");
+/** @internal */
+const AUTH_PROVIDERS = new Map([
+ [
+ providers_1.AuthMechanism.MONGODB_AWS,
+ ({ AWS_CREDENTIAL_PROVIDER }) => new mongodb_aws_1.MongoDBAWS(AWS_CREDENTIAL_PROVIDER)
+ ],
+ [providers_1.AuthMechanism.MONGODB_GSSAPI, () => new gssapi_1.GSSAPI()],
+ [providers_1.AuthMechanism.MONGODB_OIDC, properties => new mongodb_oidc_1.MongoDBOIDC(getWorkflow(properties))],
+ [providers_1.AuthMechanism.MONGODB_PLAIN, () => new plain_1.Plain()],
+ [providers_1.AuthMechanism.MONGODB_SCRAM_SHA1, () => new scram_1.ScramSHA1()],
+ [providers_1.AuthMechanism.MONGODB_SCRAM_SHA256, () => new scram_1.ScramSHA256()],
+ [providers_1.AuthMechanism.MONGODB_X509, () => new x509_1.X509()]
+]);
+/**
+ * Create a set of providers per client
+ * to avoid sharing the provider's cache between different clients.
+ * @internal
+ */
+class MongoClientAuthProviders {
+ constructor() {
+ this.existingProviders = new Map();
+ }
+ /**
+ * Get or create an authentication provider based on the provided mechanism.
+ * We don't want to create all providers at once, as some providers may not be used.
+ * @param name - The name of the provider to get or create.
+ * @param credentials - The credentials.
+ * @returns The provider.
+ * @throws MongoInvalidArgumentError if the mechanism is not supported.
+ * @internal
+ */
+ getOrCreateProvider(name, authMechanismProperties) {
+ const authProvider = this.existingProviders.get(name);
+ if (authProvider) {
+ return authProvider;
+ }
+ const providerFunction = AUTH_PROVIDERS.get(name);
+ if (!providerFunction) {
+ throw new error_1.MongoInvalidArgumentError(`authMechanism ${name} not supported`);
+ }
+ const provider = providerFunction(authMechanismProperties);
+ this.existingProviders.set(name, provider);
+ return provider;
+ }
+}
+exports.MongoClientAuthProviders = MongoClientAuthProviders;
+/**
+ * Gets either a device workflow or callback workflow.
+ */
+function getWorkflow(authMechanismProperties) {
+ if (authMechanismProperties.OIDC_HUMAN_CALLBACK) {
+ return new human_callback_workflow_1.HumanCallbackWorkflow(new token_cache_1.TokenCache(), authMechanismProperties.OIDC_HUMAN_CALLBACK);
+ }
+ else if (authMechanismProperties.OIDC_CALLBACK) {
+ return new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), authMechanismProperties.OIDC_CALLBACK);
+ }
+ else {
+ const environment = authMechanismProperties.ENVIRONMENT;
+ const workflow = mongodb_oidc_1.OIDC_WORKFLOWS.get(environment)?.();
+ if (!workflow) {
+ throw new error_1.MongoInvalidArgumentError(`Could not load workflow for environment ${authMechanismProperties.ENVIRONMENT}`);
+ }
+ return workflow;
+ }
+}
+//# sourceMappingURL=mongo_client_auth_providers.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/mongo_client_auth_providers.js.map b/node_modules/mongodb/lib/mongo_client_auth_providers.js.map
new file mode 100644
index 00000000..2b43927f
--- /dev/null
+++ b/node_modules/mongodb/lib/mongo_client_auth_providers.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"mongo_client_auth_providers.js","sourceRoot":"","sources":["../src/mongo_client_auth_providers.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C,yDAAqD;AACrD,2DAAsF;AACtF,sGAAiG;AACjG,8FAAyF;AACzF,sEAAkE;AAClE,6CAA0C;AAC1C,qDAAsD;AACtD,6CAA2D;AAC3D,2CAAwC;AACxC,mCAAoD;AAEpD,gBAAgB;AAChB,MAAM,cAAc,GAAG,IAAI,GAAG,CAG5B;IACA;QACE,yBAAa,CAAC,WAAW;QACzB,CAAC,EAAE,uBAAuB,EAAE,EAAE,EAAE,CAAC,IAAI,wBAAU,CAAC,uBAAuB,CAAC;KACzE;IACD,CAAC,yBAAa,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI,eAAM,EAAE,CAAC;IAClD,CAAC,yBAAa,CAAC,YAAY,EAAE,UAAU,CAAC,EA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wBAAU,EAAE,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,CAAC;IAClG,CAAC;SAAM,IAAI,uBAAuB,CAAC,aAAa,EAAE,CAAC;QACjD,OAAO,IAAI,uDAAyB,CAAC,IAAI,wBAAU,EAAE,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;IAChG,CAAC;SAAM,CAAC;QACN,MAAM,WAAW,GAAG,uBAAuB,CAAC,WAAW,CAAC;QACxD,MAAM,QAAQ,GAAG,6BAAc,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC;QACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,iCAAyB,CACjC,2CAA2C,uBAAuB,CAAC,WAAW,EAAE,CACjF,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/mongo_logger.js b/node_modules/mongodb/lib/mongo_logger.js
new file mode 100644
index 00000000..dd20d0dc
--- /dev/null
+++ b/node_modules/mongodb/lib/mongo_logger.js
@@ -0,0 +1,655 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MongoLogger = exports.MongoLoggableComponent = exports.SEVERITY_LEVEL_MAP = exports.DEFAULT_MAX_DOCUMENT_LENGTH = exports.SeverityLevel = void 0;
+exports.parseSeverityFromString = parseSeverityFromString;
+exports.createStdioLogger = createStdioLogger;
+exports.stringifyWithMaxLen = stringifyWithMaxLen;
+exports.defaultLogTransform = defaultLogTransform;
+const process = require("process");
+const util_1 = require("util");
+const bson_1 = require("./bson");
+const constants_1 = require("./constants");
+const utils_1 = require("./utils");
+/**
+ * @public
+ * Severity levels align with unix syslog.
+ * Most typical driver functions will log to debug.
+ */
+exports.SeverityLevel = Object.freeze({
+ EMERGENCY: 'emergency',
+ ALERT: 'alert',
+ CRITICAL: 'critical',
+ ERROR: 'error',
+ WARNING: 'warn',
+ NOTICE: 'notice',
+ INFORMATIONAL: 'info',
+ DEBUG: 'debug',
+ TRACE: 'trace',
+ OFF: 'off'
+});
+/** @internal */
+exports.DEFAULT_MAX_DOCUMENT_LENGTH = 1000;
+/** @internal */
+class SeverityLevelMap extends Map {
+ constructor(entries) {
+ const newEntries = [];
+ for (const [level, value] of entries) {
+ newEntries.push([value, level]);
+ }
+ newEntries.push(...entries);
+ super(newEntries);
+ }
+ getNumericSeverityLevel(severity) {
+ return this.get(severity);
+ }
+ getSeverityLevelName(level) {
+ return this.get(level);
+ }
+}
+/** @internal */
+exports.SEVERITY_LEVEL_MAP = new SeverityLevelMap([
+ [exports.SeverityLevel.OFF, -Infinity],
+ [exports.SeverityLevel.EMERGENCY, 0],
+ [exports.SeverityLevel.ALERT, 1],
+ [exports.SeverityLevel.CRITICAL, 2],
+ [exports.SeverityLevel.ERROR, 3],
+ [exports.SeverityLevel.WARNING, 4],
+ [exports.SeverityLevel.NOTICE, 5],
+ [exports.SeverityLevel.INFORMATIONAL, 6],
+ [exports.SeverityLevel.DEBUG, 7],
+ [exports.SeverityLevel.TRACE, 8]
+]);
+/** @public */
+exports.MongoLoggableComponent = Object.freeze({
+ COMMAND: 'command',
+ TOPOLOGY: 'topology',
+ SERVER_SELECTION: 'serverSelection',
+ CONNECTION: 'connection',
+ CLIENT: 'client'
+});
+/**
+ * Parses a string as one of SeverityLevel
+ * @internal
+ *
+ * @param s - the value to be parsed
+ * @returns one of SeverityLevel if value can be parsed as such, otherwise null
+ */
+function parseSeverityFromString(s) {
+ const validSeverities = Object.values(exports.SeverityLevel);
+ const lowerSeverity = s?.toLowerCase();
+ if (lowerSeverity != null && validSeverities.includes(lowerSeverity)) {
+ return lowerSeverity;
+ }
+ return null;
+}
+/** @internal */
+function createStdioLogger(stream) {
+ return {
+ write: (log) => {
+ return new Promise((resolve, reject) => {
+ const logLine = (0, util_1.inspect)(log, { compact: true, breakLength: Infinity });
+ stream.write(`${logLine}\n`, 'utf-8', error => {
+ if (error)
+ return reject(error);
+ resolve(true);
+ });
+ });
+ }
+ };
+}
+/**
+ * resolves the MONGODB_LOG_PATH and mongodbLogPath options from the environment and the
+ * mongo client options respectively. The mongodbLogPath can be either 'stdout', 'stderr', a NodeJS
+ * Writable or an object which has a `write` method with the signature:
+ * ```ts
+ * write(log: Log): void
+ * ```
+ *
+ * @returns the MongoDBLogWritable object to write logs to
+ */
+function resolveLogPath({ MONGODB_LOG_PATH }, { mongodbLogPath }) {
+ if (typeof mongodbLogPath === 'string' && /^stderr$/i.test(mongodbLogPath)) {
+ return { mongodbLogPath: createStdioLogger(process.stderr), mongodbLogPathIsStdErr: true };
+ }
+ if (typeof mongodbLogPath === 'string' && /^stdout$/i.test(mongodbLogPath)) {
+ return { mongodbLogPath: createStdioLogger(process.stdout), mongodbLogPathIsStdErr: false };
+ }
+ if (typeof mongodbLogPath === 'object' && typeof mongodbLogPath?.write === 'function') {
+ return { mongodbLogPath: mongodbLogPath, mongodbLogPathIsStdErr: false };
+ }
+ if (MONGODB_LOG_PATH && /^stderr$/i.test(MONGODB_LOG_PATH)) {
+ return { mongodbLogPath: createStdioLogger(process.stderr), mongodbLogPathIsStdErr: true };
+ }
+ if (MONGODB_LOG_PATH && /^stdout$/i.test(MONGODB_LOG_PATH)) {
+ return { mongodbLogPath: createStdioLogger(process.stdout), mongodbLogPathIsStdErr: false };
+ }
+ return { mongodbLogPath: createStdioLogger(process.stderr), mongodbLogPathIsStdErr: true };
+}
+function resolveSeverityConfiguration(clientOption, environmentOption, defaultSeverity) {
+ return (parseSeverityFromString(clientOption) ??
+ parseSeverityFromString(environmentOption) ??
+ defaultSeverity);
+}
+function compareSeverity(s0, s1) {
+ const s0Num = exports.SEVERITY_LEVEL_MAP.getNumericSeverityLevel(s0);
+ const s1Num = exports.SEVERITY_LEVEL_MAP.getNumericSeverityLevel(s1);
+ return s0Num < s1Num ? -1 : s0Num > s1Num ? 1 : 0;
+}
+/** @internal */
+function stringifyWithMaxLen(value, maxDocumentLength, options = {}) {
+ let strToTruncate = '';
+ let currentLength = 0;
+ const maxDocumentLengthEnsurer = function maxDocumentLengthEnsurer(key, value) {
+ if (currentLength >= maxDocumentLength) {
+ return undefined;
+ }
+ // Account for root document
+ if (key === '') {
+ // Account for starting brace
+ currentLength += 1;
+ return value;
+ }
+ // +4 accounts for 2 quotation marks, colon and comma after value
+ // Note that this potentially undercounts since it does not account for escape sequences which
+ // will have an additional backslash added to them once passed through JSON.stringify.
+ currentLength += key.length + 4;
+ if (value == null)
+ return value;
+ switch (typeof value) {
+ case 'string':
+ // +2 accounts for quotes
+ // Note that this potentially undercounts similarly to the key length calculation
+ currentLength += value.length + 2;
+ break;
+ case 'number':
+ case 'bigint':
+ currentLength += String(value).length;
+ break;
+ case 'boolean':
+ currentLength += value ? 4 : 5;
+ break;
+ case 'object':
+ if ((0, utils_1.isUint8Array)(value)) {
+ // '{"$binary":{"base64":"","subType":"XX"}}'
+ // This is an estimate based on the fact that the base64 is approximately 1.33x the length of
+ // the actual binary sequence https://en.wikipedia.org/wiki/Base64
+ currentLength += (22 + value.byteLength + value.byteLength * 0.33 + 18) | 0;
+ }
+ else if ('_bsontype' in value) {
+ const v = value;
+ switch (v._bsontype) {
+ case 'Int32':
+ currentLength += String(v.value).length;
+ break;
+ case 'Double':
+ // Account for representing integers as .0
+ currentLength +=
+ (v.value | 0) === v.value ? String(v.value).length + 2 : String(v.value).length;
+ break;
+ case 'Long':
+ currentLength += v.toString().length;
+ break;
+ case 'ObjectId':
+ // '{"$oid":"XXXXXXXXXXXXXXXXXXXXXXXX"}'
+ currentLength += 35;
+ break;
+ case 'MaxKey':
+ case 'MinKey':
+ // '{"$maxKey":1}' or '{"$minKey":1}'
+ currentLength += 13;
+ break;
+ case 'Binary':
+ // '{"$binary":{"base64":"","subType":"XX"}}'
+ // This is an estimate based on the fact that the base64 is approximately 1.33x the length of
+ // the actual binary sequence https://en.wikipedia.org/wiki/Base64
+ currentLength += (22 + value.position + value.position * 0.33 + 18) | 0;
+ break;
+ case 'Timestamp':
+ // '{"$timestamp":{"t":,"i":}}'
+ currentLength += 19 + String(v.t).length + 5 + String(v.i).length + 2;
+ break;
+ case 'Code':
+ // '{"$code":""}' or '{"$code":"","$scope":}'
+ if (v.scope == null) {
+ currentLength += v.code.length + 10 + 2;
+ }
+ else {
+ // Ignoring actual scope object, so this undercounts by a significant amount
+ currentLength += v.code.length + 10 + 11;
+ }
+ break;
+ case 'BSONRegExp':
+ // '{"$regularExpression":{"pattern":"","options":""}}'
+ currentLength += 34 + v.pattern.length + 13 + v.options.length + 3;
+ break;
+ }
+ }
+ }
+ return value;
+ };
+ if (typeof value === 'string') {
+ strToTruncate = value;
+ }
+ else if (typeof value === 'function') {
+ strToTruncate = value.name;
+ }
+ else {
+ try {
+ if (maxDocumentLength !== 0) {
+ strToTruncate = bson_1.EJSON.stringify(value, maxDocumentLengthEnsurer, 0, options);
+ }
+ else {
+ strToTruncate = bson_1.EJSON.stringify(value, options);
+ }
+ }
+ catch (e) {
+ strToTruncate = `Extended JSON serialization failed with: ${e.message}`;
+ }
+ }
+ // handle truncation that occurs in the middle of multi-byte codepoints
+ if (maxDocumentLength !== 0 &&
+ strToTruncate.length > maxDocumentLength &&
+ strToTruncate.charCodeAt(maxDocumentLength - 1) !==
+ strToTruncate.codePointAt(maxDocumentLength - 1)) {
+ maxDocumentLength--;
+ if (maxDocumentLength === 0) {
+ return '';
+ }
+ }
+ return maxDocumentLength !== 0 && strToTruncate.length > maxDocumentLength
+ ? `${strToTruncate.slice(0, maxDocumentLength)}...`
+ : strToTruncate;
+}
+function isLogConvertible(obj) {
+ const objAsLogConvertible = obj;
+ // eslint-disable-next-line no-restricted-syntax
+ return objAsLogConvertible.toLog !== undefined && typeof objAsLogConvertible.toLog === 'function';
+}
+function attachServerSelectionFields(log, serverSelectionEvent, maxDocumentLength = exports.DEFAULT_MAX_DOCUMENT_LENGTH) {
+ const { selector, operation, topologyDescription, message } = serverSelectionEvent;
+ log.selector = stringifyWithMaxLen(selector, maxDocumentLength);
+ log.operation = operation;
+ log.topologyDescription = stringifyWithMaxLen(topologyDescription, maxDocumentLength);
+ log.message = message;
+ return log;
+}
+function attachCommandFields(log, commandEvent) {
+ log.commandName = commandEvent.commandName;
+ log.requestId = commandEvent.requestId;
+ log.driverConnectionId = commandEvent.connectionId;
+ const { host, port } = utils_1.HostAddress.fromString(commandEvent.address).toHostPort();
+ log.serverHost = host;
+ log.serverPort = port;
+ if (commandEvent?.serviceId) {
+ log.serviceId = commandEvent.serviceId.toHexString();
+ }
+ log.databaseName = commandEvent.databaseName;
+ log.serverConnectionId = commandEvent.serverConnectionId;
+ return log;
+}
+function attachConnectionFields(log, event) {
+ const { host, port } = utils_1.HostAddress.fromString(event.address).toHostPort();
+ log.serverHost = host;
+ log.serverPort = port;
+ return log;
+}
+function attachSDAMFields(log, sdamEvent) {
+ log.topologyId = sdamEvent.topologyId;
+ return log;
+}
+function attachServerHeartbeatFields(log, serverHeartbeatEvent) {
+ const { awaited, connectionId } = serverHeartbeatEvent;
+ log.awaited = awaited;
+ log.driverConnectionId = serverHeartbeatEvent.connectionId;
+ const { host, port } = utils_1.HostAddress.fromString(connectionId).toHostPort();
+ log.serverHost = host;
+ log.serverPort = port;
+ return log;
+}
+/** @internal */
+function defaultLogTransform(logObject, maxDocumentLength = exports.DEFAULT_MAX_DOCUMENT_LENGTH) {
+ let log = Object.create(null);
+ switch (logObject.name) {
+ case constants_1.SERVER_SELECTION_STARTED:
+ log = attachServerSelectionFields(log, logObject, maxDocumentLength);
+ return log;
+ case constants_1.SERVER_SELECTION_FAILED:
+ log = attachServerSelectionFields(log, logObject, maxDocumentLength);
+ log.failure = logObject.failure?.message;
+ return log;
+ case constants_1.SERVER_SELECTION_SUCCEEDED:
+ log = attachServerSelectionFields(log, logObject, maxDocumentLength);
+ log.serverHost = logObject.serverHost;
+ log.serverPort = logObject.serverPort;
+ return log;
+ case constants_1.WAITING_FOR_SUITABLE_SERVER:
+ log = attachServerSelectionFields(log, logObject, maxDocumentLength);
+ log.remainingTimeMS = logObject.remainingTimeMS;
+ return log;
+ case constants_1.COMMAND_STARTED:
+ log = attachCommandFields(log, logObject);
+ log.message = 'Command started';
+ log.command = stringifyWithMaxLen(logObject.command, maxDocumentLength, { relaxed: true });
+ log.databaseName = logObject.databaseName;
+ return log;
+ case constants_1.COMMAND_SUCCEEDED:
+ log = attachCommandFields(log, logObject);
+ log.message = 'Command succeeded';
+ log.durationMS = logObject.duration;
+ log.reply = stringifyWithMaxLen(logObject.reply, maxDocumentLength, { relaxed: true });
+ return log;
+ case constants_1.COMMAND_FAILED:
+ log = attachCommandFields(log, logObject);
+ log.message = 'Command failed';
+ log.durationMS = logObject.duration;
+ log.failure = logObject.failure?.message ?? '(redacted)';
+ return log;
+ case constants_1.CONNECTION_POOL_CREATED:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection pool created';
+ if (logObject.options) {
+ const { maxIdleTimeMS, minPoolSize, maxPoolSize, maxConnecting, waitQueueTimeoutMS } = logObject.options;
+ log = {
+ ...log,
+ maxIdleTimeMS,
+ minPoolSize,
+ maxPoolSize,
+ maxConnecting,
+ waitQueueTimeoutMS
+ };
+ }
+ return log;
+ case constants_1.CONNECTION_POOL_READY:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection pool ready';
+ return log;
+ case constants_1.CONNECTION_POOL_CLEARED:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection pool cleared';
+ if (logObject.serviceId?._bsontype === 'ObjectId') {
+ log.serviceId = logObject.serviceId?.toHexString();
+ }
+ return log;
+ case constants_1.CONNECTION_POOL_CLOSED:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection pool closed';
+ return log;
+ case constants_1.CONNECTION_CREATED:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection created';
+ log.driverConnectionId = logObject.connectionId;
+ return log;
+ case constants_1.CONNECTION_READY:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection ready';
+ log.driverConnectionId = logObject.connectionId;
+ log.durationMS = logObject.durationMS;
+ return log;
+ case constants_1.CONNECTION_CLOSED:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection closed';
+ log.driverConnectionId = logObject.connectionId;
+ switch (logObject.reason) {
+ case 'stale':
+ log.reason = 'Connection became stale because the pool was cleared';
+ break;
+ case 'idle':
+ log.reason =
+ 'Connection has been available but unused for longer than the configured max idle time';
+ break;
+ case 'error':
+ log.reason = 'An error occurred while using the connection';
+ if (logObject.error) {
+ log.error = logObject.error;
+ }
+ break;
+ case 'poolClosed':
+ log.reason = 'Connection pool was closed';
+ break;
+ default:
+ log.reason = `Unknown close reason: ${logObject.reason}`;
+ }
+ return log;
+ case constants_1.CONNECTION_CHECK_OUT_STARTED:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection checkout started';
+ return log;
+ case constants_1.CONNECTION_CHECK_OUT_FAILED:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection checkout failed';
+ switch (logObject.reason) {
+ case 'poolClosed':
+ log.reason = 'Connection pool was closed';
+ break;
+ case 'timeout':
+ log.reason = 'Wait queue timeout elapsed without a connection becoming available';
+ break;
+ case 'connectionError':
+ log.reason = 'An error occurred while trying to establish a new connection';
+ if (logObject.error) {
+ log.error = logObject.error;
+ }
+ break;
+ default:
+ log.reason = `Unknown close reason: ${logObject.reason}`;
+ }
+ log.durationMS = logObject.durationMS;
+ return log;
+ case constants_1.CONNECTION_CHECKED_OUT:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection checked out';
+ log.driverConnectionId = logObject.connectionId;
+ log.durationMS = logObject.durationMS;
+ return log;
+ case constants_1.CONNECTION_CHECKED_IN:
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Connection checked in';
+ log.driverConnectionId = logObject.connectionId;
+ return log;
+ case constants_1.SERVER_OPENING:
+ log = attachSDAMFields(log, logObject);
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Starting server monitoring';
+ return log;
+ case constants_1.SERVER_CLOSED:
+ log = attachSDAMFields(log, logObject);
+ log = attachConnectionFields(log, logObject);
+ log.message = 'Stopped server monitoring';
+ return log;
+ case constants_1.SERVER_HEARTBEAT_STARTED:
+ log = attachSDAMFields(log, logObject);
+ log = attachServerHeartbeatFields(log, logObject);
+ log.message = 'Server heartbeat started';
+ return log;
+ case constants_1.SERVER_HEARTBEAT_SUCCEEDED:
+ log = attachSDAMFields(log, logObject);
+ log = attachServerHeartbeatFields(log, logObject);
+ log.message = 'Server heartbeat succeeded';
+ log.durationMS = logObject.duration;
+ log.serverConnectionId = logObject.serverConnectionId;
+ log.reply = stringifyWithMaxLen(logObject.reply, maxDocumentLength, { relaxed: true });
+ return log;
+ case constants_1.SERVER_HEARTBEAT_FAILED:
+ log = attachSDAMFields(log, logObject);
+ log = attachServerHeartbeatFields(log, logObject);
+ log.message = 'Server heartbeat failed';
+ log.durationMS = logObject.duration;
+ log.failure = logObject.failure?.message;
+ return log;
+ case constants_1.TOPOLOGY_OPENING:
+ log = attachSDAMFields(log, logObject);
+ log.message = 'Starting topology monitoring';
+ return log;
+ case constants_1.TOPOLOGY_CLOSED:
+ log = attachSDAMFields(log, logObject);
+ log.message = 'Stopped topology monitoring';
+ return log;
+ case constants_1.TOPOLOGY_DESCRIPTION_CHANGED:
+ log = attachSDAMFields(log, logObject);
+ log.message = 'Topology description changed';
+ log.previousDescription = log.reply = stringifyWithMaxLen(logObject.previousDescription, maxDocumentLength);
+ log.newDescription = log.reply = stringifyWithMaxLen(logObject.newDescription, maxDocumentLength);
+ return log;
+ default:
+ for (const [key, value] of Object.entries(logObject)) {
+ if (value != null)
+ log[key] = value;
+ }
+ }
+ return log;
+}
+/** @internal */
+class MongoLogger {
+ constructor(options) {
+ this.pendingLog = null;
+ /**
+ * This method should be used when logging errors that do not have a public driver API for
+ * reporting errors.
+ */
+ this.error = this.log.bind(this, 'error');
+ /**
+ * This method should be used to log situations where undesirable application behaviour might
+ * occur. For example, failing to end sessions on `MongoClient.close`.
+ */
+ this.warn = this.log.bind(this, 'warn');
+ /**
+ * This method should be used to report high-level information about normal driver behaviour.
+ * For example, the creation of a `MongoClient`.
+ */
+ this.info = this.log.bind(this, 'info');
+ /**
+ * This method should be used to report information that would be helpful when debugging an
+ * application. For example, a command starting, succeeding or failing.
+ */
+ this.debug = this.log.bind(this, 'debug');
+ /**
+ * This method should be used to report fine-grained details related to logic flow. For example,
+ * entering and exiting a function body.
+ */
+ this.trace = this.log.bind(this, 'trace');
+ this.componentSeverities = options.componentSeverities;
+ this.maxDocumentLength = options.maxDocumentLength;
+ this.logDestination = options.logDestination;
+ this.logDestinationIsStdErr = options.logDestinationIsStdErr;
+ this.severities = this.createLoggingSeverities();
+ }
+ createLoggingSeverities() {
+ const severities = Object();
+ for (const component of Object.values(exports.MongoLoggableComponent)) {
+ severities[component] = {};
+ for (const severityLevel of Object.values(exports.SeverityLevel)) {
+ severities[component][severityLevel] =
+ compareSeverity(severityLevel, this.componentSeverities[component]) <= 0;
+ }
+ }
+ return severities;
+ }
+ turnOffSeverities() {
+ for (const component of Object.values(exports.MongoLoggableComponent)) {
+ this.componentSeverities[component] = exports.SeverityLevel.OFF;
+ for (const severityLevel of Object.values(exports.SeverityLevel)) {
+ this.severities[component][severityLevel] = false;
+ }
+ }
+ }
+ logWriteFailureHandler(error) {
+ if (this.logDestinationIsStdErr) {
+ this.turnOffSeverities();
+ this.clearPendingLog();
+ return;
+ }
+ this.logDestination = createStdioLogger(process.stderr);
+ this.logDestinationIsStdErr = true;
+ this.clearPendingLog();
+ this.error(exports.MongoLoggableComponent.CLIENT, {
+ toLog: function () {
+ return {
+ message: 'User input for mongodbLogPath is now invalid. Logging is halted.',
+ error: error.message
+ };
+ }
+ });
+ this.turnOffSeverities();
+ this.clearPendingLog();
+ }
+ clearPendingLog() {
+ this.pendingLog = null;
+ }
+ willLog(component, severity) {
+ if (severity === exports.SeverityLevel.OFF)
+ return false;
+ return this.severities[component][severity];
+ }
+ log(severity, component, message) {
+ if (!this.willLog(component, severity))
+ return;
+ let logMessage = { t: new Date(), c: component, s: severity };
+ if (typeof message === 'string') {
+ logMessage.message = message;
+ }
+ else if (typeof message === 'object') {
+ if (isLogConvertible(message)) {
+ logMessage = { ...logMessage, ...message.toLog() };
+ }
+ else {
+ logMessage = { ...logMessage, ...defaultLogTransform(message, this.maxDocumentLength) };
+ }
+ }
+ if ((0, utils_1.isPromiseLike)(this.pendingLog)) {
+ this.pendingLog = this.pendingLog
+ .then(() => this.logDestination.write(logMessage))
+ .then(this.clearPendingLog.bind(this), this.logWriteFailureHandler.bind(this));
+ return;
+ }
+ try {
+ const logResult = this.logDestination.write(logMessage);
+ if ((0, utils_1.isPromiseLike)(logResult)) {
+ this.pendingLog = logResult.then(this.clearPendingLog.bind(this), this.logWriteFailureHandler.bind(this));
+ }
+ }
+ catch (error) {
+ this.logWriteFailureHandler(error);
+ }
+ }
+ /**
+ * Merges options set through environment variables and the MongoClient, preferring environment
+ * variables when both are set, and substituting defaults for values not set. Options set in
+ * constructor take precedence over both environment variables and MongoClient options.
+ *
+ * @remarks
+ * When parsing component severity levels, invalid values are treated as unset and replaced with
+ * the default severity.
+ *
+ * @param envOptions - options set for the logger from the environment
+ * @param clientOptions - options set for the logger in the MongoClient options
+ * @returns a MongoLoggerOptions object to be used when instantiating a new MongoLogger
+ */
+ static resolveOptions(envOptions, clientOptions) {
+ // client options take precedence over env options
+ const resolvedLogPath = resolveLogPath(envOptions, clientOptions);
+ const combinedOptions = {
+ ...envOptions,
+ ...clientOptions,
+ mongodbLogPath: resolvedLogPath.mongodbLogPath,
+ mongodbLogPathIsStdErr: resolvedLogPath.mongodbLogPathIsStdErr
+ };
+ const defaultSeverity = resolveSeverityConfiguration(combinedOptions.mongodbLogComponentSeverities?.default, combinedOptions.MONGODB_LOG_ALL, exports.SeverityLevel.OFF);
+ return {
+ componentSeverities: {
+ command: resolveSeverityConfiguration(combinedOptions.mongodbLogComponentSeverities?.command, combinedOptions.MONGODB_LOG_COMMAND, defaultSeverity),
+ topology: resolveSeverityConfiguration(combinedOptions.mongodbLogComponentSeverities?.topology, combinedOptions.MONGODB_LOG_TOPOLOGY, defaultSeverity),
+ serverSelection: resolveSeverityConfiguration(combinedOptions.mongodbLogComponentSeverities?.serverSelection, combinedOptions.MONGODB_LOG_SERVER_SELECTION, defaultSeverity),
+ connection: resolveSeverityConfiguration(combinedOptions.mongodbLogComponentSeverities?.connection, combinedOptions.MONGODB_LOG_CONNECTION, defaultSeverity),
+ client: resolveSeverityConfiguration(combinedOptions.mongodbLogComponentSeverities?.client, combinedOptions.MONGODB_LOG_CLIENT, defaultSeverity),
+ default: defaultSeverity
+ },
+ maxDocumentLength: combinedOptions.mongodbLogMaxDocumentLength ??
+ (0, utils_1.parseUnsignedInteger)(combinedOptions.MONGODB_LOG_MAX_DOCUMENT_LENGTH) ??
+ 1000,
+ logDestination: combinedOptions.mongodbLogPath,
+ logDestinationIsStdErr: combinedOptions.mongodbLogPathIsStdErr
+ };
+ }
+}
+exports.MongoLogger = MongoLogger;
+//# sourceMappingURL=mongo_logger.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/mongo_logger.js.map b/node_modules/mongodb/lib/mongo_logger.js.map
new file mode 100644
index 00000000..b3c3f2dc
--- /dev/null
+++ b/node_modules/mongodb/lib/mongo_logger.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"mongo_logger.js","sourceRoot":"","sources":["../src/mongo_logger.ts"],"names":[],"mappings":";;;AAmOA,0DASC;AAGD,8CAcC;AA4ND,kDAiIC;AA0ED,kDAwMC;AA52BD,mCAAmC;AACnC,+BAA+B;AAE/B,iCAiBgB;AAehB,2CA2BqB;AAerB,mCAAyF;AAEzF;;;;GAIG;AACU,QAAA,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,MAAM;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f,eAAe,CAAC,2BAA2B;gBAC3C,IAAA,4BAAoB,EAAC,eAAe,CAAC,+BAA+B,CAAC;gBACrE,IAAI;YACN,cAAc,EAAE,eAAe,CAAC,cAAc;YAC9C,sBAAsB,EAAE,eAAe,CAAC,sBAAsB;SAC/D,CAAC;IACJ,CAAC;CACF;AAzMD,kCAyMC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/mongo_types.js b/node_modules/mongodb/lib/mongo_types.js
new file mode 100644
index 00000000..779a7a0a
--- /dev/null
+++ b/node_modules/mongodb/lib/mongo_types.js
@@ -0,0 +1,56 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CancellationToken = exports.TypedEventEmitter = void 0;
+const events_1 = require("events");
+const mongo_logger_1 = require("./mongo_logger");
+const utils_1 = require("./utils");
+/**
+ * Typescript type safe event emitter
+ * @public
+ */
+// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
+class TypedEventEmitter extends events_1.EventEmitter {
+ /** @internal */
+ emitAndLog(event, ...args) {
+ this.emit(event, ...args);
+ if (this.component)
+ this.mongoLogger?.debug(this.component, args[0]);
+ }
+ /** @internal */
+ emitAndLogHeartbeat(event, topologyId, serverConnectionId, ...args) {
+ this.emit(event, ...args);
+ if (this.component) {
+ const loggableHeartbeatEvent = {
+ topologyId: topologyId,
+ serverConnectionId: serverConnectionId ?? null,
+ ...args[0]
+ };
+ this.mongoLogger?.debug(this.component, loggableHeartbeatEvent);
+ }
+ }
+ /** @internal */
+ emitAndLogCommand(monitorCommands, event, databaseName, connectionEstablished, ...args) {
+ if (monitorCommands) {
+ this.emit(event, ...args);
+ }
+ if (connectionEstablished) {
+ const loggableCommandEvent = {
+ databaseName: databaseName,
+ ...args[0]
+ };
+ this.mongoLogger?.debug(mongo_logger_1.MongoLoggableComponent.COMMAND, loggableCommandEvent);
+ }
+ }
+}
+exports.TypedEventEmitter = TypedEventEmitter;
+/**
+ * @internal
+ */
+class CancellationToken extends TypedEventEmitter {
+ constructor(...args) {
+ super(...args);
+ this.on('error', utils_1.noop);
+ }
+}
+exports.CancellationToken = CancellationToken;
+//# sourceMappingURL=mongo_types.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/mongo_types.js.map b/node_modules/mongodb/lib/mongo_types.js.map
new file mode 100644
index 00000000..b807f5b3
--- /dev/null
+++ b/node_modules/mongodb/lib/mongo_types.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"mongo_types.js","sourceRoot":"","sources":["../src/mongo_types.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAgBtC,iDAQwB;AAExB,mCAA+B;AAiY/B;;;GAGG;AAEH,4EAA4E;AAC5E,MAAa,iBAAoD,SAAQ,qBAAY;IAKnF,gBAAgB;IAChB,UAAU,CACR,KAAwB,EACxB,GAAG,IAAkC;QAErC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1B,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,gBAAgB;IAChB,mBAAmB,CACjB,KAAwB,EACxB,UAAkB,EAClB,kBAAyC,EACzC,GAAG,IAAkC;QAErC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1B,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,sBAAsB,GAGc;gBACxC,UAAU,EAAE,UAAU;gBACtB,kBAAkB,EAAE,kBAAkB,IAAI,IAAI;gBAC9C,GAAG,IAAI,CAAC,CAAC,CAAC;aACX,CAAC;YACF,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IACD,gBAAgB;IAChB,iBAAiB,CACf,eAAwB,EACxB,KAAwB,EACxB,YAAoB,EACpB,qBAA8B,EAC9B,GAAG,IAAkC;QAErC,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QAC5B,CAAC;QACD,IAAI,qBAAqB,EAAE,CAAC;YAC1B,MAAM,oBAAoB,GAGU;gBAClC,YAAY,EAAE,YAAY;gBAC1B,GAAG,IAAI,CAAC,CAAC,CAAC;aACX,CAAC;YACF,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,qCAAsB,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;CACF;AAvDD,8CAuDC;AAED;;GAEG;AACH,MAAa,iBAAkB,SAAQ,iBAAqC;IAC1E,YAAY,GAAG,IAAW;QACxB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QACf,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,YAAI,CAAC,CAAC;IACzB,CAAC;CACF;AALD,8CAKC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/aggregate.js b/node_modules/mongodb/lib/operations/aggregate.js
new file mode 100644
index 00000000..8093b742
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/aggregate.js
@@ -0,0 +1,90 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AggregateOperation = exports.DB_AGGREGATE_COLLECTION = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const write_concern_1 = require("../write_concern");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+exports.DB_AGGREGATE_COLLECTION = 1;
+/** @internal */
+class AggregateOperation extends command_1.CommandOperation {
+ constructor(ns, pipeline, options) {
+ super(undefined, { ...options, dbName: ns.db });
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.CursorResponse;
+ this.options = { ...options };
+ // Covers when ns.collection is null, undefined or the empty string, use DB_AGGREGATE_COLLECTION
+ this.target = ns.collection || exports.DB_AGGREGATE_COLLECTION;
+ this.pipeline = pipeline;
+ // determine if we have a write stage, override read preference if so
+ this.hasWriteStage = false;
+ if (typeof options?.out === 'string') {
+ this.pipeline = this.pipeline.concat({ $out: options.out });
+ this.hasWriteStage = true;
+ }
+ else if (pipeline.length > 0) {
+ const finalStage = pipeline[pipeline.length - 1];
+ if (finalStage.$out || finalStage.$merge) {
+ this.hasWriteStage = true;
+ }
+ }
+ if (!this.hasWriteStage) {
+ delete this.options.writeConcern;
+ }
+ if (options?.cursor != null && typeof options.cursor !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Cursor options must be an object');
+ }
+ this.SERVER_COMMAND_RESPONSE_TYPE = this.explain ? responses_1.ExplainedCursorResponse : responses_1.CursorResponse;
+ }
+ get commandName() {
+ return 'aggregate';
+ }
+ get canRetryRead() {
+ return !this.hasWriteStage;
+ }
+ addToPipeline(stage) {
+ this.pipeline.push(stage);
+ }
+ buildCommandDocument() {
+ const options = this.options;
+ const command = { aggregate: this.target, pipeline: this.pipeline };
+ if (this.hasWriteStage && this.writeConcern) {
+ write_concern_1.WriteConcern.apply(command, this.writeConcern);
+ }
+ if (options.bypassDocumentValidation === true) {
+ command.bypassDocumentValidation = options.bypassDocumentValidation;
+ }
+ if (typeof options.allowDiskUse === 'boolean') {
+ command.allowDiskUse = options.allowDiskUse;
+ }
+ if (options.hint) {
+ command.hint = options.hint;
+ }
+ if (options.let) {
+ command.let = options.let;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (options.comment !== undefined) {
+ command.comment = options.comment;
+ }
+ command.cursor = options.cursor || {};
+ if (options.batchSize && !this.hasWriteStage) {
+ command.cursor.batchSize = options.batchSize;
+ }
+ return command;
+ }
+ handleOk(response) {
+ return response;
+ }
+}
+exports.AggregateOperation = AggregateOperation;
+(0, operation_1.defineAspects)(AggregateOperation, [
+ operation_1.Aspect.READ_OPERATION,
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.EXPLAINABLE,
+ operation_1.Aspect.CURSOR_CREATING,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=aggregate.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/aggregate.js.map b/node_modules/mongodb/lib/operations/aggregate.js.map
new file mode 100644
index 00000000..b71557f7
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/aggregate.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../src/operations/aggregate.ts"],"names":[],"mappings":";;;AACA,+DAA0F;AAE1F,oCAAqD;AAGrD,oDAAgD;AAChD,uCAAkG;AAClG,2CAA+D;AAE/D,gBAAgB;AACH,QAAA,uBAAuB,GAAG,CAAU,CAAC;AAqClD,gBAAgB;AAChB,MAAa,kBAAmB,SAAQ,0BAAgC;IAOtE,YAAY,EAAoB,EAAE,QAAoB,EAAE,OAA0B;QAChF,KAAK,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAPzC,iCAA4B,GAAG,0BAAc,CAAC;QASrD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QAE9B,gGAAgG;QAChG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,UAAU,IAAI,+BAAuB,CAAC;QAEvD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,qEAAqE;QACrE,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,OAAO,OAAO,EAAE,GAAG,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YAC5D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;aAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,E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9C,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;QACtE,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAC9C,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QAC9C,CAAC;QAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC9B,CAAC;QAED,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QAC5B,CAAC;QAED,iEAAiE;QACjE,gDAAgD;QAChD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QACpC,CAAC;QAED,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;QACtC,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAC7C,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAC/C,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAEQ,QAAQ,CACf,QAAgE;QAEhE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA/FD,gDA+FC;AAED,IAAA,yBAAa,EAAC,kBAAkB,EAAE;IAChC,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,WAAW;IAClB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.js b/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.js
new file mode 100644
index 00000000..4f59d936
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.js
@@ -0,0 +1,51 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ClientBulkWriteOperation = void 0;
+const responses_1 = require("../../cmap/wire_protocol/responses");
+const utils_1 = require("../../utils");
+const command_1 = require("../command");
+const operation_1 = require("../operation");
+/**
+ * Executes a single client bulk write operation within a potential batch.
+ * @internal
+ */
+class ClientBulkWriteOperation extends command_1.CommandOperation {
+ get commandName() {
+ return 'bulkWrite';
+ }
+ constructor(commandBuilder, options) {
+ super(undefined, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.ClientBulkWriteCursorResponse;
+ this.commandBuilder = commandBuilder;
+ this.options = options;
+ this.ns = new utils_1.MongoDBNamespace('admin', '$cmd');
+ }
+ resetBatch() {
+ return this.commandBuilder.resetBatch();
+ }
+ get canRetryWrite() {
+ return this.commandBuilder.isBatchRetryable;
+ }
+ handleOk(response) {
+ return response;
+ }
+ buildCommandDocument(connection, _session) {
+ const command = this.commandBuilder.buildBatch(connection.description.maxMessageSizeBytes, connection.description.maxWriteBatchSize, connection.description.maxBsonObjectSize);
+ // Check _after_ the batch is built if we cannot retry it and override the option.
+ if (!this.canRetryWrite) {
+ this.options.willRetryWrite = false;
+ }
+ return command;
+ }
+}
+exports.ClientBulkWriteOperation = ClientBulkWriteOperation;
+// Skipping the collation as it goes on the individual ops.
+(0, operation_1.defineAspects)(ClientBulkWriteOperation, [
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.SKIP_COLLATION,
+ operation_1.Aspect.CURSOR_CREATING,
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.COMMAND_BATCHING,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=client_bulk_write.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.js.map b/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.js.map
new file mode 100644
index 00000000..aba016e8
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"client_bulk_write.js","sourceRoot":"","sources":["../../../src/operations/client_bulk_write/client_bulk_write.ts"],"names":[],"mappings":";;;AACA,kEAAmF;AAEnF,uCAA+C;AAC/C,wCAA8C;AAC9C,4CAAqD;AAIrD;;;GAGG;AACH,MAAa,wBAAyB,SAAQ,0BAA+C;IAM3F,IAAa,WAAW;QACtB,OAAO,WAAoB,CAAC;IAC9B,CAAC;IAED,YAAY,cAA6C,EAAE,OAA+B;QACxF,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAVnB,iCAA4B,GAAG,yCAA6B,CAAC;QAWpE,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,IAAI,wBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAEQ,UAAU;QACjB,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;IAC1C,CAAC;IAED,IAAa,aAAa;QACxB,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC;IAC9C,CAAC;IAEQ,QAAQ,CACf,QAAgE;QAEhE,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEQ,oBAAoB,CAC3B,UAAsB,EACtB,QAAwB;QAExB,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAC5C,UAAU,CAAC,WAAW,CAAC,mBAAmB,EAC1C,UAAU,CAAC,WAAW,CAAC,iBAAiB,EACxC,UAAU,CAAC,WAAW,CAAC,iBAAiB,CACzC,CAAC;QAEF,kFAAkF;QAClF,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,IAAI,CAAC,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC;QACtC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAhDD,4DAgDC;AAED,2DAA2D;AAC3D,IAAA,yBAAa,EAAC,wBAAwB,EAAE;IACtC,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,gBAAgB;IACvB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.js b/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.js
new file mode 100644
index 00000000..287f7c66
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.js
@@ -0,0 +1,340 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.buildReplaceOneOperation = exports.buildUpdateManyOperation = exports.buildUpdateOneOperation = exports.buildDeleteManyOperation = exports.buildDeleteOneOperation = exports.buildInsertOneOperation = exports.ClientBulkWriteCommandBuilder = void 0;
+exports.buildOperation = buildOperation;
+const bson_1 = require("../../bson");
+const commands_1 = require("../../cmap/commands");
+const error_1 = require("../../error");
+const sort_1 = require("../../sort");
+const utils_1 = require("../../utils");
+/**
+ * The bytes overhead for the extra fields added post command generation.
+ */
+const MESSAGE_OVERHEAD_BYTES = 1000;
+/** @internal */
+class ClientBulkWriteCommandBuilder {
+ /**
+ * Create the command builder.
+ * @param models - The client write models.
+ */
+ constructor(models, options, pkFactory) {
+ this.models = models;
+ this.options = options;
+ this.pkFactory = pkFactory ?? utils_1.DEFAULT_PK_FACTORY;
+ this.currentModelIndex = 0;
+ this.previousModelIndex = 0;
+ this.lastOperations = [];
+ this.isBatchRetryable = true;
+ }
+ /**
+ * Gets the errorsOnly value for the command, which is the inverse of the
+ * user provided verboseResults option. Defaults to true.
+ */
+ get errorsOnly() {
+ if ('verboseResults' in this.options) {
+ return !this.options.verboseResults;
+ }
+ return true;
+ }
+ /**
+ * Determines if there is another batch to process.
+ * @returns True if not all batches have been built.
+ */
+ hasNextBatch() {
+ return this.currentModelIndex < this.models.length;
+ }
+ /**
+ * When we need to retry a command we need to set the current
+ * model index back to its previous value.
+ */
+ resetBatch() {
+ this.currentModelIndex = this.previousModelIndex;
+ return true;
+ }
+ /**
+ * Build a single batch of a client bulk write command.
+ * @param maxMessageSizeBytes - The max message size in bytes.
+ * @param maxWriteBatchSize - The max write batch size.
+ * @returns The client bulk write command.
+ */
+ buildBatch(maxMessageSizeBytes, maxWriteBatchSize, maxBsonObjectSize) {
+ // We start by assuming the batch has no multi-updates, so it is retryable
+ // until we find them.
+ this.isBatchRetryable = true;
+ let commandLength = 0;
+ let currentNamespaceIndex = 0;
+ const command = this.baseCommand();
+ const namespaces = new Map();
+ // In the case of retries we need to mark where we started this batch.
+ this.previousModelIndex = this.currentModelIndex;
+ while (this.currentModelIndex < this.models.length) {
+ const model = this.models[this.currentModelIndex];
+ const ns = model.namespace;
+ const nsIndex = namespaces.get(ns);
+ // Multi updates are not retryable.
+ if (model.name === 'deleteMany' || model.name === 'updateMany') {
+ this.isBatchRetryable = false;
+ }
+ if (nsIndex != null) {
+ // Build the operation and serialize it to get the bytes buffer.
+ const operation = buildOperation(model, nsIndex, this.pkFactory, this.options);
+ let operationBuffer;
+ try {
+ operationBuffer = bson_1.BSON.serialize(operation);
+ }
+ catch (cause) {
+ throw new error_1.MongoInvalidArgumentError(`Could not serialize operation to BSON`, { cause });
+ }
+ validateBufferSize('ops', operationBuffer, maxBsonObjectSize);
+ // Check if the operation buffer can fit in the command. If it can,
+ // then add the operation to the document sequence and increment the
+ // current length as long as the ops don't exceed the maxWriteBatchSize.
+ if (commandLength + operationBuffer.length < maxMessageSizeBytes &&
+ command.ops.documents.length < maxWriteBatchSize) {
+ // Pushing to the ops document sequence returns the total byte length of the document sequence.
+ commandLength = MESSAGE_OVERHEAD_BYTES + command.ops.push(operation, operationBuffer);
+ // Increment the builder's current model index.
+ this.currentModelIndex++;
+ }
+ else {
+ // The operation cannot fit in the current command and will need to
+ // go in the next batch. Exit the loop.
+ break;
+ }
+ }
+ else {
+ // The namespace is not already in the nsInfo so we will set it in the map, and
+ // construct our nsInfo and ops documents and buffers.
+ namespaces.set(ns, currentNamespaceIndex);
+ const nsInfo = { ns: ns };
+ const operation = buildOperation(model, currentNamespaceIndex, this.pkFactory, this.options);
+ let nsInfoBuffer;
+ let operationBuffer;
+ try {
+ nsInfoBuffer = bson_1.BSON.serialize(nsInfo);
+ operationBuffer = bson_1.BSON.serialize(operation);
+ }
+ catch (cause) {
+ throw new error_1.MongoInvalidArgumentError(`Could not serialize ns info to BSON`, { cause });
+ }
+ validateBufferSize('nsInfo', nsInfoBuffer, maxBsonObjectSize);
+ validateBufferSize('ops', operationBuffer, maxBsonObjectSize);
+ // Check if the operation and nsInfo buffers can fit in the command. If they
+ // can, then add the operation and nsInfo to their respective document
+ // sequences and increment the current length as long as the ops don't exceed
+ // the maxWriteBatchSize.
+ if (commandLength + nsInfoBuffer.length + operationBuffer.length < maxMessageSizeBytes &&
+ command.ops.documents.length < maxWriteBatchSize) {
+ // Pushing to the ops document sequence returns the total byte length of the document sequence.
+ commandLength =
+ MESSAGE_OVERHEAD_BYTES +
+ command.nsInfo.push(nsInfo, nsInfoBuffer) +
+ command.ops.push(operation, operationBuffer);
+ // We've added a new namespace, increment the namespace index.
+ currentNamespaceIndex++;
+ // Increment the builder's current model index.
+ this.currentModelIndex++;
+ }
+ else {
+ // The operation cannot fit in the current command and will need to
+ // go in the next batch. Exit the loop.
+ break;
+ }
+ }
+ }
+ // Set the last operations and return the command.
+ this.lastOperations = command.ops.documents;
+ return command;
+ }
+ baseCommand() {
+ const command = {
+ bulkWrite: 1,
+ errorsOnly: this.errorsOnly,
+ ordered: this.options.ordered ?? true,
+ ops: new commands_1.DocumentSequence('ops'),
+ nsInfo: new commands_1.DocumentSequence('nsInfo')
+ };
+ // Add bypassDocumentValidation if it was present in the options.
+ if (this.options.bypassDocumentValidation != null) {
+ command.bypassDocumentValidation = this.options.bypassDocumentValidation;
+ }
+ // Add let if it was present in the options.
+ if (this.options.let) {
+ command.let = this.options.let;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (this.options.comment !== undefined) {
+ command.comment = this.options.comment;
+ }
+ return command;
+ }
+}
+exports.ClientBulkWriteCommandBuilder = ClientBulkWriteCommandBuilder;
+function validateBufferSize(name, buffer, maxBsonObjectSize) {
+ if (buffer.length > maxBsonObjectSize) {
+ throw new error_1.MongoInvalidArgumentError(`Client bulk write operation ${name} of length ${buffer.length} exceeds the max bson object size of ${maxBsonObjectSize}`);
+ }
+}
+/**
+ * Build the insert one operation.
+ * @param model - The insert one model.
+ * @param index - The namespace index.
+ * @returns the operation.
+ */
+const buildInsertOneOperation = (model, index, pkFactory) => {
+ const document = {
+ insert: index,
+ document: model.document
+ };
+ document.document._id = model.document._id ?? pkFactory.createPk();
+ return document;
+};
+exports.buildInsertOneOperation = buildInsertOneOperation;
+/**
+ * Build the delete one operation.
+ * @param model - The insert many model.
+ * @param index - The namespace index.
+ * @returns the operation.
+ */
+const buildDeleteOneOperation = (model, index) => {
+ return createDeleteOperation(model, index, false);
+};
+exports.buildDeleteOneOperation = buildDeleteOneOperation;
+/**
+ * Build the delete many operation.
+ * @param model - The delete many model.
+ * @param index - The namespace index.
+ * @returns the operation.
+ */
+const buildDeleteManyOperation = (model, index) => {
+ return createDeleteOperation(model, index, true);
+};
+exports.buildDeleteManyOperation = buildDeleteManyOperation;
+/**
+ * Creates a delete operation based on the parameters.
+ */
+function createDeleteOperation(model, index, multi) {
+ const document = {
+ delete: index,
+ multi: multi,
+ filter: model.filter
+ };
+ if (model.hint) {
+ document.hint = model.hint;
+ }
+ if (model.collation) {
+ document.collation = model.collation;
+ }
+ return document;
+}
+/**
+ * Build the update one operation.
+ * @param model - The update one model.
+ * @param index - The namespace index.
+ * @returns the operation.
+ */
+const buildUpdateOneOperation = (model, index, options) => {
+ return createUpdateOperation(model, index, false, options);
+};
+exports.buildUpdateOneOperation = buildUpdateOneOperation;
+/**
+ * Build the update many operation.
+ * @param model - The update many model.
+ * @param index - The namespace index.
+ * @returns the operation.
+ */
+const buildUpdateManyOperation = (model, index, options) => {
+ return createUpdateOperation(model, index, true, options);
+};
+exports.buildUpdateManyOperation = buildUpdateManyOperation;
+/**
+ * Validate the update document.
+ * @param update - The update document.
+ */
+function validateUpdate(update, options) {
+ if (!(0, utils_1.hasAtomicOperators)(update, options)) {
+ throw new error_1.MongoAPIError('Client bulk write update models must only contain atomic modifiers (start with $) and must not be empty.');
+ }
+}
+/**
+ * Creates a delete operation based on the parameters.
+ */
+function createUpdateOperation(model, index, multi, options) {
+ // Update documents provided in UpdateOne and UpdateMany write models are
+ // required only to contain atomic modifiers (i.e. keys that start with "$").
+ // Drivers MUST throw an error if an update document is empty or if the
+ // document's first key does not start with "$".
+ validateUpdate(model.update, options);
+ const document = {
+ update: index,
+ multi: multi,
+ filter: model.filter,
+ updateMods: model.update
+ };
+ if (model.hint) {
+ document.hint = model.hint;
+ }
+ if (model.upsert) {
+ document.upsert = model.upsert;
+ }
+ if (model.arrayFilters) {
+ document.arrayFilters = model.arrayFilters;
+ }
+ if (model.collation) {
+ document.collation = model.collation;
+ }
+ if (!multi && 'sort' in model && model.sort != null) {
+ document.sort = (0, sort_1.formatSort)(model.sort);
+ }
+ return document;
+}
+/**
+ * Build the replace one operation.
+ * @param model - The replace one model.
+ * @param index - The namespace index.
+ * @returns the operation.
+ */
+const buildReplaceOneOperation = (model, index) => {
+ if ((0, utils_1.hasAtomicOperators)(model.replacement)) {
+ throw new error_1.MongoAPIError('Client bulk write replace models must not contain atomic modifiers (start with $) and must not be empty.');
+ }
+ const document = {
+ update: index,
+ multi: false,
+ filter: model.filter,
+ updateMods: model.replacement
+ };
+ if (model.hint) {
+ document.hint = model.hint;
+ }
+ if (model.upsert) {
+ document.upsert = model.upsert;
+ }
+ if (model.collation) {
+ document.collation = model.collation;
+ }
+ if (model.sort != null) {
+ document.sort = (0, sort_1.formatSort)(model.sort);
+ }
+ return document;
+};
+exports.buildReplaceOneOperation = buildReplaceOneOperation;
+/** @internal */
+function buildOperation(model, index, pkFactory, options) {
+ switch (model.name) {
+ case 'insertOne':
+ return (0, exports.buildInsertOneOperation)(model, index, pkFactory);
+ case 'deleteOne':
+ return (0, exports.buildDeleteOneOperation)(model, index);
+ case 'deleteMany':
+ return (0, exports.buildDeleteManyOperation)(model, index);
+ case 'updateOne':
+ return (0, exports.buildUpdateOneOperation)(model, index, options);
+ case 'updateMany':
+ return (0, exports.buildUpdateManyOperation)(model, index, options);
+ case 'replaceOne':
+ return (0, exports.buildReplaceOneOperation)(model, index);
+ }
+}
+//# sourceMappingURL=command_builder.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.js.map b/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.js.map
new file mode 100644
index 00000000..16036ccf
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"command_builder.js","sourceRoot":"","sources":["../../../src/operations/client_bulk_write/command_builder.ts"],"names":[],"mappings":";;;AAkdA,wCAoBC;AAteD,qCAA4E;AAC5E,kDAAuD;AACvD,uCAAuE;AAGvE,qCAAyD;AACzD,uCAAqE;AA0BrE;;GAEG;AACH,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAEpC,gBAAgB;AAChB,MAAa,6BAA6B;IAaxC;;;OAGG;IACH,YACE,MAAwD,EACxD,OAA+B,EAC/B,SAAqB;QAErB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,0BAAkB,CAAC;QACjD,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QAC5B,IAAI,CA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C5B,KAAwC,EACxC,KAAa,EACb,SAAoB,EACpB,OAA6B;IAE7B,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,WAAW;YACd,OAAO,IAAA,+BAAuB,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC1D,KAAK,WAAW;YACd,OAAO,IAAA,+BAAuB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC/C,KAAK,YAAY;YACf,OAAO,IAAA,gCAAwB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAChD,KAAK,WAAW;YACd,OAAO,IAAA,+BAAuB,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACxD,KAAK,YAAY;YACf,OAAO,IAAA,gCAAwB,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACzD,KAAK,YAAY;YACf,OAAO,IAAA,gCAAwB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/common.js b/node_modules/mongodb/lib/operations/client_bulk_write/common.js
new file mode 100644
index 00000000..023264ff
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/common.js
@@ -0,0 +1,3 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+//# sourceMappingURL=common.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/common.js.map b/node_modules/mongodb/lib/operations/client_bulk_write/common.js.map
new file mode 100644
index 00000000..cb325964
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/common.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/operations/client_bulk_write/common.ts"],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/executor.js b/node_modules/mongodb/lib/operations/client_bulk_write/executor.js
new file mode 100644
index 00000000..cab6fe0d
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/executor.js
@@ -0,0 +1,120 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ClientBulkWriteExecutor = void 0;
+const abstract_cursor_1 = require("../../cursor/abstract_cursor");
+const client_bulk_write_cursor_1 = require("../../cursor/client_bulk_write_cursor");
+const error_1 = require("../../error");
+const timeout_1 = require("../../timeout");
+const utils_1 = require("../../utils");
+const write_concern_1 = require("../../write_concern");
+const execute_operation_1 = require("../execute_operation");
+const client_bulk_write_1 = require("./client_bulk_write");
+const command_builder_1 = require("./command_builder");
+const results_merger_1 = require("./results_merger");
+/**
+ * Responsible for executing a client bulk write.
+ * @internal
+ */
+class ClientBulkWriteExecutor {
+ /**
+ * Instantiate the executor.
+ * @param client - The mongo client.
+ * @param operations - The user supplied bulk write models.
+ * @param options - The bulk write options.
+ */
+ constructor(client, operations, options) {
+ if (operations.length === 0) {
+ throw new error_1.MongoClientBulkWriteExecutionError('No client bulk write models were provided.');
+ }
+ this.client = client;
+ this.operations = operations;
+ this.options = {
+ ordered: true,
+ bypassDocumentValidation: false,
+ verboseResults: false,
+ ...options
+ };
+ // If no write concern was provided, we inherit one from the client.
+ if (!this.options.writeConcern) {
+ this.options.writeConcern = write_concern_1.WriteConcern.fromOptions(this.client.s.options);
+ }
+ if (this.options.writeConcern?.w === 0) {
+ if (this.options.verboseResults) {
+ throw new error_1.MongoInvalidArgumentError('Cannot request unacknowledged write concern and verbose results');
+ }
+ if (this.options.ordered) {
+ throw new error_1.MongoInvalidArgumentError('Cannot request unacknowledged write concern and ordered writes');
+ }
+ }
+ }
+ /**
+ * Execute the client bulk write. Will split commands into batches and exhaust the cursors
+ * for each, then merge the results into one.
+ * @returns The result.
+ */
+ async execute() {
+ // The command builder will take the user provided models and potential split the batch
+ // into multiple commands due to size.
+ const pkFactory = this.client.s.options.pkFactory;
+ const commandBuilder = new command_builder_1.ClientBulkWriteCommandBuilder(this.operations, this.options, pkFactory);
+ // Unacknowledged writes need to execute all batches and return { ok: 1}
+ const resolvedOptions = (0, utils_1.resolveTimeoutOptions)(this.client, this.options);
+ const context = timeout_1.TimeoutContext.create(resolvedOptions);
+ if (this.options.writeConcern?.w === 0) {
+ while (commandBuilder.hasNextBatch()) {
+ const operation = new client_bulk_write_1.ClientBulkWriteOperation(commandBuilder, this.options);
+ await (0, execute_operation_1.executeOperation)(this.client, operation, context);
+ }
+ return results_merger_1.ClientBulkWriteResultsMerger.unacknowledged();
+ }
+ else {
+ const resultsMerger = new results_merger_1.ClientBulkWriteResultsMerger(this.options);
+ // For each command will will create and exhaust a cursor for the results.
+ while (commandBuilder.hasNextBatch()) {
+ const cursorContext = new abstract_cursor_1.CursorTimeoutContext(context, Symbol());
+ const options = {
+ ...this.options,
+ timeoutContext: cursorContext,
+ ...(resolvedOptions.timeoutMS != null && { timeoutMode: abstract_cursor_1.CursorTimeoutMode.LIFETIME })
+ };
+ const cursor = new client_bulk_write_cursor_1.ClientBulkWriteCursor(this.client, commandBuilder, options);
+ try {
+ await resultsMerger.merge(cursor);
+ }
+ catch (error) {
+ // Write concern errors are recorded in the writeConcernErrors field on MongoClientBulkWriteError.
+ // When a write concern error is encountered, it should not terminate execution of the bulk write
+ // for either ordered or unordered bulk writes. However, drivers MUST throw an exception at the end
+ // of execution if any write concern errors were observed.
+ if (error instanceof error_1.MongoServerError && !(error instanceof error_1.MongoClientBulkWriteError)) {
+ // Server side errors need to be wrapped inside a MongoClientBulkWriteError, where the root
+ // cause is the error property and a partial result is to be included.
+ const bulkWriteError = new error_1.MongoClientBulkWriteError({
+ message: 'Mongo client bulk write encountered an error during execution'
+ });
+ bulkWriteError.cause = error;
+ bulkWriteError.partialResult = resultsMerger.bulkWriteResult;
+ throw bulkWriteError;
+ }
+ else {
+ // Client side errors are just thrown.
+ throw error;
+ }
+ }
+ }
+ // If we have write concern errors or unordered write errors at the end we throw.
+ if (resultsMerger.writeConcernErrors.length > 0 || resultsMerger.writeErrors.size > 0) {
+ const error = new error_1.MongoClientBulkWriteError({
+ message: 'Mongo client bulk write encountered errors during execution.'
+ });
+ error.writeConcernErrors = resultsMerger.writeConcernErrors;
+ error.writeErrors = resultsMerger.writeErrors;
+ error.partialResult = resultsMerger.bulkWriteResult;
+ throw error;
+ }
+ return resultsMerger.bulkWriteResult;
+ }
+ }
+}
+exports.ClientBulkWriteExecutor = ClientBulkWriteExecutor;
+//# sourceMappingURL=executor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/executor.js.map b/node_modules/mongodb/lib/operations/client_bulk_write/executor.js.map
new file mode 100644
index 00000000..bce5db91
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/executor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/operations/client_bulk_write/executor.ts"],"names":[],"mappings":";;;AACA,kEAAuF;AACvF,oFAA8E;AAC9E,uCAKqB;AAErB,2CAA+C;AAC/C,uCAAoD;AACpD,uDAAmD;AACnD,4DAAwD;AACxD,2DAA+D;AAC/D,uDAAkE;AAMlE,qDAAgE;AAEhE;;;GAGG;AACH,MAAa,uBAAuB;IAKlC;;;;;OAKG;IACH,YACE,MAAmB,EACnB,UAA4D,EAC5D,OAAgC;QAEhC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,0CAAkC,CAAC,4CAA4C,CAAC,CAAC;QAC7F,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG;YACb,OAAO,EAAE,IAAI;YACb,wBAAwB,EAAE,KAAK;YAC/B,cAAc,EAAE,KAAK;YACrB,GAAG,OAAO;SACX,CAAC;QAEF,oEAAoE;QACpE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;YAC/B,IAAI,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AAkB,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBACtF,MAAM,KAAK,GAAG,IAAI,iCAAyB,CAAC;oBAC1C,OAAO,EAAE,8DAA8D;iBACxE,CAAC,CAAC;gBACH,KAAK,CAAC,kBAAkB,GAAG,aAAa,CAAC,kBAAkB,CAAC;gBAC5D,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;gBAC9C,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC,eAAe,CAAC;gBACpD,MAAM,KAAK,CAAC;YACd,CAAC;YAED,OAAO,aAAa,CAAC,eAAe,CAAC;QACvC,CAAC;IACH,CAAC;CACF;AAzHD,0DAyHC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.js b/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.js
new file mode 100644
index 00000000..3d3b5dcb
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.js
@@ -0,0 +1,204 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ClientBulkWriteResultsMerger = void 0;
+const __1 = require("../..");
+const error_1 = require("../../error");
+/**
+ * Unacknowledged bulk writes are always the same.
+ */
+const UNACKNOWLEDGED = {
+ acknowledged: false,
+ insertedCount: 0,
+ upsertedCount: 0,
+ matchedCount: 0,
+ modifiedCount: 0,
+ deletedCount: 0,
+ insertResults: undefined,
+ updateResults: undefined,
+ deleteResults: undefined
+};
+/**
+ * Merges client bulk write cursor responses together into a single result.
+ * @internal
+ */
+class ClientBulkWriteResultsMerger {
+ /**
+ * @returns The standard unacknowledged bulk write result.
+ */
+ static unacknowledged() {
+ return UNACKNOWLEDGED;
+ }
+ /**
+ * Instantiate the merger.
+ * @param options - The options.
+ */
+ constructor(options) {
+ this.options = options;
+ this.currentBatchOffset = 0;
+ this.writeConcernErrors = [];
+ this.writeErrors = new Map();
+ this.result = {
+ acknowledged: true,
+ insertedCount: 0,
+ upsertedCount: 0,
+ matchedCount: 0,
+ modifiedCount: 0,
+ deletedCount: 0,
+ insertResults: undefined,
+ updateResults: undefined,
+ deleteResults: undefined
+ };
+ if (options.verboseResults) {
+ this.result.insertResults = new Map();
+ this.result.updateResults = new Map();
+ this.result.deleteResults = new Map();
+ }
+ }
+ /**
+ * Get the bulk write result object.
+ */
+ get bulkWriteResult() {
+ return {
+ acknowledged: this.result.acknowledged,
+ insertedCount: this.result.insertedCount,
+ upsertedCount: this.result.upsertedCount,
+ matchedCount: this.result.matchedCount,
+ modifiedCount: this.result.modifiedCount,
+ deletedCount: this.result.deletedCount,
+ insertResults: this.result.insertResults,
+ updateResults: this.result.updateResults,
+ deleteResults: this.result.deleteResults
+ };
+ }
+ /**
+ * Merge the results in the cursor to the existing result.
+ * @param currentBatchOffset - The offset index to the original models.
+ * @param response - The cursor response.
+ * @param documents - The documents in the cursor.
+ * @returns The current result.
+ */
+ async merge(cursor) {
+ let writeConcernErrorResult;
+ try {
+ for await (const document of cursor) {
+ // Only add to maps if ok: 1
+ if (document.ok === 1) {
+ if (this.options.verboseResults) {
+ this.processDocument(cursor, document);
+ }
+ }
+ else {
+ // If an individual write error is encountered during an ordered bulk write, drivers MUST
+ // record the error in writeErrors and immediately throw the exception. Otherwise, drivers
+ // MUST continue to iterate the results cursor and execute any further bulkWrite batches.
+ if (this.options.ordered) {
+ const error = new error_1.MongoClientBulkWriteError({
+ message: 'Mongo client ordered bulk write encountered a write error.'
+ });
+ error.writeErrors.set(document.idx + this.currentBatchOffset, {
+ code: document.code,
+ message: document.errmsg
+ });
+ error.partialResult = this.result;
+ throw error;
+ }
+ else {
+ this.writeErrors.set(document.idx + this.currentBatchOffset, {
+ code: document.code,
+ message: document.errmsg
+ });
+ }
+ }
+ }
+ }
+ catch (error) {
+ if (error instanceof __1.MongoWriteConcernError) {
+ const result = error.result;
+ writeConcernErrorResult = {
+ insertedCount: result.nInserted,
+ upsertedCount: result.nUpserted,
+ matchedCount: result.nMatched,
+ modifiedCount: result.nModified,
+ deletedCount: result.nDeleted,
+ writeConcernError: result.writeConcernError
+ };
+ if (this.options.verboseResults && result.cursor.firstBatch) {
+ for (const document of result.cursor.firstBatch) {
+ if (document.ok === 1) {
+ this.processDocument(cursor, document);
+ }
+ }
+ }
+ }
+ else {
+ throw error;
+ }
+ }
+ finally {
+ // Update the counts from the cursor response.
+ if (cursor.response) {
+ const response = cursor.response;
+ this.incrementCounts(response);
+ }
+ // Increment the batch offset.
+ this.currentBatchOffset += cursor.operations.length;
+ }
+ // If we have write concern errors ensure they are added.
+ if (writeConcernErrorResult) {
+ const writeConcernError = writeConcernErrorResult.writeConcernError;
+ this.incrementCounts(writeConcernErrorResult);
+ this.writeConcernErrors.push({
+ code: writeConcernError.code,
+ message: writeConcernError.errmsg
+ });
+ }
+ return this.result;
+ }
+ /**
+ * Process an individual document in the results.
+ * @param cursor - The cursor.
+ * @param document - The document to process.
+ */
+ processDocument(cursor, document) {
+ // Get the corresponding operation from the command.
+ const operation = cursor.operations[document.idx];
+ // Handle insert results.
+ if ('insert' in operation) {
+ this.result.insertResults?.set(document.idx + this.currentBatchOffset, {
+ insertedId: operation.document._id
+ });
+ }
+ // Handle update results.
+ if ('update' in operation) {
+ const result = {
+ matchedCount: document.n,
+ modifiedCount: document.nModified ?? 0,
+ // Check if the bulk did actually upsert.
+ didUpsert: document.upserted != null
+ };
+ if (document.upserted) {
+ result.upsertedId = document.upserted._id;
+ }
+ this.result.updateResults?.set(document.idx + this.currentBatchOffset, result);
+ }
+ // Handle delete results.
+ if ('delete' in operation) {
+ this.result.deleteResults?.set(document.idx + this.currentBatchOffset, {
+ deletedCount: document.n
+ });
+ }
+ }
+ /**
+ * Increment the result counts.
+ * @param document - The document with the results.
+ */
+ incrementCounts(document) {
+ this.result.insertedCount += document.insertedCount;
+ this.result.upsertedCount += document.upsertedCount;
+ this.result.matchedCount += document.matchedCount;
+ this.result.modifiedCount += document.modifiedCount;
+ this.result.deletedCount += document.deletedCount;
+ }
+}
+exports.ClientBulkWriteResultsMerger = ClientBulkWriteResultsMerger;
+//# sourceMappingURL=results_merger.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.js.map b/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.js.map
new file mode 100644
index 00000000..61ccda75
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"results_merger.js","sourceRoot":"","sources":["../../../src/operations/client_bulk_write/results_merger.ts"],"names":[],"mappings":";;;AAAA,6BAA+C;AAG/C,uCAAwD;AAUxD;;GAEG;AACH,MAAM,cAAc,GAAG;IACrB,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,SAAS;CACzB,CAAC;AAyCF;;;GAGG;AACH,MAAa,4BAA4B;IAOvC;;OAEG;IACH,MAAM,CAAC,cAAc;QACnB,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,YAAY,OAA+B;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG;YACZ,YAAY,EAAE,IAAI;YAClB,aAAa,EAAE,CAAC;YAChB,aAAa,EAAE,CAAC;YAChB,YAAY,EAAE,CAAC;YACf,aAAa,EAAE,CAAC;YAChB,YAAY,EAAE,CAAC;YACf,aAAa,EAAE,SAAS;YACxB,aAAa,EAAE,SAAS;YACxB,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operations/command.js b/node_modules/mongodb/lib/operations/command.js
new file mode 100644
index 00000000..6196dd92
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/command.js
@@ -0,0 +1,83 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CommandOperation = void 0;
+const constants_1 = require("../cmap/wire_protocol/constants");
+const error_1 = require("../error");
+const explain_1 = require("../explain");
+const read_concern_1 = require("../read_concern");
+const utils_1 = require("../utils");
+const write_concern_1 = require("../write_concern");
+const operation_1 = require("./operation");
+/** @internal */
+class CommandOperation extends operation_1.AbstractOperation {
+ constructor(parent, options) {
+ super(options);
+ this.options = options ?? {};
+ // NOTE: this was explicitly added for the add/remove user operations, it's likely
+ // something we'd want to reconsider. Perhaps those commands can use `Admin`
+ // as a parent?
+ const dbNameOverride = options?.dbName || options?.authdb;
+ if (dbNameOverride) {
+ this.ns = new utils_1.MongoDBNamespace(dbNameOverride, '$cmd');
+ }
+ else {
+ this.ns = parent
+ ? parent.s.namespace.withCollection('$cmd')
+ : new utils_1.MongoDBNamespace('admin', '$cmd');
+ }
+ this.readConcern = read_concern_1.ReadConcern.fromOptions(options);
+ this.writeConcern = write_concern_1.WriteConcern.fromOptions(options);
+ if (this.hasAspect(operation_1.Aspect.EXPLAINABLE)) {
+ this.explain = explain_1.Explain.fromOptions(options);
+ if (this.explain)
+ (0, explain_1.validateExplainTimeoutOptions)(this.options, this.explain);
+ }
+ else if (options?.explain != null) {
+ throw new error_1.MongoInvalidArgumentError(`Option "explain" is not supported on this command`);
+ }
+ }
+ get canRetryWrite() {
+ if (this.hasAspect(operation_1.Aspect.EXPLAINABLE)) {
+ return this.explain == null;
+ }
+ return super.canRetryWrite;
+ }
+ buildOptions(timeoutContext) {
+ return {
+ ...this.options,
+ ...this.bsonOptions,
+ timeoutContext,
+ readPreference: this.readPreference,
+ session: this.session
+ };
+ }
+ buildCommand(connection, session) {
+ const command = this.buildCommandDocument(connection, session);
+ const inTransaction = this.session && this.session.inTransaction();
+ if (this.readConcern && (0, utils_1.commandSupportsReadConcern)(command) && !inTransaction) {
+ Object.assign(command, { readConcern: this.readConcern });
+ }
+ if (this.writeConcern && this.hasAspect(operation_1.Aspect.WRITE_OPERATION) && !inTransaction) {
+ write_concern_1.WriteConcern.apply(command, this.writeConcern);
+ }
+ if (this.options.collation &&
+ typeof this.options.collation === 'object' &&
+ !this.hasAspect(operation_1.Aspect.SKIP_COLLATION)) {
+ Object.assign(command, { collation: this.options.collation });
+ }
+ if (typeof this.options.maxTimeMS === 'number') {
+ command.maxTimeMS = this.options.maxTimeMS;
+ }
+ if (this.options.rawData != null &&
+ this.hasAspect(operation_1.Aspect.SUPPORTS_RAW_DATA) &&
+ (0, utils_1.maxWireVersion)(connection) >= constants_1.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION) {
+ command.rawData = this.options.rawData;
+ }
+ if (this.hasAspect(operation_1.Aspect.EXPLAINABLE) && this.explain) {
+ return (0, explain_1.decorateWithExplain)(command, this.explain);
+ }
+ return command;
+ }
+}
+exports.CommandOperation = CommandOperation;
+//# sourceMappingURL=command.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/command.js.map b/node_modules/mongodb/lib/operations/command.js.map
new file mode 100644
index 00000000..a882d2bb
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/command.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/operations/command.ts"],"names":[],"mappings":";;;AAEA,+DAAsF;AACtF,oCAAqD;AACrD,wCAKoB;AACpB,kDAA8C;AAK9C,oCAAwF;AACxF,oDAA0E;AAE1E,2CAA+E;AA4D/E,gBAAgB;AAChB,MAAsB,gBAAoB,SAAQ,6BAAoB;IAMpE,YAAY,MAAwB,EAAE,OAAiC;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAE7B,kFAAkF;QAClF,kFAAkF;QAClF,qBAAqB;QACrB,MAAM,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AC5B,IAAI,CAAC,SAAS,CAAC,kBAAM,CAAC,iBAAiB,CAAC;YACxC,IAAA,sBAAc,EAAC,UAAU,CAAC,IAAI,+CAAmC,EACjE,CAAC;YACD,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACzC,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,CAAC,kBAAM,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACvD,OAAO,IAAA,6BAAmB,EAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA3FD,4CA2FC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/count.js b/node_modules/mongodb/lib/operations/count.js
new file mode 100644
index 00000000..774e6d7e
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/count.js
@@ -0,0 +1,45 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CountOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class CountOperation extends command_1.CommandOperation {
+ constructor(namespace, filter, options) {
+ super({ s: { namespace: namespace } }, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ this.collectionName = namespace.collection;
+ this.query = filter;
+ }
+ get commandName() {
+ return 'count';
+ }
+ buildCommandDocument(_connection, _session) {
+ const options = this.options;
+ const cmd = {
+ count: this.collectionName,
+ query: this.query
+ };
+ if (typeof options.limit === 'number') {
+ cmd.limit = options.limit;
+ }
+ if (typeof options.skip === 'number') {
+ cmd.skip = options.skip;
+ }
+ if (options.hint != null) {
+ cmd.hint = options.hint;
+ }
+ if (typeof options.maxTimeMS === 'number') {
+ cmd.maxTimeMS = options.maxTimeMS;
+ }
+ return cmd;
+ }
+ handleOk(response) {
+ return response.getNumber('n') ?? 0;
+ }
+}
+exports.CountOperation = CountOperation;
+(0, operation_1.defineAspects)(CountOperation, [operation_1.Aspect.READ_OPERATION, operation_1.Aspect.RETRYABLE, operation_1.Aspect.SUPPORTS_RAW_DATA]);
+//# sourceMappingURL=count.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/count.js.map b/node_modules/mongodb/lib/operations/count.js.map
new file mode 100644
index 00000000..b4999bc8
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/count.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"count.js","sourceRoot":"","sources":["../../src/operations/count.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAIlE,uCAA2E;AAC3E,2CAAoD;AAgBpD,gBAAgB;AAChB,MAAa,cAAe,SAAQ,0BAAwB;IAM1D,YAAY,SAA2B,EAAE,MAAgB,EAAE,OAAqB;QAC9E,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAA2B,EAAE,OAAO,CAAC,CAAC;QANlE,iCAA4B,GAAG,2BAAe,CAAC;QAQtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,OAAgB,CAAC;IAC1B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB,EAAE,QAAwB;QAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,GAAG,GAAa;YACpB,KAAK,EAAE,IAAI,CAAC,cAAc;YAC1B,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;QAEF,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACtC,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrC,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,CAAC;QAED,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACzB,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC1C,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACpC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAEQ,QAAQ,CAAC,QAAgE;QAChF,OAAO,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CACF;AA/CD,wCA+CC;AAED,IAAA,yBAAa,EAAC,cAAc,EAAE,CAAC,kBAAM,CAAC,cAAc,EAAE,kBAAM,CAAC,SAAS,EAAE,kBAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/create_collection.js b/node_modules/mongodb/lib/operations/create_collection.js
new file mode 100644
index 00000000..3d0e431d
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/create_collection.js
@@ -0,0 +1,109 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CreateCollectionOperation = void 0;
+exports.createCollections = createCollections;
+const constants_1 = require("../cmap/wire_protocol/constants");
+const responses_1 = require("../cmap/wire_protocol/responses");
+const collection_1 = require("../collection");
+const error_1 = require("../error");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const execute_operation_1 = require("./execute_operation");
+const indexes_1 = require("./indexes");
+const operation_1 = require("./operation");
+const ILLEGAL_COMMAND_FIELDS = new Set([
+ 'w',
+ 'wtimeout',
+ 'timeoutMS',
+ 'j',
+ 'fsync',
+ 'pkFactory',
+ 'raw',
+ 'readPreference',
+ 'session',
+ 'readConcern',
+ 'writeConcern',
+ 'raw',
+ 'fieldsAsRaw',
+ 'useBigInt64',
+ 'promoteLongs',
+ 'promoteValues',
+ 'promoteBuffers',
+ 'bsonRegExp',
+ 'serializeFunctions',
+ 'ignoreUndefined',
+ 'enableUtf8Validation'
+]);
+/* @internal */
+const INVALID_QE_VERSION = 'Driver support of Queryable Encryption is incompatible with server. Upgrade server to use Queryable Encryption.';
+/** @internal */
+class CreateCollectionOperation extends command_1.CommandOperation {
+ constructor(db, name, options = {}) {
+ super(db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ this.db = db;
+ this.name = name;
+ }
+ get commandName() {
+ return 'create';
+ }
+ buildCommandDocument(_connection, _session) {
+ const isOptionValid = ([k, v]) => v != null && typeof v !== 'function' && !ILLEGAL_COMMAND_FIELDS.has(k);
+ return {
+ create: this.name,
+ ...Object.fromEntries(Object.entries(this.options).filter(isOptionValid))
+ };
+ }
+ handleOk(_response) {
+ return new collection_1.Collection(this.db, this.name, this.options);
+ }
+}
+exports.CreateCollectionOperation = CreateCollectionOperation;
+async function createCollections(db, name, options) {
+ const timeoutContext = timeout_1.TimeoutContext.create({
+ session: options.session,
+ serverSelectionTimeoutMS: db.client.s.options.serverSelectionTimeoutMS,
+ waitQueueTimeoutMS: db.client.s.options.waitQueueTimeoutMS,
+ timeoutMS: options.timeoutMS
+ });
+ const encryptedFields = options.encryptedFields ??
+ db.client.s.options.autoEncryption?.encryptedFieldsMap?.[`${db.databaseName}.${name}`];
+ if (encryptedFields) {
+ class CreateSupportingFLEv2CollectionOperation extends CreateCollectionOperation {
+ buildCommandDocument(connection, session) {
+ if (!connection.description.loadBalanced &&
+ (0, utils_1.maxWireVersion)(connection) < constants_1.MIN_SUPPORTED_QE_WIRE_VERSION) {
+ throw new error_1.MongoCompatibilityError(`${INVALID_QE_VERSION} The minimum server version required is ${constants_1.MIN_SUPPORTED_QE_SERVER_VERSION}`);
+ }
+ return super.buildCommandDocument(connection, session);
+ }
+ }
+ // Create auxilliary collections for queryable encryption support.
+ const escCollection = encryptedFields.escCollection ?? `enxcol_.${name}.esc`;
+ const ecocCollection = encryptedFields.ecocCollection ?? `enxcol_.${name}.ecoc`;
+ for (const collectionName of [escCollection, ecocCollection]) {
+ const createOp = new CreateSupportingFLEv2CollectionOperation(db, collectionName, {
+ clusteredIndex: {
+ key: { _id: 1 },
+ unique: true
+ },
+ session: options.session
+ });
+ await (0, execute_operation_1.executeOperation)(db.client, createOp, timeoutContext);
+ }
+ if (!options.encryptedFields) {
+ options = { ...options, encryptedFields };
+ }
+ }
+ const coll = await (0, execute_operation_1.executeOperation)(db.client, new CreateCollectionOperation(db, name, options), timeoutContext);
+ if (encryptedFields) {
+ // Create the required index for queryable encryption support.
+ const createIndexOp = indexes_1.CreateIndexesOperation.fromIndexSpecification(db, name, { __safeContent__: 1 }, { session: options.session });
+ await (0, execute_operation_1.executeOperation)(db.client, createIndexOp, timeoutContext);
+ }
+ return coll;
+}
+(0, operation_1.defineAspects)(CreateCollectionOperation, [operation_1.Aspect.WRITE_OPERATION]);
+//# sourceMappingURL=create_collection.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/create_collection.js.map b/node_modules/mongodb/lib/operations/create_collection.js.map
new file mode 100644
index 00000000..7b0a0367
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/create_collection.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"create_collection.js","sourceRoot":"","sources":["../../src/operations/create_collection.ts"],"names":[],"mappings":";;;AAiJA,8CAsEC;AArND,+DAGyC;AACzC,+DAAkE;AAClE,8CAA2C;AAE3C,oCAAmD;AAGnD,wCAA4C;AAC5C,oCAA0C;AAC1C,uCAA2E;AAC3E,2DAAuD;AACvD,uCAAmD;AACnD,2CAAoD;AAEpD,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IACrC,GAAG;IACH,UAAU;IACV,WAAW;IACX,GAAG;IACH,OAAO;IACP,WAAW;IACX,KAA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gBAChF,cAAc,EAAE;oBACd,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE;oBACf,MAAM,EAAE,IAAI;iBACb;gBACD,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC,CAAC;YACH,MAAM,IAAA,oCAAgB,EAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;YAC7B,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,IAAA,oCAAgB,EACjC,EAAE,CAAC,MAAM,EACT,IAAI,yBAAyB,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,EAChD,cAAc,CACf,CAAC;IAEF,IAAI,eAAe,EAAE,CAAC;QACpB,8DAA8D;QAC9D,MAAM,aAAa,GAAG,gCAAsB,CAAC,sBAAsB,CACjE,EAAE,EACF,IAAI,EACJ,EAAE,eAAe,EAAE,CAAC,EAAE,EACtB,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAC7B,CAAC;QACF,MAAM,IAAA,oCAAgB,EAAC,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,IAAsC,CAAC;AAChD,CAAC;AAED,IAAA,yBAAa,EAAC,yBAAyB,EAAE,CAAC,kBAAM,CAAC,eAAe,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/delete.js b/node_modules/mongodb/lib/operations/delete.js
new file mode 100644
index 00000000..d6d00a05
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/delete.js
@@ -0,0 +1,125 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.DeleteManyOperation = exports.DeleteOneOperation = exports.DeleteOperation = void 0;
+exports.makeDeleteStatement = makeDeleteStatement;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class DeleteOperation extends command_1.CommandOperation {
+ constructor(ns, statements, options) {
+ super(undefined, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ this.ns = ns;
+ this.statements = statements;
+ }
+ get commandName() {
+ return 'delete';
+ }
+ get canRetryWrite() {
+ if (super.canRetryWrite === false) {
+ return false;
+ }
+ return this.statements.every(op => (op.limit != null ? op.limit > 0 : true));
+ }
+ buildCommandDocument(connection, _session) {
+ const options = this.options;
+ const ordered = typeof options.ordered === 'boolean' ? options.ordered : true;
+ const command = {
+ delete: this.ns.collection,
+ deletes: this.statements,
+ ordered
+ };
+ if (options.let) {
+ command.let = options.let;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (options.comment !== undefined) {
+ command.comment = options.comment;
+ }
+ const unacknowledgedWrite = this.writeConcern && this.writeConcern.w === 0;
+ if (unacknowledgedWrite && (0, utils_1.maxWireVersion)(connection) < 9) {
+ if (this.statements.find((o) => o.hint)) {
+ throw new error_1.MongoCompatibilityError(`hint for the delete command is only supported on MongoDB 4.4+`);
+ }
+ }
+ return command;
+ }
+}
+exports.DeleteOperation = DeleteOperation;
+class DeleteOneOperation extends DeleteOperation {
+ constructor(ns, filter, options) {
+ super(ns, [makeDeleteStatement(filter, { ...options, limit: 1 })], options);
+ }
+ handleOk(response) {
+ const res = super.handleOk(response);
+ // @ts-expect-error Explain commands have broken TS
+ if (this.explain)
+ return res;
+ if (res.code)
+ throw new error_1.MongoServerError(res);
+ if (res.writeErrors)
+ throw new error_1.MongoServerError(res.writeErrors[0]);
+ return {
+ acknowledged: this.writeConcern?.w !== 0,
+ deletedCount: res.n
+ };
+ }
+}
+exports.DeleteOneOperation = DeleteOneOperation;
+class DeleteManyOperation extends DeleteOperation {
+ constructor(ns, filter, options) {
+ super(ns, [makeDeleteStatement(filter, options)], options);
+ }
+ handleOk(response) {
+ const res = super.handleOk(response);
+ // @ts-expect-error Explain commands have broken TS
+ if (this.explain)
+ return res;
+ if (res.code)
+ throw new error_1.MongoServerError(res);
+ if (res.writeErrors)
+ throw new error_1.MongoServerError(res.writeErrors[0]);
+ return {
+ acknowledged: this.writeConcern?.w !== 0,
+ deletedCount: res.n
+ };
+ }
+}
+exports.DeleteManyOperation = DeleteManyOperation;
+function makeDeleteStatement(filter, options) {
+ const op = {
+ q: filter,
+ limit: typeof options.limit === 'number' ? options.limit : 0
+ };
+ if (options.collation) {
+ op.collation = options.collation;
+ }
+ if (options.hint) {
+ op.hint = options.hint;
+ }
+ return op;
+}
+(0, operation_1.defineAspects)(DeleteOperation, [
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+(0, operation_1.defineAspects)(DeleteOneOperation, [
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.EXPLAINABLE,
+ operation_1.Aspect.SKIP_COLLATION,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+(0, operation_1.defineAspects)(DeleteManyOperation, [
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.EXPLAINABLE,
+ operation_1.Aspect.SKIP_COLLATION,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=delete.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/delete.js.map b/node_modules/mongodb/lib/operations/delete.js.map
new file mode 100644
index 00000000..2f4f076f
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/delete.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/operations/delete.ts"],"names":[],"mappings":";;;AAiJA,kDAkBC;AAjKD,+DAAkE;AAClE,oCAA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;AACZ,CAAC;AAED,IAAA,yBAAa,EAAC,eAAe,EAAE;IAC7B,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC;AACH,IAAA,yBAAa,EAAC,kBAAkB,EAAE;IAChC,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,WAAW;IAClB,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC;AACH,IAAA,yBAAa,EAAC,mBAAmB,EAAE;IACjC,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,WAAW;IAClB,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/distinct.js b/node_modules/mongodb/lib/operations/distinct.js
new file mode 100644
index 00000000..cfd4e79f
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/distinct.js
@@ -0,0 +1,61 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.DistinctOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/**
+ * Return a list of distinct values for the given key across a collection.
+ * @internal
+ */
+class DistinctOperation extends command_1.CommandOperation {
+ /**
+ * Construct a Distinct operation.
+ *
+ * @param collection - Collection instance.
+ * @param key - Field of the document to find distinct values for.
+ * @param query - The query for filtering the set of documents to which we apply the distinct filter.
+ * @param options - Optional settings. See Collection.prototype.distinct for a list of options.
+ */
+ constructor(collection, key, query, options) {
+ super(collection, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options ?? {};
+ this.collection = collection;
+ this.key = key;
+ this.query = query;
+ }
+ get commandName() {
+ return 'distinct';
+ }
+ buildCommandDocument(_connection) {
+ const command = {
+ distinct: this.collection.collectionName,
+ key: this.key,
+ query: this.query
+ };
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (this.options.comment !== undefined) {
+ command.comment = this.options.comment;
+ }
+ if (this.options.hint != null) {
+ command.hint = this.options.hint;
+ }
+ return command;
+ }
+ handleOk(response) {
+ if (this.explain) {
+ return response.toObject(this.bsonOptions);
+ }
+ return response.toObject(this.bsonOptions).values;
+ }
+}
+exports.DistinctOperation = DistinctOperation;
+(0, operation_1.defineAspects)(DistinctOperation, [
+ operation_1.Aspect.READ_OPERATION,
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.EXPLAINABLE,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=distinct.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/distinct.js.map b/node_modules/mongodb/lib/operations/distinct.js.map
new file mode 100644
index 00000000..b8373bdc
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/distinct.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"distinct.js","sourceRoot":"","sources":["../../src/operations/distinct.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAElE,uCAA2E;AAC3E,2CAAoD;AAkBpD;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,0BAAkC;IASvE;;;;;;;OAOG;IACH,YAAY,UAAsB,EAAE,GAAW,EAAE,KAAe,EAAE,OAAyB;QACzF,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAjBpB,iCAA4B,GAAG,2BAAe,CAAC;QAmBtD,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,UAAmB,CAAC;IAC7B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB;QACnD,MAAM,OAAO,GAAa;YACxB,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,cAAc;YACxC,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;QACF,iEAAiE;QACjE,gDAAgD;QAChD,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACvC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACzC,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YAC9B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QACnC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAEQ,QAAQ,CACf,QAAgE;QAEhE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;IACpD,CAAC;CACF;AAzDD,8CAyDC;AAED,IAAA,yBAAa,EAAC,iBAAiB,EAAE;IAC/B,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,WAAW;IAClB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/drop.js b/node_modules/mongodb/lib/operations/drop.js
new file mode 100644
index 00000000..2a00a34d
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/drop.js
@@ -0,0 +1,93 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.DropDatabaseOperation = exports.DropCollectionOperation = void 0;
+exports.dropCollections = dropCollections;
+const __1 = require("..");
+const responses_1 = require("../cmap/wire_protocol/responses");
+const abstract_cursor_1 = require("../cursor/abstract_cursor");
+const error_1 = require("../error");
+const timeout_1 = require("../timeout");
+const command_1 = require("./command");
+const execute_operation_1 = require("./execute_operation");
+const operation_1 = require("./operation");
+/** @internal */
+class DropCollectionOperation extends command_1.CommandOperation {
+ constructor(db, name, options = {}) {
+ super(db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ this.name = name;
+ }
+ get commandName() {
+ return 'drop';
+ }
+ buildCommandDocument(_connection, _session) {
+ return { drop: this.name };
+ }
+ handleOk(_response) {
+ return true;
+ }
+ handleError(error) {
+ if (!(error instanceof __1.MongoServerError))
+ throw error;
+ if (Number(error.code) !== error_1.MONGODB_ERROR_CODES.NamespaceNotFound)
+ throw error;
+ return false;
+ }
+}
+exports.DropCollectionOperation = DropCollectionOperation;
+async function dropCollections(db, name, options) {
+ const timeoutContext = timeout_1.TimeoutContext.create({
+ session: options.session,
+ serverSelectionTimeoutMS: db.client.s.options.serverSelectionTimeoutMS,
+ waitQueueTimeoutMS: db.client.s.options.waitQueueTimeoutMS,
+ timeoutMS: options.timeoutMS
+ });
+ const encryptedFieldsMap = db.client.s.options.autoEncryption?.encryptedFieldsMap;
+ let encryptedFields = options.encryptedFields ?? encryptedFieldsMap?.[`${db.databaseName}.${name}`];
+ if (!encryptedFields && encryptedFieldsMap) {
+ // If the MongoClient was configured with an encryptedFieldsMap,
+ // and no encryptedFields config was available in it or explicitly
+ // passed as an argument, the spec tells us to look one up using
+ // listCollections().
+ const listCollectionsResult = await db
+ .listCollections({ name }, {
+ nameOnly: false,
+ session: options.session,
+ timeoutContext: new abstract_cursor_1.CursorTimeoutContext(timeoutContext, Symbol())
+ })
+ .toArray();
+ encryptedFields = listCollectionsResult?.[0]?.options?.encryptedFields;
+ }
+ if (encryptedFields) {
+ const escCollection = encryptedFields.escCollection || `enxcol_.${name}.esc`;
+ const ecocCollection = encryptedFields.ecocCollection || `enxcol_.${name}.ecoc`;
+ for (const collectionName of [escCollection, ecocCollection]) {
+ // Drop auxilliary collections, ignoring potential NamespaceNotFound errors.
+ const dropOp = new DropCollectionOperation(db, collectionName, options);
+ await (0, execute_operation_1.executeOperation)(db.client, dropOp, timeoutContext);
+ }
+ }
+ return await (0, execute_operation_1.executeOperation)(db.client, new DropCollectionOperation(db, name, options), timeoutContext);
+}
+/** @internal */
+class DropDatabaseOperation extends command_1.CommandOperation {
+ constructor(db, options) {
+ super(db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ }
+ get commandName() {
+ return 'dropDatabase';
+ }
+ buildCommandDocument(_connection, _session) {
+ return { dropDatabase: 1 };
+ }
+ handleOk(_response) {
+ return true;
+ }
+}
+exports.DropDatabaseOperation = DropDatabaseOperation;
+(0, operation_1.defineAspects)(DropCollectionOperation, [operation_1.Aspect.WRITE_OPERATION]);
+(0, operation_1.defineAspects)(DropDatabaseOperation, [operation_1.Aspect.WRITE_OPERATION]);
+//# sourceMappingURL=drop.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/drop.js.map b/node_modules/mongodb/lib/operations/drop.js.map
new file mode 100644
index 00000000..31738a4f
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/drop.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"drop.js","sourceRoot":"","sources":["../../src/operations/drop.ts"],"names":[],"mappings":";;;AAmDA,0CAkDC;AArGD,0BAAwE;AAExE,+DAAkE;AAClE,+DAAiE;AAEjE,oCAA+C;AAE/C,wCAA4C;AAC5C,uCAA2E;AAC3E,2DAAuD;AACvD,2CAAoD;AAQpD,gBAAgB;AAChB,MAAa,uBAAwB,SAAQ,0BAAyB;IAMpE,YAAY,EAAM,EAAE,IAAY,EAAE,UAAiC,EAAE;QACnE,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QANZ,iCAA4B,GAAG,2BAAe,CAAC;QAOtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAA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oB,CAAC,WAAuB,EAAE,QAAwB;QAC7E,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;IAC7B,CAAC;IAEQ,QAAQ,CAAC,SAAiE;QACjF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAnBD,sDAmBC;AAED,IAAA,yBAAa,EAAC,uBAAuB,EAAE,CAAC,kBAAM,CAAC,eAAe,CAAC,CAAC,CAAC;AACjE,IAAA,yBAAa,EAAC,qBAAqB,EAAE,CAAC,kBAAM,CAAC,eAAe,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/end_sessions.js b/node_modules/mongodb/lib/operations/end_sessions.js
new file mode 100644
index 00000000..0f6e605c
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/end_sessions.js
@@ -0,0 +1,34 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.EndSessionsOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const command_1 = require("../operations/command");
+const read_preference_1 = require("../read_preference");
+const utils_1 = require("../utils");
+const operation_1 = require("./operation");
+class EndSessionsOperation extends command_1.CommandOperation {
+ constructor(sessions) {
+ super();
+ this.writeConcern = { w: 0 };
+ this.ns = utils_1.MongoDBNamespace.fromString('admin.$cmd');
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.sessions = sessions;
+ }
+ buildCommandDocument(_connection, _session) {
+ return {
+ endSessions: this.sessions
+ };
+ }
+ buildOptions(timeoutContext) {
+ return {
+ timeoutContext,
+ readPreference: read_preference_1.ReadPreference.primaryPreferred
+ };
+ }
+ get commandName() {
+ return 'endSessions';
+ }
+}
+exports.EndSessionsOperation = EndSessionsOperation;
+(0, operation_1.defineAspects)(EndSessionsOperation, operation_1.Aspect.WRITE_OPERATION);
+//# sourceMappingURL=end_sessions.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/end_sessions.js.map b/node_modules/mongodb/lib/operations/end_sessions.js.map
new file mode 100644
index 00000000..2744f1e9
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/end_sessions.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"end_sessions.js","sourceRoot":"","sources":["../../src/operations/end_sessions.ts"],"names":[],"mappings":";;;AASA,+DAAkE;AAClE,mDAAyD;AACzD,wDAAoD;AACpD,oCAA4C;AAC5C,2CAAoD;AAEpD,MAAa,oBAAqB,SAAQ,0BAAsB;IAO9D,YAAY,QAAgC;QAC1C,KAAK,EAAE,CAAC;QAPD,iBAAY,GAAiB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QACtC,OAAE,GAAG,wBAAgB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QAC/C,iCAA4B,GAAG,2BAAe,CAAC;QAMtD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB,EAAE,QAAwB;QAC7E,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,QAAQ;SAC3B,CAAC;IACJ,CAAC;IACQ,YAAY,CAAC,cAA8B;QAClD,OAAO;YACL,cAAc;YACd,cAAc,EAAE,gCAAc,CAAC,gBAAgB;SAChD,CAAC;IACJ,CAAC;IACD,IAAa,WAAW;QACtB,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AA1BD,oDA0BC;AAED,IAAA,yBAAa,EAAC,oBAAoB,EAAE,kBAAM,CAAC,eAAe,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/estimated_document_count.js b/node_modules/mongodb/lib/operations/estimated_document_count.js
new file mode 100644
index 00000000..d41ad505
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/estimated_document_count.js
@@ -0,0 +1,41 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.EstimatedDocumentCountOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class EstimatedDocumentCountOperation extends command_1.CommandOperation {
+ constructor(collection, options = {}) {
+ super(collection, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ this.collectionName = collection.collectionName;
+ }
+ get commandName() {
+ return 'count';
+ }
+ buildCommandDocument(_connection, _session) {
+ const cmd = { count: this.collectionName };
+ if (typeof this.options.maxTimeMS === 'number') {
+ cmd.maxTimeMS = this.options.maxTimeMS;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (this.options.comment !== undefined) {
+ cmd.comment = this.options.comment;
+ }
+ return cmd;
+ }
+ handleOk(response) {
+ return response.getNumber('n') ?? 0;
+ }
+}
+exports.EstimatedDocumentCountOperation = EstimatedDocumentCountOperation;
+(0, operation_1.defineAspects)(EstimatedDocumentCountOperation, [
+ operation_1.Aspect.READ_OPERATION,
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.CURSOR_CREATING,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=estimated_document_count.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/estimated_document_count.js.map b/node_modules/mongodb/lib/operations/estimated_document_count.js.map
new file mode 100644
index 00000000..b17cfad7
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/estimated_document_count.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"estimated_document_count.js","sourceRoot":"","sources":["../../src/operations/estimated_document_count.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAGlE,uCAA2E;AAC3E,2CAAoD;AAYpD,gBAAgB;AAChB,MAAa,+BAAgC,SAAQ,0BAAwB;IAK3E,YAAY,UAAsB,EAAE,UAAyC,EAAE;QAC7E,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QALpB,iCAA4B,GAAG,2BAAe,CAAC;QAMtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;IAClD,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,OAAgB,CAAC;IAC1B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB,EAAE,QAAwB;QAC7E,MAAM,GAAG,GAAa,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;QAErD,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC/C,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;QACzC,CAAC;QAED,iEAAiE;QACjE,gDAAgD;QAChD,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACvC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACrC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAEQ,QAAQ,CAAC,QAAgE;QAChF,OAAO,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CACF;AAlCD,0EAkCC;AAED,IAAA,yBAAa,EAAC,+BAA+B,EAAE;IAC7C,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/execute_operation.js b/node_modules/mongodb/lib/operations/execute_operation.js
new file mode 100644
index 00000000..223cdff4
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/execute_operation.js
@@ -0,0 +1,312 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.executeOperation = executeOperation;
+exports.autoConnect = autoConnect;
+const promises_1 = require("timers/promises");
+const constants_1 = require("../cmap/wire_protocol/constants");
+const error_1 = require("../error");
+const read_preference_1 = require("../read_preference");
+const common_1 = require("../sdam/common");
+const server_selection_1 = require("../sdam/server_selection");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const aggregate_1 = require("./aggregate");
+const operation_1 = require("./operation");
+const run_command_1 = require("./run_command");
+const MMAPv1_RETRY_WRITES_ERROR_CODE = error_1.MONGODB_ERROR_CODES.IllegalOperation;
+const MMAPv1_RETRY_WRITES_ERROR_MESSAGE = 'This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.';
+/**
+ * Executes the given operation with provided arguments.
+ * @internal
+ *
+ * @remarks
+ * Allows for a single point of entry to provide features such as implicit sessions, which
+ * are required by the Driver Sessions specification in the event that a ClientSession is
+ * not provided.
+ *
+ * The expectation is that this function:
+ * - Connects the MongoClient if it has not already been connected, see {@link autoConnect}
+ * - Creates a session if none is provided and cleans up the session it creates
+ * - Tries an operation and retries under certain conditions, see {@link executeOperationWithRetries}
+ *
+ * @typeParam T - The operation's type
+ * @typeParam TResult - The type of the operation's result, calculated from T
+ *
+ * @param client - The MongoClient to execute this operation with
+ * @param operation - The operation to execute
+ */
+async function executeOperation(client, operation, timeoutContext) {
+ if (!(operation instanceof operation_1.AbstractOperation)) {
+ // TODO(NODE-3483): Extend MongoRuntimeError
+ throw new error_1.MongoRuntimeError('This method requires a valid operation instance');
+ }
+ const topology = client.topology == null
+ ? await (0, utils_1.abortable)(autoConnect(client), operation.options)
+ : client.topology;
+ // The driver sessions spec mandates that we implicitly create sessions for operations
+ // that are not explicitly provided with a session.
+ let session = operation.session;
+ let owner;
+ if (session == null) {
+ owner = Symbol();
+ session = client.startSession({ owner, explicit: false });
+ }
+ else if (session.hasEnded) {
+ throw new error_1.MongoExpiredSessionError('Use of expired sessions is not permitted');
+ }
+ else if (session.snapshotEnabled &&
+ (0, utils_1.maxWireVersion)(topology) < constants_1.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION) {
+ throw new error_1.MongoCompatibilityError('Snapshot reads require MongoDB 5.0 or later');
+ }
+ else if (session.client !== client) {
+ throw new error_1.MongoInvalidArgumentError('ClientSession must be from the same MongoClient');
+ }
+ operation.session ??= session;
+ const readPreference = operation.readPreference ?? read_preference_1.ReadPreference.primary;
+ const inTransaction = !!session?.inTransaction();
+ const hasReadAspect = operation.hasAspect(operation_1.Aspect.READ_OPERATION);
+ if (inTransaction &&
+ !readPreference.equals(read_preference_1.ReadPreference.primary) &&
+ (hasReadAspect || operation.commandName === 'runCommand')) {
+ throw new error_1.MongoTransactionError(`Read preference in a transaction must be primary, not: ${readPreference.mode}`);
+ }
+ if (session?.isPinned && session.transaction.isCommitted && !operation.bypassPinningCheck) {
+ session.unpin();
+ }
+ timeoutContext ??= timeout_1.TimeoutContext.create({
+ session,
+ serverSelectionTimeoutMS: client.s.options.serverSelectionTimeoutMS,
+ waitQueueTimeoutMS: client.s.options.waitQueueTimeoutMS,
+ timeoutMS: operation.options.timeoutMS
+ });
+ try {
+ return await executeOperationWithRetries(operation, {
+ topology,
+ timeoutContext,
+ session,
+ readPreference
+ });
+ }
+ finally {
+ if (session?.owner != null && session.owner === owner) {
+ await session.endSession();
+ }
+ }
+}
+/**
+ * Connects a client if it has not yet been connected
+ * @internal
+ */
+async function autoConnect(client) {
+ if (client.topology == null) {
+ if (client.s.hasBeenClosed) {
+ throw new error_1.MongoNotConnectedError('Client must be connected before running operations');
+ }
+ client.s.options.__skipPingOnConnect = true;
+ try {
+ await client.connect();
+ if (client.topology == null) {
+ throw new error_1.MongoRuntimeError('client.connect did not create a topology but also did not throw');
+ }
+ return client.topology;
+ }
+ finally {
+ delete client.s.options.__skipPingOnConnect;
+ }
+ }
+ return client.topology;
+}
+/** @internal The base backoff duration in milliseconds */
+const BASE_BACKOFF_MS = 100;
+/** @internal The maximum backoff duration in milliseconds */
+const MAX_BACKOFF_MS = 10_000;
+/**
+ * Executes an operation and retries as appropriate
+ * @internal
+ *
+ * @remarks
+ * Implements behaviour described in [Retryable Reads](https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.md) and [Retryable
+ * Writes](https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.md) specification
+ *
+ * This function:
+ * - performs initial server selection
+ * - attempts to execute an operation
+ * - retries the operation if it meets the criteria for a retryable read or a retryable write
+ *
+ * @typeParam T - The operation's type
+ * @typeParam TResult - The type of the operation's result, calculated from T
+ *
+ * @param operation - The operation to execute
+ */
+async function executeOperationWithRetries(operation, { topology, timeoutContext, session, readPreference }) {
+ let selector;
+ if (operation.hasAspect(operation_1.Aspect.MUST_SELECT_SAME_SERVER)) {
+ // GetMore and KillCursor operations must always select the same server, but run through
+ // server selection to potentially force monitor checks if the server is
+ // in an unknown state.
+ selector = (0, server_selection_1.sameServerSelector)(operation.server?.description);
+ }
+ else if (operation instanceof aggregate_1.AggregateOperation && operation.hasWriteStage) {
+ // If operation should try to write to secondary use the custom server selector
+ // otherwise provide the read preference.
+ selector = (0, server_selection_1.secondaryWritableServerSelector)(topology.commonWireVersion, readPreference);
+ }
+ else {
+ selector = readPreference;
+ }
+ let server = await topology.selectServer(selector, {
+ session,
+ operationName: operation.commandName,
+ timeoutContext,
+ signal: operation.options.signal,
+ deprioritizedServers: new server_selection_1.DeprioritizedServers()
+ });
+ const hasReadAspect = operation.hasAspect(operation_1.Aspect.READ_OPERATION);
+ const hasWriteAspect = operation.hasAspect(operation_1.Aspect.WRITE_OPERATION);
+ const inTransaction = session?.inTransaction() ?? false;
+ const willRetryRead = topology.s.options.retryReads && !inTransaction && operation.canRetryRead;
+ const willRetryWrite = topology.s.options.retryWrites &&
+ !inTransaction &&
+ (0, utils_1.supportsRetryableWrites)(server) &&
+ operation.canRetryWrite;
+ const willRetry = operation.hasAspect(operation_1.Aspect.RETRYABLE) &&
+ session != null &&
+ ((hasReadAspect && willRetryRead) || (hasWriteAspect && willRetryWrite));
+ if (hasWriteAspect && willRetryWrite && session != null) {
+ operation.options.willRetryWrite = true;
+ session.incrementTransactionNumber();
+ }
+ const deprioritizedServers = new server_selection_1.DeprioritizedServers();
+ let maxAttempts = typeof operation.maxAttempts === 'number'
+ ? operation.maxAttempts
+ : willRetry
+ ? timeoutContext.csotEnabled()
+ ? Infinity
+ : 2
+ : 1;
+ let error = null;
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
+ operation.attemptsMade = attempt + 1;
+ operation.server = server;
+ try {
+ try {
+ const result = await server.command(operation, timeoutContext);
+ return operation.handleOk(result);
+ }
+ catch (error) {
+ return operation.handleError(error);
+ }
+ }
+ catch (operationError) {
+ // Should never happen but if it does - propagate the error.
+ if (!(operationError instanceof error_1.MongoError))
+ throw operationError;
+ // Preserve the original error once a write has been performed.
+ // Only update to the latest error if no writes were performed.
+ if (error == null) {
+ error = operationError;
+ }
+ else {
+ if (!operationError.hasErrorLabel(error_1.MongoErrorLabel.NoWritesPerformed)) {
+ error = operationError;
+ }
+ }
+ // Reset timeouts
+ timeoutContext.clear();
+ if (hasWriteAspect && operationError.code === MMAPv1_RETRY_WRITES_ERROR_CODE) {
+ throw new error_1.MongoServerError({
+ message: MMAPv1_RETRY_WRITES_ERROR_MESSAGE,
+ errmsg: MMAPv1_RETRY_WRITES_ERROR_MESSAGE,
+ originalError: operationError
+ });
+ }
+ if (!canRetry(operation, operationError)) {
+ throw error;
+ }
+ if (operationError.hasErrorLabel(error_1.MongoErrorLabel.SystemOverloadedError)) {
+ const maxOverloadAttempts = topology.s.options.maxAdaptiveRetries + 1;
+ maxAttempts = Math.min(maxOverloadAttempts, operation.maxAttempts ?? maxOverloadAttempts);
+ }
+ if (attempt + 1 >= maxAttempts) {
+ throw error;
+ }
+ if (operationError instanceof error_1.MongoNetworkError &&
+ operation.hasAspect(operation_1.Aspect.CURSOR_CREATING) &&
+ session != null &&
+ session.isPinned &&
+ !session.inTransaction()) {
+ session.unpin({ force: true, forceClear: true });
+ }
+ if (operationError.hasErrorLabel(error_1.MongoErrorLabel.SystemOverloadedError) &&
+ operation.hasAspect(operation_1.Aspect.CURSOR_CREATING) &&
+ session != null &&
+ session.isPinned &&
+ !session.inTransaction()) {
+ session.unpin({ force: true });
+ }
+ if (operationError.hasErrorLabel(error_1.MongoErrorLabel.SystemOverloadedError)) {
+ const backoffMS = Math.random() * Math.min(MAX_BACKOFF_MS, BASE_BACKOFF_MS * 2 ** attempt);
+ // if the backoff would exhaust the CSOT timeout, short-circuit.
+ if (timeoutContext.csotEnabled() && backoffMS > timeoutContext.remainingTimeMS) {
+ throw error;
+ }
+ await (0, promises_1.setTimeout)(backoffMS);
+ }
+ if (topology.description.type === common_1.TopologyType.Sharded ||
+ (operationError.hasErrorLabel(error_1.MongoErrorLabel.SystemOverloadedError) &&
+ topology.s.options.enableOverloadRetargeting)) {
+ deprioritizedServers.add(server.description);
+ }
+ server = await topology.selectServer(selector, {
+ session,
+ operationName: operation.commandName,
+ deprioritizedServers,
+ signal: operation.options.signal
+ });
+ if (hasWriteAspect &&
+ !(0, utils_1.supportsRetryableWrites)(server) &&
+ !operationError.hasErrorLabel(error_1.MongoErrorLabel.SystemOverloadedError)) {
+ throw new error_1.MongoUnexpectedServerResponseError('Selected server does not support retryable writes');
+ }
+ // Batched operations must reset the batch before retry,
+ // otherwise building a command will build the _next_ batch, not the current batch.
+ if (operation.hasAspect(operation_1.Aspect.COMMAND_BATCHING)) {
+ operation.resetBatch();
+ }
+ }
+ }
+ throw (error ??
+ new error_1.MongoRuntimeError('Should never happen: operation execution loop terminated but no error was recorded.'));
+ function canRetry(operation, error) {
+ // SystemOverloadedError is retryable, but must respect retryReads/retryWrites settings
+ // Check topology options directly (not operation.canRetryRead/Write) because backpressure
+ // expands retry support beyond traditional retryable reads/writes
+ // NOTE: Unlike traditional retries, backpressure retries ARE allowed inside transactions
+ if (error.hasErrorLabel(error_1.MongoErrorLabel.SystemOverloadedError) &&
+ error.hasErrorLabel(error_1.MongoErrorLabel.RetryableError)) {
+ // runCommand requires BOTH retryReads and retryWrites to be enabled (per spec step 2.4)
+ if (operation instanceof run_command_1.RunCommandOperation) {
+ return topology.s.options.retryReads && topology.s.options.retryWrites;
+ }
+ // Write-stage aggregates ($out/$merge) require retryWrites
+ if (operation instanceof aggregate_1.AggregateOperation && operation.hasWriteStage) {
+ return topology.s.options.retryWrites;
+ }
+ // For other operations, check if retries are enabled based on operation type
+ const canRetryAsRead = hasReadAspect && topology.s.options.retryReads;
+ const canRetryAsWrite = hasWriteAspect && topology.s.options.retryWrites;
+ return canRetryAsRead || canRetryAsWrite;
+ }
+ // run command is only retryable if we get retryable overload errors
+ if (operation instanceof run_command_1.RunCommandOperation) {
+ return false;
+ }
+ // batch operations are only retryable if the batch is retryable
+ if (operation.hasAspect(operation_1.Aspect.COMMAND_BATCHING)) {
+ return operation.canRetryWrite && (0, error_1.isRetryableWriteError)(error);
+ }
+ return ((hasWriteAspect && willRetryWrite && (0, error_1.isRetryableWriteError)(error)) ||
+ (hasReadAspect && willRetryRead && (0, error_1.isRetryableReadError)(error)));
+ }
+}
+//# sourceMappingURL=execute_operation.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/execute_operation.js.map b/node_modules/mongodb/lib/operations/execute_operation.js.map
new file mode 100644
index 00000000..587e4c59
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/execute_operation.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"execute_operation.js","sourceRoot":"","sources":["../../src/operations/execute_operation.ts"],"names":[],"mappings":";;AAgEA,4CAyEC;AAMD,kCAmBC;AAlKD,8CAA6C;AAE7C,+DAA4F;AAC5F,oCAekB;AAElB,wDAAoD;AACpD,2CAA8C;AAC9C,+DAKkC;AAGlC,wCAA4C;AAC5C,oCAA8E;AAC9E,2CAAiD;AACjD,2CAAwD;AACxD,+CAAoD;AAEpD,MAAM,8BAA8B,GAAG,2BAAmB,CAAC,gBAAgB,CAAC;AAC5E,MAAM,iCAAiC,GACrC,oHAAoH,CAAC;AAMvH;;;;;;;;;;;;;;;;;;;GAmBG;AACI,KAAK,UAAU,gBAAgB,CAGpC,MAAmB,EAAE,SAAY,EAAE,cAAsC;IACzE,IAAI,CAAC,CAAC,SAAS,YAAY,6BAAiB,CAAC,EAAE,CA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a/node_modules/mongodb/lib/operations/find.js b/node_modules/mongodb/lib/operations/find.js
new file mode 100644
index 00000000..6c1b2bb6
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/find.js
@@ -0,0 +1,148 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.FindOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const sort_1 = require("../sort");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class FindOperation extends command_1.CommandOperation {
+ constructor(ns, filter = {}, options = {}) {
+ super(undefined, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.CursorResponse;
+ this.options = { ...options };
+ delete this.options.writeConcern;
+ this.ns = ns;
+ if (typeof filter !== 'object' || Array.isArray(filter)) {
+ throw new error_1.MongoInvalidArgumentError('Query filter must be a plain object or ObjectId');
+ }
+ // special case passing in an ObjectId as a filter
+ this.filter = filter != null && filter._bsontype === 'ObjectId' ? { _id: filter } : filter;
+ this.SERVER_COMMAND_RESPONSE_TYPE = this.explain ? responses_1.ExplainedCursorResponse : responses_1.CursorResponse;
+ }
+ get commandName() {
+ return 'find';
+ }
+ buildOptions(timeoutContext) {
+ return {
+ ...this.options,
+ ...this.bsonOptions,
+ documentsReturnedIn: 'firstBatch',
+ session: this.session,
+ timeoutContext
+ };
+ }
+ handleOk(response) {
+ return response;
+ }
+ buildCommandDocument() {
+ return makeFindCommand(this.ns, this.filter, this.options);
+ }
+}
+exports.FindOperation = FindOperation;
+function makeFindCommand(ns, filter, options) {
+ const findCommand = {
+ find: ns.collection,
+ filter
+ };
+ if (options.sort) {
+ findCommand.sort = (0, sort_1.formatSort)(options.sort);
+ }
+ if (options.projection) {
+ let projection = options.projection;
+ if (projection && Array.isArray(projection)) {
+ projection = projection.length
+ ? projection.reduce((result, field) => {
+ result[field] = 1;
+ return result;
+ }, {})
+ : { _id: 1 };
+ }
+ findCommand.projection = projection;
+ }
+ if (options.hint) {
+ findCommand.hint = (0, utils_1.normalizeHintField)(options.hint);
+ }
+ if (typeof options.skip === 'number') {
+ findCommand.skip = options.skip;
+ }
+ if (typeof options.limit === 'number') {
+ if (options.limit < 0) {
+ findCommand.limit = -options.limit;
+ findCommand.singleBatch = true;
+ }
+ else {
+ findCommand.limit = options.limit;
+ }
+ }
+ if (typeof options.batchSize === 'number') {
+ if (options.batchSize < 0) {
+ findCommand.limit = -options.batchSize;
+ }
+ else {
+ if (options.batchSize === options.limit) {
+ // Spec dictates that if these are equal the batchSize should be one more than the
+ // limit to avoid leaving the cursor open.
+ findCommand.batchSize = options.batchSize + 1;
+ }
+ else {
+ findCommand.batchSize = options.batchSize;
+ }
+ }
+ }
+ if (typeof options.singleBatch === 'boolean') {
+ findCommand.singleBatch = options.singleBatch;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (options.comment !== undefined) {
+ findCommand.comment = options.comment;
+ }
+ if (options.max) {
+ findCommand.max = options.max;
+ }
+ if (options.min) {
+ findCommand.min = options.min;
+ }
+ if (typeof options.returnKey === 'boolean') {
+ findCommand.returnKey = options.returnKey;
+ }
+ if (typeof options.showRecordId === 'boolean') {
+ findCommand.showRecordId = options.showRecordId;
+ }
+ if (typeof options.tailable === 'boolean') {
+ findCommand.tailable = options.tailable;
+ }
+ if (typeof options.oplogReplay === 'boolean') {
+ findCommand.oplogReplay = options.oplogReplay;
+ }
+ if (typeof options.timeout === 'boolean') {
+ findCommand.noCursorTimeout = !options.timeout;
+ }
+ else if (typeof options.noCursorTimeout === 'boolean') {
+ findCommand.noCursorTimeout = options.noCursorTimeout;
+ }
+ if (typeof options.awaitData === 'boolean') {
+ findCommand.awaitData = options.awaitData;
+ }
+ if (typeof options.allowPartialResults === 'boolean') {
+ findCommand.allowPartialResults = options.allowPartialResults;
+ }
+ if (typeof options.allowDiskUse === 'boolean') {
+ findCommand.allowDiskUse = options.allowDiskUse;
+ }
+ if (options.let) {
+ findCommand.let = options.let;
+ }
+ return findCommand;
+}
+(0, operation_1.defineAspects)(FindOperation, [
+ operation_1.Aspect.READ_OPERATION,
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.EXPLAINABLE,
+ operation_1.Aspect.CURSOR_CREATING,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=find.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/find.js.map b/node_modules/mongodb/lib/operations/find.js.map
new file mode 100644
index 00000000..df9b5b9d
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/find.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"find.js","sourceRoot":"","sources":["../../src/operations/find.ts"],"names":[],"mappings":";;;AACA,+DAA0F;AAE1F,oCAAqD;AAGrD,kCAAgD;AAEhD,oCAAqE;AACrE,uCAAkG;AAClG,2CAA+D;AAoE/D,gBAAgB;AAChB,MAAa,aAAc,SAAQ,0BAAgC;IAajE,YAAY,EAAoB,EAAE,SAAmB,EAAE,EAAE,UAAuB,EAAE;QAChF,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAbnB,iCAA4B,GAAG,0BAAc,CAAC;QAerD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QACjC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAEb,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACxD,MAAM,IAAI,iCAAyB,CAAC,iDAAiD,CAAC,CAAC;QACzF,CAAC;QAED,kDAAkD;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QAE3F,IAAI,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AAS,KAAK,SAAS,EAAE,CAAC;QAC3C,WAAW,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAC5C,CAAC;IAED,IAAI,OAAO,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;QACrD,WAAW,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAChE,CAAC;IACD,IAAI,OAAO,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QAC9C,WAAW,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAClD,CAAC;IAED,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,WAAW,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAChC,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,IAAA,yBAAa,EAAC,aAAa,EAAE;IAC3B,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,WAAW;IAClB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/find_and_modify.js b/node_modules/mongodb/lib/operations/find_and_modify.js
new file mode 100644
index 00000000..92841309
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/find_and_modify.js
@@ -0,0 +1,158 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.FindOneAndUpdateOperation = exports.FindOneAndReplaceOperation = exports.FindOneAndDeleteOperation = exports.FindAndModifyOperation = exports.ReturnDocument = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const read_preference_1 = require("../read_preference");
+const sort_1 = require("../sort");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @public */
+exports.ReturnDocument = Object.freeze({
+ BEFORE: 'before',
+ AFTER: 'after'
+});
+function configureFindAndModifyCmdBaseUpdateOpts(cmdBase, options) {
+ cmdBase.new = options.returnDocument === exports.ReturnDocument.AFTER;
+ cmdBase.upsert = options.upsert === true;
+ if (options.bypassDocumentValidation === true) {
+ cmdBase.bypassDocumentValidation = options.bypassDocumentValidation;
+ }
+ return cmdBase;
+}
+/** @internal */
+class FindAndModifyOperation extends command_1.CommandOperation {
+ constructor(collection, query, options) {
+ super(collection, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ // force primary read preference
+ this.readPreference = read_preference_1.ReadPreference.primary;
+ this.collection = collection;
+ this.query = query;
+ }
+ get commandName() {
+ return 'findAndModify';
+ }
+ buildCommandDocument(connection, _session) {
+ const options = this.options;
+ const command = {
+ findAndModify: this.collection.collectionName,
+ query: this.query,
+ remove: false,
+ new: false,
+ upsert: false
+ };
+ options.includeResultMetadata ??= false;
+ const sort = (0, sort_1.formatSort)(options.sort);
+ if (sort) {
+ command.sort = sort;
+ }
+ if (options.projection) {
+ command.fields = options.projection;
+ }
+ if (options.maxTimeMS) {
+ command.maxTimeMS = options.maxTimeMS;
+ }
+ // Decorate the findAndModify command with the write Concern
+ if (options.writeConcern) {
+ command.writeConcern = options.writeConcern;
+ }
+ if (options.let) {
+ command.let = options.let;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (options.comment !== undefined) {
+ command.comment = options.comment;
+ }
+ (0, utils_1.decorateWithCollation)(command, options);
+ if (options.hint) {
+ const unacknowledgedWrite = this.writeConcern?.w === 0;
+ if (unacknowledgedWrite && (0, utils_1.maxWireVersion)(connection) < 9) {
+ throw new error_1.MongoCompatibilityError('hint for the findAndModify command is only supported on MongoDB 4.4+');
+ }
+ command.hint = options.hint;
+ }
+ return command;
+ }
+ handleOk(response) {
+ const result = super.handleOk(response);
+ return this.options.includeResultMetadata ? result : (result.value ?? null);
+ }
+}
+exports.FindAndModifyOperation = FindAndModifyOperation;
+/** @internal */
+class FindOneAndDeleteOperation extends FindAndModifyOperation {
+ constructor(collection, filter, options) {
+ // Basic validation
+ if (filter == null || typeof filter !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Argument "filter" must be an object');
+ }
+ super(collection, filter, options);
+ }
+ buildCommandDocument(connection, session) {
+ const document = super.buildCommandDocument(connection, session);
+ document.remove = true;
+ return document;
+ }
+}
+exports.FindOneAndDeleteOperation = FindOneAndDeleteOperation;
+/** @internal */
+class FindOneAndReplaceOperation extends FindAndModifyOperation {
+ constructor(collection, filter, replacement, options) {
+ if (filter == null || typeof filter !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Argument "filter" must be an object');
+ }
+ if (replacement == null || typeof replacement !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Argument "replacement" must be an object');
+ }
+ if ((0, utils_1.hasAtomicOperators)(replacement)) {
+ throw new error_1.MongoInvalidArgumentError('Replacement document must not contain atomic operators');
+ }
+ super(collection, filter, options);
+ this.replacement = replacement;
+ }
+ buildCommandDocument(connection, session) {
+ const document = super.buildCommandDocument(connection, session);
+ document.update = this.replacement;
+ configureFindAndModifyCmdBaseUpdateOpts(document, this.options);
+ return document;
+ }
+}
+exports.FindOneAndReplaceOperation = FindOneAndReplaceOperation;
+/** @internal */
+class FindOneAndUpdateOperation extends FindAndModifyOperation {
+ constructor(collection, filter, update, options) {
+ if (filter == null || typeof filter !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Argument "filter" must be an object');
+ }
+ if (update == null || typeof update !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Argument "update" must be an object');
+ }
+ if (!(0, utils_1.hasAtomicOperators)(update, options)) {
+ throw new error_1.MongoInvalidArgumentError('Update document requires atomic operators');
+ }
+ super(collection, filter, options);
+ this.update = update;
+ this.options = options;
+ }
+ buildCommandDocument(connection, session) {
+ const document = super.buildCommandDocument(connection, session);
+ document.update = this.update;
+ configureFindAndModifyCmdBaseUpdateOpts(document, this.options);
+ if (this.options.arrayFilters) {
+ document.arrayFilters = this.options.arrayFilters;
+ }
+ return document;
+ }
+}
+exports.FindOneAndUpdateOperation = FindOneAndUpdateOperation;
+(0, operation_1.defineAspects)(FindAndModifyOperation, [
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.EXPLAINABLE,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=find_and_modify.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/find_and_modify.js.map b/node_modules/mongodb/lib/operations/find_and_modify.js.map
new file mode 100644
index 00000000..8d2ce095
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/find_and_modify.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"find_and_modify.js","sourceRoot":"","sources":["../../src/operations/find_and_modify.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAElE,oCAA8E;AAC9E,wDAAoD;AAEpD,kCAAiE;AACjE,oCAAqF;AAErF,uCAA2E;AAC3E,2CAAoD;AAEpD,cAAc;AACD,QAAA,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;CACN,CAAC,CAAC;AA2FZ,SAAS,uCAAuC,CAC9C,OAA6B,EAC7B,OAA2D;IAE3D,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,cAAc,KAAK,sBAAc,CAAC,KAAK,CAAC;IAC9D,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC;IAEzC,IAAI,OAAO,CAAC,wBAAwB,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IACtE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,gBAAgB;AAChB,MAAa,sBAAuB,SAAQ,0BAA0B;IAOpE,YACE,UAAsB,EACtB,KAAe,EACf,OAAqF;QAErF,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAXpB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,QAAQ,EAAE,CAAC;YACjD,MAAM,IAAI,iCAAyB,CAAC,qCAAqC,CAAC,CAAC;QAC7E,CAAC;QAED,IAAI,MAAM,IAAI,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACjD,MAAM,IAAI,iCAAyB,CAAC,qCAAqC,CAAC,CAAC;QAC7E,CAAC;QAED,IAAI,CAAC,IAAA,0BAAkB,EAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,iCAAyB,CAAC,2CAA2C,CAAC,CAAC;QACnF,CAAC;QAED,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEQ,oBAAoB,CAC3B,UAAsB,EACtB,OAAuB;QAEvB,MAAM,QAAQ,GAAG,KAAK,CAAC,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACjE,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC9B,uCAAuC,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAEhE,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;YAC9B,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QACpD,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAzCD,8DAyCC;AAED,IAAA,yBAAa,EAAC,sBAAsB,EAAE;IACpC,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,WAAW;IAClB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/get_more.js b/node_modules/mongodb/lib/operations/get_more.js
new file mode 100644
index 00000000..9247b9b5
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/get_more.js
@@ -0,0 +1,62 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.GetMoreOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const utils_1 = require("../utils");
+const operation_1 = require("./operation");
+/** @internal */
+class GetMoreOperation extends operation_1.AbstractOperation {
+ constructor(ns, cursorId, server, options) {
+ super(options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.CursorResponse;
+ this.options = options;
+ this.ns = ns;
+ this.cursorId = cursorId;
+ this.server = server;
+ }
+ get commandName() {
+ return 'getMore';
+ }
+ buildCommand(connection) {
+ if (this.cursorId == null || this.cursorId.isZero()) {
+ throw new error_1.MongoRuntimeError('Unable to iterate cursor with no id');
+ }
+ const collection = this.ns.collection;
+ if (collection == null) {
+ // Cursors should have adopted the namespace returned by MongoDB
+ // which should always defined a collection name (even a pseudo one, ex. db.aggregate())
+ throw new error_1.MongoRuntimeError('A collection name must be determined before getMore');
+ }
+ const getMoreCmd = {
+ getMore: this.cursorId,
+ collection
+ };
+ if (typeof this.options.batchSize === 'number') {
+ getMoreCmd.batchSize = Math.abs(this.options.batchSize);
+ }
+ if (typeof this.options.maxAwaitTimeMS === 'number') {
+ getMoreCmd.maxTimeMS = this.options.maxAwaitTimeMS;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (this.options.comment !== undefined && (0, utils_1.maxWireVersion)(connection) >= 9) {
+ getMoreCmd.comment = this.options.comment;
+ }
+ return getMoreCmd;
+ }
+ buildOptions(timeoutContext) {
+ return {
+ returnFieldSelector: null,
+ documentsReturnedIn: 'nextBatch',
+ timeoutContext,
+ ...this.options
+ };
+ }
+ handleOk(response) {
+ return response;
+ }
+}
+exports.GetMoreOperation = GetMoreOperation;
+(0, operation_1.defineAspects)(GetMoreOperation, [operation_1.Aspect.READ_OPERATION, operation_1.Aspect.MUST_SELECT_SAME_SERVER]);
+//# sourceMappingURL=get_more.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/get_more.js.map b/node_modules/mongodb/lib/operations/get_more.js.map
new file mode 100644
index 00000000..530368b5
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/get_more.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"get_more.js","sourceRoot":"","sources":["../../src/operations/get_more.ts"],"names":[],"mappings":";;;AAEA,+DAAiE;AACjE,oCAA6C;AAG7C,oCAAiE;AACjE,2CAA8F;AA+B9F,gBAAgB;AAChB,MAAa,gBAAiB,SAAQ,6BAAiC;IAKrE,YAAY,EAAoB,EAAE,QAAc,EAAE,MAAc,EAAE,OAAuB;QACvF,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,iCAA4B,GAAG,0BAAc,CAAC;QAOrD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,SAAkB,CAAC;IAC5B,CAAC;IAEQ,YAAY,CAAC,UAAsB;QAC1C,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YACpD,MAAM,IAAI,yBAAiB,CAAC,qCAAqC,CAAC,CAAC;QACrE,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC;QACtC,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;YACvB,gEAAgE;YAChE,wFAAwF;YACxF,MAAM,IAAI,yBAAiB,CAAC,qDAAqD,CAAC,CAAC;QACrF,CAAC;QAED,MAAM,UAAU,GAAmB;YACjC,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,UAAU;SACX,CAAC;QAEF,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC/C,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;YACpD,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QACrD,CAAC;QAED,iEAAiE;QACjE,gDAAgD;QAChD,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,IAAA,sBAAc,EAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1E,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QAC5C,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO;YACL,mBAAmB,EAAE,IAAI;YACzB,mBAAmB,EAAE,WAAW;YAChC,cAAc;YACd,GAAG,IAAI,CAAC,OAAO;SAChB,CAAC;IACJ,CAAC;IAEQ,QAAQ,CACf,QAAgE;QAEhE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAlED,4CAkEC;AAED,IAAA,yBAAa,EAAC,gBAAgB,EAAE,CAAC,kBAAM,CAAC,cAAc,EAAE,kBAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/indexes.js b/node_modules/mongodb/lib/operations/indexes.js
new file mode 100644
index 00000000..1e6163a2
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/indexes.js
@@ -0,0 +1,186 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ListIndexesOperation = exports.DropIndexOperation = exports.CreateIndexesOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+const VALID_INDEX_OPTIONS = new Set([
+ 'background',
+ 'unique',
+ 'name',
+ 'partialFilterExpression',
+ 'sparse',
+ 'hidden',
+ 'expireAfterSeconds',
+ 'storageEngine',
+ 'collation',
+ 'version',
+ // text indexes
+ 'weights',
+ 'default_language',
+ 'language_override',
+ 'textIndexVersion',
+ // 2d-sphere indexes
+ '2dsphereIndexVersion',
+ // 2d indexes
+ 'bits',
+ 'min',
+ 'max',
+ // geoHaystack Indexes
+ 'bucketSize',
+ // wildcard indexes
+ 'wildcardProjection'
+]);
+function isIndexDirection(x) {
+ return (typeof x === 'number' || x === '2d' || x === '2dsphere' || x === 'text' || x === 'geoHaystack');
+}
+function isSingleIndexTuple(t) {
+ return Array.isArray(t) && t.length === 2 && isIndexDirection(t[1]);
+}
+/**
+ * Converts an `IndexSpecification`, which can be specified in multiple formats, into a
+ * valid `key` for the createIndexes command.
+ */
+function constructIndexDescriptionMap(indexSpec) {
+ const key = new Map();
+ const indexSpecs = !Array.isArray(indexSpec) || isSingleIndexTuple(indexSpec) ? [indexSpec] : indexSpec;
+ // Iterate through array and handle different types
+ for (const spec of indexSpecs) {
+ if (typeof spec === 'string') {
+ key.set(spec, 1);
+ }
+ else if (Array.isArray(spec)) {
+ key.set(spec[0], spec[1] ?? 1);
+ }
+ else if (spec instanceof Map) {
+ for (const [property, value] of spec) {
+ key.set(property, value);
+ }
+ }
+ else if ((0, utils_1.isObject)(spec)) {
+ for (const [property, value] of Object.entries(spec)) {
+ key.set(property, value);
+ }
+ }
+ }
+ return key;
+}
+/**
+ * Receives an index description and returns a modified index description which has had invalid options removed
+ * from the description and has mapped the `version` option to the `v` option.
+ */
+function resolveIndexDescription(description) {
+ const validProvidedOptions = Object.entries(description).filter(([optionName]) => VALID_INDEX_OPTIONS.has(optionName));
+ return Object.fromEntries(
+ // we support the `version` option, but the `createIndexes` command expects it to be the `v`
+ validProvidedOptions.map(([name, value]) => (name === 'version' ? ['v', value] : [name, value])));
+}
+/** @internal */
+class CreateIndexesOperation extends command_1.CommandOperation {
+ constructor(parent, collectionName, indexes, options) {
+ super(parent, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options ?? {};
+ // collation is set on each index, it should not be defined at the root
+ this.options.collation = undefined;
+ this.collectionName = collectionName;
+ this.indexes = indexes.map((userIndex) => {
+ // Ensure the key is a Map to preserve index key ordering
+ const key = userIndex.key instanceof Map ? userIndex.key : new Map(Object.entries(userIndex.key));
+ const name = userIndex.name ?? Array.from(key).flat().join('_');
+ const validIndexOptions = resolveIndexDescription(userIndex);
+ return {
+ ...validIndexOptions,
+ name,
+ key
+ };
+ });
+ this.ns = parent.s.namespace;
+ }
+ static fromIndexDescriptionArray(parent, collectionName, indexes, options) {
+ return new CreateIndexesOperation(parent, collectionName, indexes, options);
+ }
+ static fromIndexSpecification(parent, collectionName, indexSpec, options = {}) {
+ const key = constructIndexDescriptionMap(indexSpec);
+ const description = { ...options, key };
+ return new CreateIndexesOperation(parent, collectionName, [description], options);
+ }
+ get commandName() {
+ return 'createIndexes';
+ }
+ buildCommandDocument(connection) {
+ const options = this.options;
+ const indexes = this.indexes;
+ const serverWireVersion = (0, utils_1.maxWireVersion)(connection);
+ const cmd = { createIndexes: this.collectionName, indexes };
+ if (options.commitQuorum != null) {
+ if (serverWireVersion < 9) {
+ throw new error_1.MongoCompatibilityError('Option `commitQuorum` for `createIndexes` not supported on servers < 4.4');
+ }
+ cmd.commitQuorum = options.commitQuorum;
+ }
+ return cmd;
+ }
+ handleOk(_response) {
+ const indexNames = this.indexes.map(index => index.name || '');
+ return indexNames;
+ }
+}
+exports.CreateIndexesOperation = CreateIndexesOperation;
+/** @internal */
+class DropIndexOperation extends command_1.CommandOperation {
+ constructor(collection, indexName, options) {
+ super(collection, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options ?? {};
+ this.collection = collection;
+ this.indexName = indexName;
+ this.ns = collection.fullNamespace;
+ }
+ get commandName() {
+ return 'dropIndexes';
+ }
+ buildCommandDocument(_connection) {
+ return { dropIndexes: this.collection.collectionName, index: this.indexName };
+ }
+}
+exports.DropIndexOperation = DropIndexOperation;
+/** @internal */
+class ListIndexesOperation extends command_1.CommandOperation {
+ constructor(collection, options) {
+ super(collection, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.CursorResponse;
+ this.options = { ...options };
+ delete this.options.writeConcern;
+ this.collectionNamespace = collection.s.namespace;
+ }
+ get commandName() {
+ return 'listIndexes';
+ }
+ buildCommandDocument(connection) {
+ const serverWireVersion = (0, utils_1.maxWireVersion)(connection);
+ const cursor = this.options.batchSize ? { batchSize: this.options.batchSize } : {};
+ const command = { listIndexes: this.collectionNamespace.collection, cursor };
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (serverWireVersion >= 9 && this.options.comment !== undefined) {
+ command.comment = this.options.comment;
+ }
+ return command;
+ }
+ handleOk(response) {
+ return response;
+ }
+}
+exports.ListIndexesOperation = ListIndexesOperation;
+(0, operation_1.defineAspects)(ListIndexesOperation, [
+ operation_1.Aspect.READ_OPERATION,
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.CURSOR_CREATING,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+(0, operation_1.defineAspects)(CreateIndexesOperation, [operation_1.Aspect.WRITE_OPERATION, operation_1.Aspect.SUPPORTS_RAW_DATA]);
+(0, operation_1.defineAspects)(DropIndexOperation, [operation_1.Aspect.WRITE_OPERATION, operation_1.Aspect.SUPPORTS_RAW_DATA]);
+//# sourceMappingURL=indexes.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/indexes.js.map b/node_modules/mongodb/lib/operations/indexes.js.map
new file mode 100644
index 00000000..933ba211
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/indexes.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"indexes.js","sourceRo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AAE,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;QAEvF,iEAAiE;QACjE,gDAAgD;QAChD,IAAI,iBAAiB,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACjE,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACzC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAEQ,QAAQ,CACf,QAAgE;QAEhE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA7CD,oDA6CC;AAED,IAAA,yBAAa,EAAC,oBAAoB,EAAE;IAClC,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC;AACH,IAAA,yBAAa,EAAC,sBAAsB,EAAE,CAAC,kBAAM,CAAC,eAAe,EAAE,kBAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAC1F,IAAA,yBAAa,EAAC,kBAAkB,EAAE,CAAC,kBAAM,CAAC,eAAe,EAAE,kBAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/insert.js b/node_modules/mongodb/lib/operations/insert.js
new file mode 100644
index 00000000..ae5dfeb5
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/insert.js
@@ -0,0 +1,70 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.InsertOneOperation = exports.InsertOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class InsertOperation extends command_1.CommandOperation {
+ constructor(ns, documents, options) {
+ super(undefined, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = { ...options, checkKeys: options.checkKeys ?? false };
+ this.ns = ns;
+ this.documents = documents;
+ }
+ get commandName() {
+ return 'insert';
+ }
+ buildCommandDocument(_connection, _session) {
+ const options = this.options ?? {};
+ const ordered = typeof options.ordered === 'boolean' ? options.ordered : true;
+ const command = {
+ insert: this.ns.collection,
+ documents: this.documents,
+ ordered
+ };
+ if (typeof options.bypassDocumentValidation === 'boolean') {
+ command.bypassDocumentValidation = options.bypassDocumentValidation;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (options.comment !== undefined) {
+ command.comment = options.comment;
+ }
+ return command;
+ }
+}
+exports.InsertOperation = InsertOperation;
+class InsertOneOperation extends InsertOperation {
+ constructor(collection, doc, options) {
+ super(collection.s.namespace, [(0, utils_1.maybeAddIdToDocuments)(collection, doc, options)], options);
+ }
+ handleOk(response) {
+ const res = super.handleOk(response);
+ if (res.code)
+ throw new error_1.MongoServerError(res);
+ if (res.writeErrors) {
+ // This should be a WriteError but we can't change it now because of error hierarchy
+ throw new error_1.MongoServerError(res.writeErrors[0]);
+ }
+ return {
+ acknowledged: this.writeConcern?.w !== 0,
+ insertedId: this.documents[0]._id
+ };
+ }
+}
+exports.InsertOneOperation = InsertOneOperation;
+(0, operation_1.defineAspects)(InsertOperation, [
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+(0, operation_1.defineAspects)(InsertOneOperation, [
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=insert.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/insert.js.map b/node_modules/mongodb/lib/operations/insert.js.map
new file mode 100644
index 00000000..f398a08d
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/insert.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"insert.js","sourceRoot":"","sources":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;AAtCD,0CAsCC;AAkBD,MAAa,kBAAmB,SAAQ,eAAe;IACrD,YAAY,UAAsB,EAAE,GAAa,EAAE,OAAyB;QAC1E,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,IAAA,6BAAqB,EAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5F,CAAC;IAEQ,QAAQ,CAAC,QAAgE;QAChF,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,GAAG,CAAC,IAAI;YAAE,MAAM,IAAI,wBAAgB,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;YACpB,oFAAoF;YACpF,MAAM,IAAI,wBAAgB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC;YACxC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG;SAClC,CAAC;IACJ,CAAC;CACF;AAlBD,gDAkBC;AAYD,IAAA,yBAAa,EAAC,eAAe,EAAE;IAC7B,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC;AACH,IAAA,yBAAa,EAAC,kBAAkB,EAAE;IAChC,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/kill_cursors.js b/node_modules/mongodb/lib/operations/kill_cursors.js
new file mode 100644
index 00000000..6b883705
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/kill_cursors.js
@@ -0,0 +1,43 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.KillCursorsOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const operation_1 = require("./operation");
+class KillCursorsOperation extends operation_1.AbstractOperation {
+ constructor(cursorId, ns, server, options) {
+ super(options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.ns = ns;
+ this.cursorId = cursorId;
+ this.server = server;
+ }
+ get commandName() {
+ return 'killCursors';
+ }
+ buildCommand(_connection, _session) {
+ const killCursors = this.ns.collection;
+ if (killCursors == null) {
+ // Cursors should have adopted the namespace returned by MongoDB
+ // which should always defined a collection name (even a pseudo one, ex. db.aggregate())
+ throw new error_1.MongoRuntimeError('A collection name must be determined before killCursors');
+ }
+ const killCursorsCommand = {
+ killCursors,
+ cursors: [this.cursorId]
+ };
+ return killCursorsCommand;
+ }
+ buildOptions(timeoutContext) {
+ return {
+ session: this.session,
+ timeoutContext
+ };
+ }
+ handleError(_error) {
+ // The driver should never emit errors from killCursors, this is spec-ed behavior
+ }
+}
+exports.KillCursorsOperation = KillCursorsOperation;
+(0, operation_1.defineAspects)(KillCursorsOperation, [operation_1.Aspect.MUST_SELECT_SAME_SERVER]);
+//# sourceMappingURL=kill_cursors.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/kill_cursors.js.map b/node_modules/mongodb/lib/operations/kill_cursors.js.map
new file mode 100644
index 00000000..093ce1f6
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/kill_cursors.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kill_cursors.js","sourceRoot":"","sources":["../../src/operations/kill_cursors.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAClE,oCAA8D;AAK9D,2CAA8F;AAY9F,MAAa,oBAAqB,SAAQ,6BAAuB;IAI/D,YAAY,QAAc,EAAE,EAAoB,EAAE,MAAc,EAAE,OAAyB;QACzF,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,iCAA4B,GAAG,2BAAe,CAAC;QAKtD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,aAAsB,CAAC;IAChC,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC;QACvC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;YACxB,gEAAgE;YAChE,wFAAwF;YACxF,MAAM,IAAI,yBAAiB,CAAC,yDAAyD,CAAC,CAAC;QACzF,CAAC;QAED,MAAM,kBAAkB,GAAuB;YAC7C,WAAW;YACX,OAAO,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;SACzB,CAAC;QAEF,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,cAAc;SACf,CAAC;IACJ,CAAC;IAEQ,WAAW,CAAC,MAAkB;QACrC,iFAAiF;IACnF,CAAC;CACF;AAzCD,oDAyCC;AAED,IAAA,yBAAa,EAAC,oBAAoB,EAAE,CAAC,kBAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/list_collections.js b/node_modules/mongodb/lib/operations/list_collections.js
new file mode 100644
index 00000000..ca30613d
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/list_collections.js
@@ -0,0 +1,53 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ListCollectionsOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class ListCollectionsOperation extends command_1.CommandOperation {
+ constructor(db, filter, options) {
+ super(db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.CursorResponse;
+ this.options = { ...options };
+ delete this.options.writeConcern;
+ this.db = db;
+ this.filter = filter;
+ this.nameOnly = !!this.options.nameOnly;
+ this.authorizedCollections = !!this.options.authorizedCollections;
+ if (typeof this.options.batchSize === 'number') {
+ this.batchSize = this.options.batchSize;
+ }
+ this.SERVER_COMMAND_RESPONSE_TYPE = this.explain ? responses_1.ExplainedCursorResponse : responses_1.CursorResponse;
+ }
+ get commandName() {
+ return 'listCollections';
+ }
+ buildCommandDocument(connection) {
+ const command = {
+ listCollections: 1,
+ filter: this.filter,
+ cursor: this.batchSize ? { batchSize: this.batchSize } : {},
+ nameOnly: this.nameOnly,
+ authorizedCollections: this.authorizedCollections
+ };
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if ((0, utils_1.maxWireVersion)(connection) >= 9 && this.options.comment !== undefined) {
+ command.comment = this.options.comment;
+ }
+ return command;
+ }
+ handleOk(response) {
+ return response;
+ }
+}
+exports.ListCollectionsOperation = ListCollectionsOperation;
+(0, operation_1.defineAspects)(ListCollectionsOperation, [
+ operation_1.Aspect.READ_OPERATION,
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.CURSOR_CREATING,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=list_collections.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/list_collections.js.map b/node_modules/mongodb/lib/operations/list_collections.js.map
new file mode 100644
index 00000000..8d0a045d
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/list_collections.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"list_collections.js","sourceRoot":"","sources":["../../src/operations/list_collections.ts"],"names":[],"mappings":";;;AAEA,+DAA0F;AAI1F,oCAA0C;AAC1C,uCAA2E;AAC3E,2CAAoD;AAmBpD,gBAAgB;AAChB,MAAa,wBAAyB,SAAQ,0BAAgC;IAgB5E,YAAY,EAAM,EAAE,MAAgB,EAAE,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SAAS,EAAE,CAAC;YAC1E,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACzC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAEQ,QAAQ,CACf,QAAgE;QAEhE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA5DD,4DA4DC;AAcD,IAAA,yBAAa,EAAC,wBAAwB,EAAE;IACtC,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/list_databases.js b/node_modules/mongodb/lib/operations/list_databases.js
new file mode 100644
index 00000000..d34f2fd8
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/list_databases.js
@@ -0,0 +1,40 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ListDatabasesOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class ListDatabasesOperation extends command_1.CommandOperation {
+ constructor(db, options) {
+ super(db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options ?? {};
+ this.ns = new utils_1.MongoDBNamespace('admin', '$cmd');
+ }
+ get commandName() {
+ return 'listDatabases';
+ }
+ buildCommandDocument(connection, _session) {
+ const cmd = { listDatabases: 1 };
+ if (typeof this.options.nameOnly === 'boolean') {
+ cmd.nameOnly = this.options.nameOnly;
+ }
+ if (this.options.filter) {
+ cmd.filter = this.options.filter;
+ }
+ if (typeof this.options.authorizedDatabases === 'boolean') {
+ cmd.authorizedDatabases = this.options.authorizedDatabases;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if ((0, utils_1.maxWireVersion)(connection) >= 9 && this.options.comment !== undefined) {
+ cmd.comment = this.options.comment;
+ }
+ return cmd;
+ }
+}
+exports.ListDatabasesOperation = ListDatabasesOperation;
+(0, operation_1.defineAspects)(ListDatabasesOperation, [operation_1.Aspect.READ_OPERATION, operation_1.Aspect.RETRYABLE]);
+//# sourceMappingURL=list_databases.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/list_databases.js.map b/node_modules/mongodb/lib/operations/list_databases.js.map
new file mode 100644
index 00000000..e045fda4
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/list_databases.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"list_databases.js","sourceRoot":"","sources":["../../src/operations/list_databases.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAGlE,oCAA4D;AAC5D,uCAA2E;AAC3E,2CAAoD;AAoBpD,gBAAgB;AAChB,MAAa,sBAAuB,SAAQ,0BAAqC;IAI/E,YAAY,EAAM,EAAE,OAA8B;QAChD,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAJZ,iCAA4B,GAAG,2BAAe,CAAC;QAKtD,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,IAAI,wBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,eAAwB,CAAC;IAClC,CAAC;IAEQ,oBAAoB,CAAC,UAAsB,EAAE,QAAwB;QAC5E,MAAM,GAAG,GAAa,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;QAE3C,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC/C,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACvC,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACxB,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACnC,CAAC;QAED,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAC1D,GAAG,CAAC,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC;QAC7D,CAAC;QAED,iEAAiE;QACjE,gDAAgD;QAChD,IAAI,IAAA,sBAAc,EAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1E,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACrC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AArCD,wDAqCC;AAED,IAAA,yBAAa,EAAC,sBAAsB,EAAE,CAAC,kBAAM,CAAC,cAAc,EAAE,kBAAM,CAAC,SAAS,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/operation.js b/node_modules/mongodb/lib/operations/operation.js
new file mode 100644
index 00000000..028cd87f
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/operation.js
@@ -0,0 +1,103 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AbstractOperation = exports.Aspect = void 0;
+exports.defineAspects = defineAspects;
+const bson_1 = require("../bson");
+const read_preference_1 = require("../read_preference");
+exports.Aspect = {
+ READ_OPERATION: Symbol('READ_OPERATION'),
+ WRITE_OPERATION: Symbol('WRITE_OPERATION'),
+ RETRYABLE: Symbol('RETRYABLE'),
+ EXPLAINABLE: Symbol('EXPLAINABLE'),
+ SKIP_COLLATION: Symbol('SKIP_COLLATION'),
+ CURSOR_CREATING: Symbol('CURSOR_CREATING'),
+ MUST_SELECT_SAME_SERVER: Symbol('MUST_SELECT_SAME_SERVER'),
+ COMMAND_BATCHING: Symbol('COMMAND_BATCHING'),
+ SUPPORTS_RAW_DATA: Symbol('SUPPORTS_RAW_DATA')
+};
+/**
+ * This class acts as a parent class for any operation and is responsible for setting this.options,
+ * as well as setting and getting a session.
+ * Additionally, this class implements `hasAspect`, which determines whether an operation has
+ * a specific aspect.
+ * @internal
+ */
+class AbstractOperation {
+ constructor(options = {}) {
+ this.readPreference = this.hasAspect(exports.Aspect.WRITE_OPERATION)
+ ? read_preference_1.ReadPreference.primary
+ : (read_preference_1.ReadPreference.fromOptions(options) ?? read_preference_1.ReadPreference.primary);
+ // Pull the BSON serialize options from the already-resolved options
+ this.bsonOptions = (0, bson_1.resolveBSONOptions)(options);
+ this._session = options.session != null ? options.session : undefined;
+ this.options = options;
+ this.bypassPinningCheck = !!options.bypassPinningCheck;
+ this.attemptsMade = 0;
+ }
+ hasAspect(aspect) {
+ const ctor = this.constructor;
+ if (ctor.aspects == null) {
+ return false;
+ }
+ return ctor.aspects.has(aspect);
+ }
+ // Make sure the session is not writable from outside this class.
+ get session() {
+ return this._session;
+ }
+ set session(session) {
+ this._session = session;
+ }
+ clearSession() {
+ this._session = undefined;
+ }
+ resetBatch() {
+ return true;
+ }
+ get canRetryRead() {
+ return this.hasAspect(exports.Aspect.RETRYABLE) && this.hasAspect(exports.Aspect.READ_OPERATION);
+ }
+ get canRetryWrite() {
+ return this.hasAspect(exports.Aspect.RETRYABLE) && this.hasAspect(exports.Aspect.WRITE_OPERATION);
+ }
+ /**
+ * Given an instance of a MongoDBResponse, map the response to the correct result type. For
+ * example, a `CountOperation` might map the response as follows:
+ *
+ * ```typescript
+ * override handleOk(response: InstanceType): TResult {
+ * return response.toObject(this.bsonOptions).n ?? 0;
+ * }
+ *
+ * // or, with type safety:
+ * override handleOk(response: InstanceType): TResult {
+ * return response.getNumber('n') ?? 0;
+ * }
+ * ```
+ */
+ handleOk(response) {
+ return response.toObject(this.bsonOptions);
+ }
+ /**
+ * Optional.
+ *
+ * If the operation performs error handling, such as wrapping, renaming the error, or squashing errors
+ * this method can be overridden.
+ */
+ handleError(error) {
+ throw error;
+ }
+}
+exports.AbstractOperation = AbstractOperation;
+function defineAspects(operation, aspects) {
+ if (!Array.isArray(aspects) && !(aspects instanceof Set)) {
+ aspects = [aspects];
+ }
+ aspects = new Set(aspects);
+ Object.defineProperty(operation, 'aspects', {
+ value: aspects,
+ writable: false
+ });
+ return aspects;
+}
+//# sourceMappingURL=operation.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/operation.js.map b/node_modules/mongodb/lib/operations/operation.js.map
new file mode 100644
index 00000000..78a6c91b
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/operation.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../src/operations/operation.ts"],"names":[],"mappings":";;;AA6KA,sCAeC;AA3LD,kCAAuF;AAGvF,wDAA6E;AAMhE,QAAA,MAAM,GAAG;IACpB,cAAc,EAAE,MAAM,CAAC,gBAAgB,CAAC;IACxC,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC,aAAa,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC,gBAAgB,CAAC;IACxC,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAC1C,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,gBAAgB,EAAE,MAAM,CAAC,kBAAkB,CAAC;IAC5C,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC;CACtC,CAAC;AA2BX;;;;;;GAMG;AACH,MAAsB,iBAAiB;IAwBrC,YAAY,UAAwC,EAAE;QACpD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,cAAM,CAAC,eAAe,CAAC;YAC1D,CAAC,CAAC,gCAAc,CAAC,OAAO;YACxB,CAAC,CAAC,CAAC,gCAAc,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,gCAAc,CAAC,OAAO,CAAC,CAAC;QAEpE,oEAAoE;QACpE,IAAI,CAAC,WAAW,GAAG,IAAA,yBAAkB,EAA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AC,WAAW,CAAY,CAAC;IACxD,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,KAAiB;QAC3B,MAAM,KAAK,CAAC;IACd,CAAC;CACF;AArHD,8CAqHC;AAED,SAAgB,aAAa,CAC3B,SAAoC,EACpC,OAAwC;IAExC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,YAAY,GAAG,CAAC,EAAE,CAAC;QACzD,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3B,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE;QAC1C,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/profiling_level.js b/node_modules/mongodb/lib/operations/profiling_level.js
new file mode 100644
index 00000000..f2d97d45
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/profiling_level.js
@@ -0,0 +1,43 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ProfilingLevelOperation = void 0;
+const bson_1 = require("../bson");
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const command_1 = require("./command");
+class ProfilingLevelResponse extends responses_1.MongoDBResponse {
+ get was() {
+ return this.get('was', bson_1.BSONType.int, true);
+ }
+}
+/** @internal */
+class ProfilingLevelOperation extends command_1.CommandOperation {
+ constructor(db, options) {
+ super(db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = ProfilingLevelResponse;
+ this.options = options;
+ }
+ get commandName() {
+ return 'profile';
+ }
+ buildCommandDocument(_connection) {
+ return { profile: -1 };
+ }
+ handleOk(response) {
+ if (response.ok === 1) {
+ const was = response.was;
+ if (was === 0)
+ return 'off';
+ if (was === 1)
+ return 'slow_only';
+ if (was === 2)
+ return 'all';
+ throw new error_1.MongoUnexpectedServerResponseError(`Illegal profiling level value ${was}`);
+ }
+ else {
+ throw new error_1.MongoUnexpectedServerResponseError('Error with profile command');
+ }
+ }
+}
+exports.ProfilingLevelOperation = ProfilingLevelOperation;
+//# sourceMappingURL=profiling_level.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/profiling_level.js.map b/node_modules/mongodb/lib/operations/profiling_level.js.map
new file mode 100644
index 00000000..9e3f982c
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/profiling_level.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"profiling_level.js","sourceRoot":"","sources":["../../src/operations/profiling_level.ts"],"names":[],"mappings":";;;AAAA,kCAAkD;AAElD,+DAAkE;AAElE,oCAA8D;AAC9D,uCAA2E;AAK3E,MAAM,sBAAuB,SAAQ,2BAAe;IAClD,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,eAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,gBAAgB;AAChB,MAAa,uBAAwB,SAAQ,0BAAwB;IAInE,YAAY,EAAM,EAAE,OAA8B;QAChD,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAJZ,iCAA4B,GAAG,sBAAsB,CAAC;QAK7D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,SAAkB,CAAC;IAC5B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB;QACnD,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC;IACzB,CAAC;IAEQ,QAAQ,CAAC,QAAgE;QAChF,IAAI,QAAQ,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;YACzB,IAAI,GAAG,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC5B,IAAI,GAAG,KAAK,CAAC;gBAAE,OAAO,WAAW,CAAC;YAClC,IAAI,GAAG,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC5B,MAAM,IAAI,0CAAkC,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;QACvF,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,0CAAkC,CAAC,4BAA4B,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF;AA5BD,0DA4BC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/remove_user.js b/node_modules/mongodb/lib/operations/remove_user.js
new file mode 100644
index 00000000..b45c3bd6
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/remove_user.js
@@ -0,0 +1,27 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.RemoveUserOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class RemoveUserOperation extends command_1.CommandOperation {
+ constructor(db, username, options) {
+ super(db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ this.username = username;
+ }
+ get commandName() {
+ return 'dropUser';
+ }
+ buildCommandDocument(_connection) {
+ return { dropUser: this.username };
+ }
+ handleOk(_response) {
+ return true;
+ }
+}
+exports.RemoveUserOperation = RemoveUserOperation;
+(0, operation_1.defineAspects)(RemoveUserOperation, [operation_1.Aspect.WRITE_OPERATION]);
+//# sourceMappingURL=remove_user.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/remove_user.js.map b/node_modules/mongodb/lib/operations/remove_user.js.map
new file mode 100644
index 00000000..ff572dcf
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/remove_user.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"remove_user.js","sourceRoot":"","sources":["../../src/operations/remove_user.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAElE,uCAA2E;AAC3E,2CAAoD;AAKpD,gBAAgB;AAChB,MAAa,mBAAoB,SAAQ,0BAAyB;IAKhE,YAAY,EAAM,EAAE,QAAgB,EAAE,OAA0B;QAC9D,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QALZ,iCAA4B,GAAG,2BAAe,CAAC;QAMtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,UAAmB,CAAC;IAC7B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB;QACnD,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;IACrC,CAAC;IAEQ,QAAQ,CAAC,SAAiE;QACjF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAtBD,kDAsBC;AAED,IAAA,yBAAa,EAAC,mBAAmB,EAAE,CAAC,kBAAM,CAAC,eAAe,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/rename.js b/node_modules/mongodb/lib/operations/rename.js
new file mode 100644
index 00000000..05b2fe41
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/rename.js
@@ -0,0 +1,38 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.RenameOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const collection_1 = require("../collection");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class RenameOperation extends command_1.CommandOperation {
+ constructor(collection, newName, options) {
+ super(collection, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.collection = collection;
+ this.newName = newName;
+ this.options = options;
+ this.ns = new utils_1.MongoDBNamespace('admin', '$cmd');
+ }
+ get commandName() {
+ return 'renameCollection';
+ }
+ buildCommandDocument(_connection, _session) {
+ const renameCollection = this.collection.namespace;
+ const to = this.collection.s.namespace.withCollection(this.newName).toString();
+ const dropTarget = typeof this.options.dropTarget === 'boolean' ? this.options.dropTarget : false;
+ return {
+ renameCollection,
+ to,
+ dropTarget
+ };
+ }
+ handleOk(_response) {
+ return new collection_1.Collection(this.collection.db, this.newName, this.collection.s.options);
+ }
+}
+exports.RenameOperation = RenameOperation;
+(0, operation_1.defineAspects)(RenameOperation, [operation_1.Aspect.WRITE_OPERATION]);
+//# sourceMappingURL=rename.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/rename.js.map b/node_modules/mongodb/lib/operations/rename.js.map
new file mode 100644
index 00000000..866b66e1
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/rename.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"rename.js","sourceRoot":"","sources":["../../src/operations/rename.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAClE,8CAA2C;AAE3C,oCAA4C;AAC5C,uCAA2E;AAC3E,2CAAoD;AAepD,gBAAgB;AAChB,MAAa,eAAgB,SAAQ,0BAA0B;IAM7D,YAAY,UAAsB,EAAE,OAAe,EAAE,OAAsB;QACzE,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QANpB,iCAA4B,GAAG,2BAAe,CAAC;QAOtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,IAAI,wBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,kBAA2B,CAAC;IACrC,CAAC;IAEQ,oBAAoB,CAAC,WAAuB,EAAE,QAAwB;QAC7E,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QACnD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC/E,MAAM,UAAU,GACd,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;QAEjF,OAAO;YACL,gBAAgB;YAChB,EAAE;YACF,UAAU;SACX,CAAC;IACJ,CAAC;IAEQ,QAAQ,CAAC,SAAiE;QACjF,OAAO,IAAI,uBAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACrF,CAAC;CACF;AAlCD,0CAkCC;AAED,IAAA,yBAAa,EAAC,eAAe,EAAE,CAAC,kBAAM,CAAC,eAAe,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/run_command.js b/node_modules/mongodb/lib/operations/run_command.js
new file mode 100644
index 00000000..67301d1f
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/run_command.js
@@ -0,0 +1,47 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.RunCursorCommandOperation = exports.RunCommandOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const operation_1 = require("../operations/operation");
+/** @internal */
+class RunCommandOperation extends operation_1.AbstractOperation {
+ constructor(namespace, command, options) {
+ super(options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.command = command;
+ this.options = options;
+ this.ns = namespace.withCollection('$cmd');
+ }
+ get commandName() {
+ return 'runCommand';
+ }
+ buildCommand(_connection, _session) {
+ return this.command;
+ }
+ buildOptions(timeoutContext) {
+ return {
+ ...this.options,
+ session: this.session,
+ timeoutContext,
+ signal: this.options.signal,
+ readPreference: this.options.readPreference
+ };
+ }
+}
+exports.RunCommandOperation = RunCommandOperation;
+/**
+ * @internal
+ *
+ * A specialized subclass of RunCommandOperation for cursor-creating commands.
+ */
+class RunCursorCommandOperation extends RunCommandOperation {
+ constructor() {
+ super(...arguments);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.CursorResponse;
+ }
+ handleOk(response) {
+ return response;
+ }
+}
+exports.RunCursorCommandOperation = RunCursorCommandOperation;
+//# sourceMappingURL=run_command.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/run_command.js.map b/node_modules/mongodb/lib/operations/run_command.js.map
new file mode 100644
index 00000000..a86ee7c5
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/run_command.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"run_command.js","sourceRoot":"","sources":["../../src/operations/run_command.ts"],"names":[],"mappings":";;;AAGA,+DAAkF;AAClF,uDAA4D;AA6B5D,gBAAgB;AAChB,MAAa,mBAAkC,SAAQ,6BAAoB;IAKzE,YAAY,SAA2B,EAAE,OAAiB,EAAE,OAA0B;QACpF,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,iCAA4B,GAAG,2BAAe,CAAC;QAMtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,YAAqB,CAAC;IAC/B,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO;YACL,GAAG,IAAI,CAAC,OAAO;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,cAAc;YACd,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;SAC5C,CAAC;IACJ,CAAC;CACF;AA7BD,kDA6BC;AAED;;;;GAIG;AACH,MAAa,yBAA0B,SAAQ,mBAAmB;IAAlE;;QACW,iCAA4B,GAAG,0BAAc,CAAC;IAOzD,CAAC;IALU,QAAQ,CACf,QAAgE;QAEhE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AARD,8DAQC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/search_indexes/create.js b/node_modules/mongodb/lib/operations/search_indexes/create.js
new file mode 100644
index 00000000..83fb086e
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/search_indexes/create.js
@@ -0,0 +1,33 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.CreateSearchIndexesOperation = void 0;
+const responses_1 = require("../../cmap/wire_protocol/responses");
+const operation_1 = require("../operation");
+/** @internal */
+class CreateSearchIndexesOperation extends operation_1.AbstractOperation {
+ constructor(collection, descriptions) {
+ super();
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.collection = collection;
+ this.descriptions = descriptions;
+ this.ns = collection.fullNamespace;
+ }
+ get commandName() {
+ return 'createSearchIndexes';
+ }
+ buildCommand(_connection, _session) {
+ const namespace = this.collection.fullNamespace;
+ return {
+ createSearchIndexes: namespace.collection,
+ indexes: this.descriptions
+ };
+ }
+ handleOk(response) {
+ return super.handleOk(response).indexesCreated.map((val) => val.name);
+ }
+ buildOptions(timeoutContext) {
+ return { session: this.session, timeoutContext };
+ }
+}
+exports.CreateSearchIndexesOperation = CreateSearchIndexesOperation;
+//# sourceMappingURL=create.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/search_indexes/create.js.map b/node_modules/mongodb/lib/operations/search_indexes/create.js.map
new file mode 100644
index 00000000..78a9826e
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/search_indexes/create.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/operations/search_indexes/create.ts"],"names":[],"mappings":";;;AAEA,kEAAqE;AAKrE,4CAAiD;AAgBjD,gBAAgB;AAChB,MAAa,4BAA6B,SAAQ,6BAA2B;IAK3E,YAAY,UAAsB,EAAE,YAAmD;QACrF,KAAK,EAAE,CAAC;QALD,iCAA4B,GAAG,2BAAe,CAAC;QAMtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC;IACrC,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,qBAA8B,CAAC;IACxC,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAChD,OAAO;YACL,mBAAmB,EAAE,SAAS,CAAC,UAAU;YACzC,OAAO,EAAE,IAAI,CAAC,YAAY;SAC3B,CAAC;IACJ,CAAC;IAEQ,QAAQ,CAAC,QAAgE;QAChF,OAAO,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAqB,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1F,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnD,CAAC;CACF;AA/BD,oEA+BC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/search_indexes/drop.js b/node_modules/mongodb/lib/operations/search_indexes/drop.js
new file mode 100644
index 00000000..8d9d3f71
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/search_indexes/drop.js
@@ -0,0 +1,43 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.DropSearchIndexOperation = void 0;
+const responses_1 = require("../../cmap/wire_protocol/responses");
+const error_1 = require("../../error");
+const operation_1 = require("../operation");
+/** @internal */
+class DropSearchIndexOperation extends operation_1.AbstractOperation {
+ constructor(collection, name) {
+ super();
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.collection = collection;
+ this.name = name;
+ this.ns = collection.fullNamespace;
+ }
+ get commandName() {
+ return 'dropSearchIndex';
+ }
+ buildCommand(_connection, _session) {
+ const namespace = this.collection.fullNamespace;
+ const command = {
+ dropSearchIndex: namespace.collection
+ };
+ if (typeof this.name === 'string') {
+ command.name = this.name;
+ }
+ return command;
+ }
+ handleOk(_response) {
+ // do nothing
+ }
+ buildOptions(timeoutContext) {
+ return { session: this.session, timeoutContext };
+ }
+ handleError(error) {
+ const isNamespaceNotFoundError = error instanceof error_1.MongoServerError && error.code === error_1.MONGODB_ERROR_CODES.NamespaceNotFound;
+ if (!isNamespaceNotFoundError) {
+ throw error;
+ }
+ }
+}
+exports.DropSearchIndexOperation = DropSearchIndexOperation;
+//# sourceMappingURL=drop.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/search_indexes/drop.js.map b/node_modules/mongodb/lib/operations/search_indexes/drop.js.map
new file mode 100644
index 00000000..948598da
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/search_indexes/drop.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"drop.js","sourceRoot":"","sources":["../../../src/operations/search_indexes/drop.ts"],"names":[],"mappings":";;;AAEA,kEAAqE;AAErE,uCAAoE;AAIpE,4CAAiD;AAEjD,gBAAgB;AAChB,MAAa,wBAAyB,SAAQ,6BAAuB;IAMnE,YAAY,UAAsB,EAAE,IAAY;QAC9C,KAAK,EAAE,CAAC;QAND,iCAA4B,GAAG,2BAAe,CAAC;QAOtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC;IACrC,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,iBAA0B,CAAC;IACpC,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAEhD,MAAM,OAAO,GAAa;YACxB,eAAe,EAAE,SAAS,CAAC,UAAU;SACtC,CAAC;QAEF,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3B,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAEQ,QAAQ,CAAC,SAA0B;QAC1C,aAAa;IACf,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnD,CAAC;IAEQ,WAAW,CAAC,KAAiB;QACpC,MAAM,wBAAwB,GAC5B,KAAK,YAAY,wBAAgB,IAAI,KAAK,CAAC,IAAI,KAAK,2BAAmB,CAAC,iBAAiB,CAAC;QAC5F,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA9CD,4DA8CC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/search_indexes/update.js b/node_modules/mongodb/lib/operations/search_indexes/update.js
new file mode 100644
index 00000000..7cc00ceb
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/search_indexes/update.js
@@ -0,0 +1,35 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.UpdateSearchIndexOperation = void 0;
+const responses_1 = require("../../cmap/wire_protocol/responses");
+const operation_1 = require("../operation");
+/** @internal */
+class UpdateSearchIndexOperation extends operation_1.AbstractOperation {
+ constructor(collection, name, definition) {
+ super();
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.collection = collection;
+ this.name = name;
+ this.definition = definition;
+ this.ns = collection.fullNamespace;
+ }
+ get commandName() {
+ return 'updateSearchIndex';
+ }
+ buildCommand(_connection, _session) {
+ const namespace = this.collection.fullNamespace;
+ return {
+ updateSearchIndex: namespace.collection,
+ name: this.name,
+ definition: this.definition
+ };
+ }
+ handleOk(_response) {
+ // no response.
+ }
+ buildOptions(timeoutContext) {
+ return { session: this.session, timeoutContext };
+ }
+}
+exports.UpdateSearchIndexOperation = UpdateSearchIndexOperation;
+//# sourceMappingURL=update.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/search_indexes/update.js.map b/node_modules/mongodb/lib/operations/search_indexes/update.js.map
new file mode 100644
index 00000000..905e563e
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/search_indexes/update.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/operations/search_indexes/update.ts"],"names":[],"mappings":";;;AAEA,kEAAqE;AAKrE,4CAAiD;AAEjD,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,6BAAuB;IAMrE,YAAY,UAAsB,EAAE,IAAY,EAAE,UAAoB;QACpE,KAAK,EAAE,CAAC;QAND,iCAA4B,GAAG,2BAAe,CAAC;QAOtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC;IACrC,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,mBAA4B,CAAC;IACtC,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAChD,OAAO;YACL,iBAAiB,EAAE,SAAS,CAAC,UAAU;YACvC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;IACJ,CAAC;IAEQ,QAAQ,CAAC,SAA0B;QAC1C,eAAe;IACjB,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnD,CAAC;CACF;AAlCD,gEAkCC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/set_profiling_level.js b/node_modules/mongodb/lib/operations/set_profiling_level.js
new file mode 100644
index 00000000..22d697e7
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/set_profiling_level.js
@@ -0,0 +1,53 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.SetProfilingLevelOperation = exports.ProfilingLevel = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const levelValues = new Set(['off', 'slow_only', 'all']);
+/** @public */
+exports.ProfilingLevel = Object.freeze({
+ off: 'off',
+ slowOnly: 'slow_only',
+ all: 'all'
+});
+/** @internal */
+class SetProfilingLevelOperation extends command_1.CommandOperation {
+ constructor(db, level, options) {
+ super(db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ switch (level) {
+ case exports.ProfilingLevel.off:
+ this.profile = 0;
+ break;
+ case exports.ProfilingLevel.slowOnly:
+ this.profile = 1;
+ break;
+ case exports.ProfilingLevel.all:
+ this.profile = 2;
+ break;
+ default:
+ this.profile = 0;
+ break;
+ }
+ this.level = level;
+ }
+ get commandName() {
+ return 'profile';
+ }
+ buildCommandDocument(_connection) {
+ const level = this.level;
+ if (!levelValues.has(level)) {
+ // TODO(NODE-3483): Determine error to put here
+ throw new error_1.MongoInvalidArgumentError(`Profiling level must be one of "${(0, utils_1.enumToString)(exports.ProfilingLevel)}"`);
+ }
+ return { profile: this.profile };
+ }
+ handleOk(_response) {
+ return this.level;
+ }
+}
+exports.SetProfilingLevelOperation = SetProfilingLevelOperation;
+//# sourceMappingURL=set_profiling_level.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/set_profiling_level.js.map b/node_modules/mongodb/lib/operations/set_profiling_level.js.map
new file mode 100644
index 00000000..9dad8733
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/set_profiling_level.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"set_profiling_level.js","sourceRoot":"","sources":["../../src/operations/set_profiling_level.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAElE,oCAAqD;AACrD,oCAAwC;AACxC,uCAA2E;AAE3E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;AAEzD,cAAc;AACD,QAAA,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1C,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,WAAW;IACrB,GAAG,EAAE,KAAK;CACF,CAAC,CAAC;AAQZ,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,0BAAgC;IAM9E,YAAY,EAAM,EAAE,KAAqB,EAAE,OAAiC;QAC1E,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QANZ,iCAA4B,GAAG,2BAAe,CAAC;QAOtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,QAAQ,KAAK,EAAE,CAAC;YACd,KAAK,sBAAc,CAAC,GAAG;gBACrB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;gBACjB,MAAM;YACR,KAAK,sBAAc,CAAC,QAAQ;gBAC1B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;gBACjB,MAAM;YACR,KAAK,sBAAc,CAAC,GAAG;gBACrB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;gBACjB,MAAM;YACR;gBACE,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;gBACjB,MAAM;QACV,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,SAAkB,CAAC;IAC5B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,+CAA+C;YAC/C,MAAM,IAAI,iCAAyB,CACjC,mCAAmC,IAAA,oBAAY,EAAC,sBAAc,CAAC,GAAG,CACnE,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAEQ,QAAQ,CACf,SAAiE;QAEjE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAjDD,gEAiDC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/stats.js b/node_modules/mongodb/lib/operations/stats.js
new file mode 100644
index 00000000..bd844772
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/stats.js
@@ -0,0 +1,27 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.DbStatsOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/** @internal */
+class DbStatsOperation extends command_1.CommandOperation {
+ constructor(db, options) {
+ super(db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ }
+ get commandName() {
+ return 'dbStats';
+ }
+ buildCommandDocument(_connection) {
+ const command = { dbStats: true };
+ if (this.options.scale != null) {
+ command.scale = this.options.scale;
+ }
+ return command;
+ }
+}
+exports.DbStatsOperation = DbStatsOperation;
+(0, operation_1.defineAspects)(DbStatsOperation, [operation_1.Aspect.READ_OPERATION]);
+//# sourceMappingURL=stats.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/stats.js.map b/node_modules/mongodb/lib/operations/stats.js.map
new file mode 100644
index 00000000..b3b586f9
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/stats.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/operations/stats.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAElE,uCAA2E;AAC3E,2CAAoD;AAQpD,gBAAgB;AAChB,MAAa,gBAAiB,SAAQ,0BAA0B;IAI9D,YAAY,EAAM,EAAE,OAAuB;QACzC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAJZ,iCAA4B,GAAG,2BAAe,CAAC;QAKtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,SAAkB,CAAC;IAC5B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB;QACnD,MAAM,OAAO,GAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC5C,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;YAC/B,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACrC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AApBD,4CAoBC;AAED,IAAA,yBAAa,EAAC,gBAAgB,EAAE,CAAC,kBAAM,CAAC,cAAc,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/update.js b/node_modules/mongodb/lib/operations/update.js
new file mode 100644
index 00000000..d4f003f9
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/update.js
@@ -0,0 +1,188 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ReplaceOneOperation = exports.UpdateManyOperation = exports.UpdateOneOperation = exports.UpdateOperation = void 0;
+exports.makeUpdateStatement = makeUpdateStatement;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const sort_1 = require("../sort");
+const utils_1 = require("../utils");
+const command_1 = require("./command");
+const operation_1 = require("./operation");
+/**
+ * @internal
+ * UpdateOperation is used in bulk write, while UpdateOneOperation and UpdateManyOperation are only used in the collections API
+ */
+class UpdateOperation extends command_1.CommandOperation {
+ constructor(ns, statements, options) {
+ super(undefined, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ this.ns = ns;
+ this.statements = statements;
+ }
+ get commandName() {
+ return 'update';
+ }
+ get canRetryWrite() {
+ if (super.canRetryWrite === false) {
+ return false;
+ }
+ return this.statements.every(op => op.multi == null || op.multi === false);
+ }
+ buildCommandDocument(_connection, _session) {
+ const options = this.options;
+ const command = {
+ update: this.ns.collection,
+ updates: this.statements,
+ ordered: options.ordered ?? true
+ };
+ if (typeof options.bypassDocumentValidation === 'boolean') {
+ command.bypassDocumentValidation = options.bypassDocumentValidation;
+ }
+ if (options.let) {
+ command.let = options.let;
+ }
+ // we check for undefined specifically here to allow falsy values
+ // eslint-disable-next-line no-restricted-syntax
+ if (options.comment !== undefined) {
+ command.comment = options.comment;
+ }
+ return command;
+ }
+}
+exports.UpdateOperation = UpdateOperation;
+/** @internal */
+class UpdateOneOperation extends UpdateOperation {
+ constructor(ns, filter, update, options) {
+ super(ns, [makeUpdateStatement(filter, update, { ...options, multi: false })], options);
+ if (!(0, utils_1.hasAtomicOperators)(update, options)) {
+ throw new error_1.MongoInvalidArgumentError('Update document requires atomic operators');
+ }
+ }
+ handleOk(response) {
+ const res = super.handleOk(response);
+ // @ts-expect-error Explain typing is broken
+ if (this.explain != null)
+ return res;
+ if (res.code)
+ throw new error_1.MongoServerError(res);
+ if (res.writeErrors)
+ throw new error_1.MongoServerError(res.writeErrors[0]);
+ return {
+ acknowledged: this.writeConcern?.w !== 0,
+ modifiedCount: res.nModified ?? res.n,
+ upsertedId: Array.isArray(res.upserted) && res.upserted.length > 0 ? res.upserted[0]._id : null,
+ upsertedCount: Array.isArray(res.upserted) && res.upserted.length ? res.upserted.length : 0,
+ matchedCount: Array.isArray(res.upserted) && res.upserted.length > 0 ? 0 : res.n
+ };
+ }
+}
+exports.UpdateOneOperation = UpdateOneOperation;
+/** @internal */
+class UpdateManyOperation extends UpdateOperation {
+ constructor(ns, filter, update, options) {
+ super(ns, [makeUpdateStatement(filter, update, { ...options, multi: true })], options);
+ if (!(0, utils_1.hasAtomicOperators)(update, options)) {
+ throw new error_1.MongoInvalidArgumentError('Update document requires atomic operators');
+ }
+ }
+ handleOk(response) {
+ const res = super.handleOk(response);
+ // @ts-expect-error Explain typing is broken
+ if (this.explain != null)
+ return res;
+ if (res.code)
+ throw new error_1.MongoServerError(res);
+ if (res.writeErrors)
+ throw new error_1.MongoServerError(res.writeErrors[0]);
+ return {
+ acknowledged: this.writeConcern?.w !== 0,
+ modifiedCount: res.nModified ?? res.n,
+ upsertedId: Array.isArray(res.upserted) && res.upserted.length > 0 ? res.upserted[0]._id : null,
+ upsertedCount: Array.isArray(res.upserted) && res.upserted.length ? res.upserted.length : 0,
+ matchedCount: Array.isArray(res.upserted) && res.upserted.length > 0 ? 0 : res.n
+ };
+ }
+}
+exports.UpdateManyOperation = UpdateManyOperation;
+/** @internal */
+class ReplaceOneOperation extends UpdateOperation {
+ constructor(ns, filter, replacement, options) {
+ super(ns, [makeUpdateStatement(filter, replacement, { ...options, multi: false })], options);
+ if ((0, utils_1.hasAtomicOperators)(replacement)) {
+ throw new error_1.MongoInvalidArgumentError('Replacement document must not contain atomic operators');
+ }
+ }
+ handleOk(response) {
+ const res = super.handleOk(response);
+ // @ts-expect-error Explain typing is broken
+ if (this.explain != null)
+ return res;
+ if (res.code)
+ throw new error_1.MongoServerError(res);
+ if (res.writeErrors)
+ throw new error_1.MongoServerError(res.writeErrors[0]);
+ return {
+ acknowledged: this.writeConcern?.w !== 0,
+ modifiedCount: res.nModified ?? res.n,
+ upsertedId: Array.isArray(res.upserted) && res.upserted.length > 0 ? res.upserted[0]._id : null,
+ upsertedCount: Array.isArray(res.upserted) && res.upserted.length ? res.upserted.length : 0,
+ matchedCount: Array.isArray(res.upserted) && res.upserted.length > 0 ? 0 : res.n
+ };
+ }
+}
+exports.ReplaceOneOperation = ReplaceOneOperation;
+function makeUpdateStatement(filter, update, options) {
+ if (filter == null || typeof filter !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Selector must be a valid JavaScript object');
+ }
+ if (update == null || typeof update !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('Document must be a valid JavaScript object');
+ }
+ const op = { q: filter, u: update };
+ if (typeof options.upsert === 'boolean') {
+ op.upsert = options.upsert;
+ }
+ if (options.multi) {
+ op.multi = options.multi;
+ }
+ if (options.hint) {
+ op.hint = options.hint;
+ }
+ if (options.arrayFilters) {
+ op.arrayFilters = options.arrayFilters;
+ }
+ if (options.collation) {
+ op.collation = options.collation;
+ }
+ if (!options.multi && options.sort != null) {
+ op.sort = (0, sort_1.formatSort)(options.sort);
+ }
+ return op;
+}
+(0, operation_1.defineAspects)(UpdateOperation, [
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.SKIP_COLLATION,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+(0, operation_1.defineAspects)(UpdateOneOperation, [
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.EXPLAINABLE,
+ operation_1.Aspect.SKIP_COLLATION,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+(0, operation_1.defineAspects)(UpdateManyOperation, [
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.EXPLAINABLE,
+ operation_1.Aspect.SKIP_COLLATION,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+(0, operation_1.defineAspects)(ReplaceOneOperation, [
+ operation_1.Aspect.RETRYABLE,
+ operation_1.Aspect.WRITE_OPERATION,
+ operation_1.Aspect.SKIP_COLLATION,
+ operation_1.Aspect.SUPPORTS_RAW_DATA
+]);
+//# sourceMappingURL=update.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/update.js.map b/node_modules/mongodb/lib/operations/update.js.map
new file mode 100644
index 00000000..0535d629
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/update.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/operations/update.ts"],"names":[],"mappings":";;;AA4PA,kDAuCC;AAjSD,+DAAkE;AAClE,oCAAuE;AAGvE,kCAAiE;AACjE,oCAIkB;AAClB,uCAAkG;AAClG,2CAA+D;AAuD/D;;;GAGG;AACH,MAAa,eAAgB,SAAQ,0BAA0B;IAK7D,YACE,EAAoB,EACpB,UAA6B,EAC7B,OAA8C;QAE9C,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QATnB,iCAA4B,GAAG,2BAAe,CAAC;QAUtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAEb,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,QAAiB,CAAC;IAC3B,CAAC;IAED,IAAa,aAAa;QACxB,IAAI,KAAK,CAAC,aAAa,KAAK,KAAK,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,IAAI,IAAI,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IAC7E,CAAC;IAEQ,oBAAoB,CAAC,WAAuB,EAAE,QAAwB;QAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,OAAO,GAAa;YACxB,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,UAAU;YAC1B,OAAO,EAAE,IAAI,CAAC,UAAU;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;SACjC,CAAC;QAEF,IAAI,OAAO,OAAO,CAAC,wBAAwB,KAAK,SAAS,EAAE,CAAC;YAC1D,OAAO,CAAC,wBAAwB,GAAG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AC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC;AACH,IAAA,yBAAa,EAAC,kBAAkB,EAAE;IAChC,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,WAAW;IAClB,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC;AACH,IAAA,yBAAa,EAAC,mBAAmB,EAAE;IACjC,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,WAAW;IAClB,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC;AACH,IAAA,yBAAa,EAAC,mBAAmB,EAAE;IACjC,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,cAAc;IACrB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/validate_collection.js b/node_modules/mongodb/lib/operations/validate_collection.js
new file mode 100644
index 00000000..374f1c84
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/validate_collection.js
@@ -0,0 +1,37 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ValidateCollectionOperation = void 0;
+const responses_1 = require("../cmap/wire_protocol/responses");
+const error_1 = require("../error");
+const command_1 = require("./command");
+/** @internal */
+class ValidateCollectionOperation extends command_1.CommandOperation {
+ constructor(admin, collectionName, options) {
+ super(admin.s.db, options);
+ this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
+ this.options = options;
+ this.collectionName = collectionName;
+ }
+ get commandName() {
+ return 'validate';
+ }
+ buildCommandDocument(_connection, _session) {
+ // Decorate command with extra options
+ return {
+ validate: this.collectionName,
+ ...Object.fromEntries(Object.entries(this.options).filter(entry => entry[0] !== 'session'))
+ };
+ }
+ handleOk(response) {
+ const result = super.handleOk(response);
+ if (result.result != null && typeof result.result !== 'string')
+ throw new error_1.MongoUnexpectedServerResponseError('Error with validation data');
+ if (result.result != null && result.result.match(/exception|corrupt/) != null)
+ throw new error_1.MongoUnexpectedServerResponseError(`Invalid collection ${this.collectionName}`);
+ if (result.valid != null && !result.valid)
+ throw new error_1.MongoUnexpectedServerResponseError(`Invalid collection ${this.collectionName}`);
+ return response;
+ }
+}
+exports.ValidateCollectionOperation = ValidateCollectionOperation;
+//# sourceMappingURL=validate_collection.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/operations/validate_collection.js.map b/node_modules/mongodb/lib/operations/validate_collection.js.map
new file mode 100644
index 00000000..19a9a8d9
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/validate_collection.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"validate_collection.js","sourceRoot":"","sources":["../../src/operations/validate_collection.ts"],"names":[],"mappings":";;;AAGA,+DAAkE;AAClE,oCAA8D;AAE9D,uCAA2E;AAQ3E,gBAAgB;AAChB,MAAa,2BAA4B,SAAQ,0BAA0B;IAKzE,YAAY,KAAY,EAAE,cAAsB,EAAE,OAAkC;QAClF,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QALpB,iCAA4B,GAAG,2BAAe,CAAC;QAMtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,UAAmB,CAAC;IAC7B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB,EAAE,QAAwB;QAC7E,sCAAsC;QACtC,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,cAAc;YAC7B,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;SAC5F,CAAC;IACJ,CAAC;IAEQ,QAAQ,CAAC,QAAgE;QAChF,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;YAC5D,MAAM,IAAI,0CAAkC,CAAC,4BAA4B,CAAC,CAAC;QAC7E,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,IAAI;YAC3E,MAAM,IAAI,0CAAkC,CAAC,sBAAsB,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAC5F,IAAI,MAAM,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK;YACvC,MAAM,IAAI,0CAAkC,CAAC,sBAAsB,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAE5F,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAlCD,kEAkCC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/read_concern.js b/node_modules/mongodb/lib/read_concern.js
new file mode 100644
index 00000000..a345e711
--- /dev/null
+++ b/node_modules/mongodb/lib/read_concern.js
@@ -0,0 +1,73 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ReadConcern = exports.ReadConcernLevel = void 0;
+/** @public */
+exports.ReadConcernLevel = Object.freeze({
+ local: 'local',
+ majority: 'majority',
+ linearizable: 'linearizable',
+ available: 'available',
+ snapshot: 'snapshot'
+});
+/**
+ * The MongoDB ReadConcern, which allows for control of the consistency and isolation properties
+ * of the data read from replica sets and replica set shards.
+ * @public
+ *
+ * @see https://www.mongodb.com/docs/manual/reference/read-concern/index.html
+ */
+class ReadConcern {
+ /** Constructs a ReadConcern from the read concern level.*/
+ constructor(level) {
+ /**
+ * A spec test exists that allows level to be any string.
+ * "invalid readConcern with out stage"
+ * @see ./test/spec/crud/v2/aggregate-out-readConcern.json
+ * @see https://github.com/mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.md#unknown-levels-and-additional-options-for-string-based-readconcerns
+ */
+ this.level = exports.ReadConcernLevel[level] ?? level;
+ }
+ /**
+ * Construct a ReadConcern given an options object.
+ *
+ * @param options - The options object from which to extract the write concern.
+ */
+ static fromOptions(options) {
+ if (options == null) {
+ return;
+ }
+ if (options.readConcern) {
+ const { readConcern } = options;
+ if (readConcern instanceof ReadConcern) {
+ return readConcern;
+ }
+ else if (typeof readConcern === 'string') {
+ return new ReadConcern(readConcern);
+ }
+ else if ('level' in readConcern && readConcern.level) {
+ return new ReadConcern(readConcern.level);
+ }
+ }
+ if (options.level) {
+ return new ReadConcern(options.level);
+ }
+ return;
+ }
+ static get MAJORITY() {
+ return exports.ReadConcernLevel.majority;
+ }
+ static get AVAILABLE() {
+ return exports.ReadConcernLevel.available;
+ }
+ static get LINEARIZABLE() {
+ return exports.ReadConcernLevel.linearizable;
+ }
+ static get SNAPSHOT() {
+ return exports.ReadConcernLevel.snapshot;
+ }
+ toJSON() {
+ return { level: this.level };
+ }
+}
+exports.ReadConcern = ReadConcern;
+//# sourceMappingURL=read_concern.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/read_concern.js.map b/node_modules/mongodb/lib/read_concern.js.map
new file mode 100644
index 00000000..8a31c552
--- /dev/null
+++ b/node_modules/mongodb/lib/read_concern.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"read_concern.js","sourceRoot":"","sources":["../src/read_concern.ts"],"names":[],"mappings":";;;AAEA,cAAc;AACD,QAAA,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACZ,CAAC,CAAC;AAQZ;;;;;;GAMG;AACH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A+DC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/read_preference.js b/node_modules/mongodb/lib/read_preference.js
new file mode 100644
index 00000000..ad514ed4
--- /dev/null
+++ b/node_modules/mongodb/lib/read_preference.js
@@ -0,0 +1,191 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ReadPreference = exports.ReadPreferenceMode = void 0;
+const error_1 = require("./error");
+/** @public */
+exports.ReadPreferenceMode = Object.freeze({
+ primary: 'primary',
+ primaryPreferred: 'primaryPreferred',
+ secondary: 'secondary',
+ secondaryPreferred: 'secondaryPreferred',
+ nearest: 'nearest'
+});
+/**
+ * The **ReadPreference** class is a class that represents a MongoDB ReadPreference and is
+ * used to construct connections.
+ * @public
+ *
+ * @see https://www.mongodb.com/docs/manual/core/read-preference/
+ */
+class ReadPreference {
+ static { this.PRIMARY = exports.ReadPreferenceMode.primary; }
+ static { this.PRIMARY_PREFERRED = exports.ReadPreferenceMode.primaryPreferred; }
+ static { this.SECONDARY = exports.ReadPreferenceMode.secondary; }
+ static { this.SECONDARY_PREFERRED = exports.ReadPreferenceMode.secondaryPreferred; }
+ static { this.NEAREST = exports.ReadPreferenceMode.nearest; }
+ static { this.primary = new ReadPreference(exports.ReadPreferenceMode.primary); }
+ static { this.primaryPreferred = new ReadPreference(exports.ReadPreferenceMode.primaryPreferred); }
+ static { this.secondary = new ReadPreference(exports.ReadPreferenceMode.secondary); }
+ static { this.secondaryPreferred = new ReadPreference(exports.ReadPreferenceMode.secondaryPreferred); }
+ static { this.nearest = new ReadPreference(exports.ReadPreferenceMode.nearest); }
+ /**
+ * @param mode - A string describing the read preference mode (primary|primaryPreferred|secondary|secondaryPreferred|nearest)
+ * @param tags - A tag set used to target reads to members with the specified tag(s). tagSet is not available if using read preference mode primary.
+ * @param options - Additional read preference options
+ */
+ constructor(mode, tags, options) {
+ if (!ReadPreference.isValid(mode)) {
+ throw new error_1.MongoInvalidArgumentError(`Invalid read preference mode ${JSON.stringify(mode)}`);
+ }
+ if (options == null && typeof tags === 'object' && !Array.isArray(tags)) {
+ options = tags;
+ tags = undefined;
+ }
+ else if (tags && !Array.isArray(tags)) {
+ throw new error_1.MongoInvalidArgumentError('ReadPreference tags must be an array');
+ }
+ this.mode = mode;
+ this.tags = tags;
+ this.hedge = options?.hedge;
+ this.maxStalenessSeconds = undefined;
+ options = options ?? {};
+ if (options.maxStalenessSeconds != null) {
+ if (options.maxStalenessSeconds <= 0) {
+ throw new error_1.MongoInvalidArgumentError('maxStalenessSeconds must be a positive integer');
+ }
+ this.maxStalenessSeconds = options.maxStalenessSeconds;
+ }
+ if (this.mode === ReadPreference.PRIMARY) {
+ if (this.tags && Array.isArray(this.tags) && this.tags.length > 0) {
+ throw new error_1.MongoInvalidArgumentError('Primary read preference cannot be combined with tags');
+ }
+ if (this.maxStalenessSeconds) {
+ throw new error_1.MongoInvalidArgumentError('Primary read preference cannot be combined with maxStalenessSeconds');
+ }
+ if (this.hedge) {
+ throw new error_1.MongoInvalidArgumentError('Primary read preference cannot be combined with hedge');
+ }
+ }
+ }
+ // Support the deprecated `preference` property introduced in the porcelain layer
+ get preference() {
+ return this.mode;
+ }
+ static fromString(mode) {
+ return new ReadPreference(mode);
+ }
+ /**
+ * Construct a ReadPreference given an options object.
+ *
+ * @param options - The options object from which to extract the read preference.
+ */
+ static fromOptions(options) {
+ if (!options)
+ return;
+ const readPreference = options.readPreference ?? options.session?.transaction.options.readPreference;
+ const readPreferenceTags = options.readPreferenceTags;
+ if (readPreference == null) {
+ return;
+ }
+ if (typeof readPreference === 'string') {
+ return new ReadPreference(readPreference, readPreferenceTags, {
+ maxStalenessSeconds: options.maxStalenessSeconds,
+ hedge: options.hedge
+ });
+ }
+ else if (!(readPreference instanceof ReadPreference) && typeof readPreference === 'object') {
+ const mode = readPreference.mode || readPreference.preference;
+ if (mode && typeof mode === 'string') {
+ return new ReadPreference(mode, readPreference.tags ?? readPreferenceTags, {
+ maxStalenessSeconds: readPreference.maxStalenessSeconds,
+ hedge: options.hedge
+ });
+ }
+ }
+ if (readPreferenceTags) {
+ readPreference.tags = readPreferenceTags;
+ }
+ return readPreference;
+ }
+ /**
+ * Replaces options.readPreference with a ReadPreference instance
+ */
+ static translate(options) {
+ if (options.readPreference == null)
+ return options;
+ const r = options.readPreference;
+ if (typeof r === 'string') {
+ options.readPreference = new ReadPreference(r);
+ }
+ else if (r && !(r instanceof ReadPreference) && typeof r === 'object') {
+ const mode = r.mode || r.preference;
+ if (mode && typeof mode === 'string') {
+ options.readPreference = new ReadPreference(mode, r.tags, {
+ maxStalenessSeconds: r.maxStalenessSeconds
+ });
+ }
+ }
+ else if (!(r instanceof ReadPreference)) {
+ throw new error_1.MongoInvalidArgumentError(`Invalid read preference: ${r}`);
+ }
+ return options;
+ }
+ /**
+ * Validate if a mode is legal
+ *
+ * @param mode - The string representing the read preference mode.
+ */
+ static isValid(mode) {
+ const VALID_MODES = new Set([
+ ReadPreference.PRIMARY,
+ ReadPreference.PRIMARY_PREFERRED,
+ ReadPreference.SECONDARY,
+ ReadPreference.SECONDARY_PREFERRED,
+ ReadPreference.NEAREST,
+ null
+ ]);
+ return VALID_MODES.has(mode);
+ }
+ /**
+ * Validate if a mode is legal
+ *
+ * @param mode - The string representing the read preference mode.
+ */
+ isValid(mode) {
+ return ReadPreference.isValid(typeof mode === 'string' ? mode : this.mode);
+ }
+ /**
+ * Indicates that this readPreference needs the "SecondaryOk" bit when sent over the wire
+ * @see https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/#op-query
+ */
+ secondaryOk() {
+ const NEEDS_SECONDARYOK = new Set([
+ ReadPreference.PRIMARY_PREFERRED,
+ ReadPreference.SECONDARY,
+ ReadPreference.SECONDARY_PREFERRED,
+ ReadPreference.NEAREST
+ ]);
+ return NEEDS_SECONDARYOK.has(this.mode);
+ }
+ /**
+ * Check if the two ReadPreferences are equivalent
+ *
+ * @param readPreference - The read preference with which to check equality
+ */
+ equals(readPreference) {
+ return readPreference.mode === this.mode;
+ }
+ /** Return JSON representation */
+ toJSON() {
+ const readPreference = { mode: this.mode };
+ if (Array.isArray(this.tags))
+ readPreference.tags = this.tags;
+ if (this.maxStalenessSeconds)
+ readPreference.maxStalenessSeconds = this.maxStalenessSeconds;
+ if (this.hedge)
+ readPreference.hedge = this.hedge;
+ return readPreference;
+ }
+}
+exports.ReadPreference = ReadPreference;
+//# sourceMappingURL=read_preference.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/read_preference.js.map b/node_modules/mongodb/lib/read_preference.js.map
new file mode 100644
index 00000000..ce950605
--- /dev/null
+++ b/node_modules/mongodb/lib/read_preference.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"read_preference.js","sourceRoot":"","sources":["../src/read_preference.ts"],"names":[],"mappings":";;;AACA,mCAAoD;AAOpD,cAAc;AACD,QAAA,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,SAAS;IAClB,gBAAgB,EAAE,kBAAkB;IACpC,SAAS,EAAE,WAAW;IACtB,kBAAkB,EAAE,oBAAoB;IACxC,OAAO,EAAE,SAAS;CACV,CAAC,CAAC;AAsCZ;;;;;;GAMG;AACH,MAAa,cAAc;aAMX,YAAO,GAAG,0BAAkB,CAAC,OAAO,CAAC;aACrC,sBAAiB,GAAG,0BAAkB,CAAC,gBAAgB,CAAC;aACxD,cAAS,GAAG,0BAAkB,CAAC,SAAS,CAAC;aACzC,wBAAmB,GAAG,0BAAkB,CAAC,kBAAkB,CAAC;aAC5D,YAAO,GAAG,0BAAkB,CAAC,OAAO,CAAC;aAErC,YAAO,GAAG,IAAI,cAAc,CAAC,0BAAkB,CAAC,OAAO,CAAC,CAAC;aACzD,qBAAgB,GAAG,IAAI,cAAc,CAAC,0BAAkB,CAAC,gBAAgB,CAAC,CAAC;aAC3E,cAAS,GAAG,IAAI,cAAc,CAAC,0BAAkB,CAAC,SAAS,CAAC,CAAC;aAC7D,uBAAkB,GAAG,IAAI,cAAc,CAAC,0BAAkB,CAAC,kB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mB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QAC5F,IAAI,IAAI,CAAC,KAAK;YAAE,cAAc,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAClD,OAAO,cAAc,CAAC;IACxB,CAAC;;AAlMH,wCAmMC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/runtime_adapters.js b/node_modules/mongodb/lib/runtime_adapters.js
new file mode 100644
index 00000000..083c197a
--- /dev/null
+++ b/node_modules/mongodb/lib/runtime_adapters.js
@@ -0,0 +1,32 @@
+"use strict";
+/* eslint-disable no-restricted-imports*/
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ALLOWED_DRIVER_REQUIRE_PROPERTY_NAME = void 0;
+exports.resolveRuntimeAdapters = resolveRuntimeAdapters;
+/**
+ * @internal
+ *
+ * This propery can be set on the global object to allow the driver to require otherwise blocked modules.
+ * This is used by our test suite to allow tests to access the `os` module without allowing user code to do so.
+ */
+exports.ALLOWED_DRIVER_REQUIRE_PROPERTY_NAME = 'allowedDriverRequire';
+/**
+ * @internal
+ *
+ * Given a MongoClientOptions, this function resolves the set of runtime options, providing Nodejs implementations if
+ * not provided by in `options`, and returns a `Runtime`.
+ */
+function resolveRuntimeAdapters(options) {
+ globalThis[exports.ALLOWED_DRIVER_REQUIRE_PROPERTY_NAME] = true;
+ try {
+ const runtime = {
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ os: options.runtimeAdapters?.os ?? require('os')
+ };
+ return runtime;
+ }
+ finally {
+ globalThis[exports.ALLOWED_DRIVER_REQUIRE_PROPERTY_NAME] = false;
+ }
+}
+//# sourceMappingURL=runtime_adapters.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/runtime_adapters.js.map b/node_modules/mongodb/lib/runtime_adapters.js.map
new file mode 100644
index 00000000..e1933e35
--- /dev/null
+++ b/node_modules/mongodb/lib/runtime_adapters.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"runtime_adapters.js","sourceRoot":"","sources":["../src/runtime_adapters.ts"],"names":[],"mappings":";AAAA,yCAAyC;;;AAoDzC,wDAWC;AArDD;;;;;GAKG;AACU,QAAA,oCAAoC,GAAG,sBAAsB,CAAC;AA8B3E;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,OAA2B;IAC/D,UAAkB,CAAC,4CAAoC,CAAC,GAAG,IAAI,CAAC;IACjE,IAAI,CAAC;QACH,MAAM,OAAO,GAAG;YACd,iEAAiE;YACjE,EAAE,EAAE,OAAO,CAAC,eAAe,EAAE,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;SACjD,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC;YAAS,CAAC;QACR,UAAkB,CAAC,4CAAoC,CAAC,GAAG,KAAK,CAAC;IACpE,CAAC;AACH,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/common.js b/node_modules/mongodb/lib/sdam/common.js
new file mode 100644
index 00000000..c378293e
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/common.js
@@ -0,0 +1,49 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ServerType = exports.TopologyType = exports.STATE_CONNECTED = exports.STATE_CONNECTING = exports.STATE_CLOSED = exports.STATE_CLOSING = void 0;
+exports._advanceClusterTime = _advanceClusterTime;
+// shared state names
+exports.STATE_CLOSING = 'closing';
+exports.STATE_CLOSED = 'closed';
+exports.STATE_CONNECTING = 'connecting';
+exports.STATE_CONNECTED = 'connected';
+/**
+ * An enumeration of topology types we know about
+ * @public
+ */
+exports.TopologyType = Object.freeze({
+ Single: 'Single',
+ ReplicaSetNoPrimary: 'ReplicaSetNoPrimary',
+ ReplicaSetWithPrimary: 'ReplicaSetWithPrimary',
+ Sharded: 'Sharded',
+ Unknown: 'Unknown',
+ LoadBalanced: 'LoadBalanced'
+});
+/**
+ * An enumeration of server types we know about
+ * @public
+ */
+exports.ServerType = Object.freeze({
+ Standalone: 'Standalone',
+ Mongos: 'Mongos',
+ PossiblePrimary: 'PossiblePrimary',
+ RSPrimary: 'RSPrimary',
+ RSSecondary: 'RSSecondary',
+ RSArbiter: 'RSArbiter',
+ RSOther: 'RSOther',
+ RSGhost: 'RSGhost',
+ Unknown: 'Unknown',
+ LoadBalancer: 'LoadBalancer'
+});
+/** Shared function to determine clusterTime for a given topology or session */
+function _advanceClusterTime(entity, $clusterTime) {
+ if (entity.clusterTime == null) {
+ entity.clusterTime = $clusterTime;
+ }
+ else {
+ if ($clusterTime.clusterTime.greaterThan(entity.clusterTime.clusterTime)) {
+ entity.clusterTime = $clusterTime;
+ }
+ }
+}
+//# sourceMappingURL=common.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/common.js.map b/node_modules/mongodb/lib/sdam/common.js.map
new file mode 100644
index 00000000..d9297ef8
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/common.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/sdam/common.ts"],"names":[],"mappings":";;;AA8DA,kDAWC;AArED,qBAAqB;AACR,QAAA,aAAa,GAAG,SAAS,CAAC;AAC1B,QAAA,YAAY,GAAG,QAAQ,CAAC;AACxB,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAChC,QAAA,eAAe,GAAG,WAAW,CAAC;AAE3C;;;GAGG;AACU,QAAA,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,QAAQ;IAChB,mBAAmB,EAAE,qBAAqB;IAC1C,qBAAqB,EAAE,uBAAuB;IAC9C,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,cAAc;CACpB,CAAC,CAAC;AAKZ;;;GAGG;AACU,QAAA,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,QAAQ;IAChB,eAAe,EAAE,iBAAiB;IAClC,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,cAAc;CACpB,CAAC,CAAC;AAoBZ,+EAA+E;AAC/E,SAAgB,mBAAmB,CACjC,MAAgC,EAChC,YAAyB;IAEzB,IAAI,MAAM,CAAC,WAAW,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,CAAC,WAAW,GAAG,YAAY,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,IAAI,YAAY,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;YACzE,MAAM,CAAC,WAAW,GAAG,YAAY,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/events.js b/node_modules/mongodb/lib/sdam/events.js
new file mode 100644
index 00000000..69dfe9f3
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/events.js
@@ -0,0 +1,146 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ServerHeartbeatFailedEvent = exports.ServerHeartbeatSucceededEvent = exports.ServerHeartbeatStartedEvent = exports.TopologyClosedEvent = exports.TopologyOpeningEvent = exports.TopologyDescriptionChangedEvent = exports.ServerClosedEvent = exports.ServerOpeningEvent = exports.ServerDescriptionChangedEvent = void 0;
+const constants_1 = require("../constants");
+/**
+ * Emitted when server description changes, but does NOT include changes to the RTT.
+ * @public
+ * @category Event
+ */
+class ServerDescriptionChangedEvent {
+ /** @internal */
+ constructor(topologyId, address, previousDescription, newDescription) {
+ this.name = constants_1.SERVER_DESCRIPTION_CHANGED;
+ this.topologyId = topologyId;
+ this.address = address;
+ this.previousDescription = previousDescription;
+ this.newDescription = newDescription;
+ }
+}
+exports.ServerDescriptionChangedEvent = ServerDescriptionChangedEvent;
+/**
+ * Emitted when server is initialized.
+ * @public
+ * @category Event
+ */
+class ServerOpeningEvent {
+ /** @internal */
+ constructor(topologyId, address) {
+ /** @internal */
+ this.name = constants_1.SERVER_OPENING;
+ this.topologyId = topologyId;
+ this.address = address;
+ }
+}
+exports.ServerOpeningEvent = ServerOpeningEvent;
+/**
+ * Emitted when server is closed.
+ * @public
+ * @category Event
+ */
+class ServerClosedEvent {
+ /** @internal */
+ constructor(topologyId, address) {
+ /** @internal */
+ this.name = constants_1.SERVER_CLOSED;
+ this.topologyId = topologyId;
+ this.address = address;
+ }
+}
+exports.ServerClosedEvent = ServerClosedEvent;
+/**
+ * Emitted when topology description changes.
+ * @public
+ * @category Event
+ */
+class TopologyDescriptionChangedEvent {
+ /** @internal */
+ constructor(topologyId, previousDescription, newDescription) {
+ /** @internal */
+ this.name = constants_1.TOPOLOGY_DESCRIPTION_CHANGED;
+ this.topologyId = topologyId;
+ this.previousDescription = previousDescription;
+ this.newDescription = newDescription;
+ }
+}
+exports.TopologyDescriptionChangedEvent = TopologyDescriptionChangedEvent;
+/**
+ * Emitted when topology is initialized.
+ * @public
+ * @category Event
+ */
+class TopologyOpeningEvent {
+ /** @internal */
+ constructor(topologyId) {
+ /** @internal */
+ this.name = constants_1.TOPOLOGY_OPENING;
+ this.topologyId = topologyId;
+ }
+}
+exports.TopologyOpeningEvent = TopologyOpeningEvent;
+/**
+ * Emitted when topology is closed.
+ * @public
+ * @category Event
+ */
+class TopologyClosedEvent {
+ /** @internal */
+ constructor(topologyId) {
+ /** @internal */
+ this.name = constants_1.TOPOLOGY_CLOSED;
+ this.topologyId = topologyId;
+ }
+}
+exports.TopologyClosedEvent = TopologyClosedEvent;
+/**
+ * Emitted when the server monitor’s hello command is started - immediately before
+ * the hello command is serialized into raw BSON and written to the socket.
+ *
+ * @public
+ * @category Event
+ */
+class ServerHeartbeatStartedEvent {
+ /** @internal */
+ constructor(connectionId, awaited) {
+ /** @internal */
+ this.name = constants_1.SERVER_HEARTBEAT_STARTED;
+ this.connectionId = connectionId;
+ this.awaited = awaited;
+ }
+}
+exports.ServerHeartbeatStartedEvent = ServerHeartbeatStartedEvent;
+/**
+ * Emitted when the server monitor’s hello succeeds.
+ * @public
+ * @category Event
+ */
+class ServerHeartbeatSucceededEvent {
+ /** @internal */
+ constructor(connectionId, duration, reply, awaited) {
+ /** @internal */
+ this.name = constants_1.SERVER_HEARTBEAT_SUCCEEDED;
+ this.connectionId = connectionId;
+ this.duration = duration;
+ this.reply = reply ?? {};
+ this.awaited = awaited;
+ }
+}
+exports.ServerHeartbeatSucceededEvent = ServerHeartbeatSucceededEvent;
+/**
+ * Emitted when the server monitor’s hello fails, either with an “ok: 0” or a socket exception.
+ * @public
+ * @category Event
+ */
+class ServerHeartbeatFailedEvent {
+ /** @internal */
+ constructor(connectionId, duration, failure, awaited) {
+ /** @internal */
+ this.name = constants_1.SERVER_HEARTBEAT_FAILED;
+ this.connectionId = connectionId;
+ this.duration = duration;
+ this.failure = failure;
+ this.awaited = awaited;
+ }
+}
+exports.ServerHeartbeatFailedEvent = ServerHeartbeatFailedEvent;
+//# sourceMappingURL=events.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/events.js.map b/node_modules/mongodb/lib/sdam/events.js.map
new file mode 100644
index 00000000..0ddeb049
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/events.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/sdam/events.ts"],"names":[],"mappings":";;;AACA,4CAUsB;AAItB;;;;GAIG;AACH,MAAa,6BAA6B;IAWxC,gBAAgB;IAChB,YACE,UAAkB,EAClB,OAAe,EACf,mBAAsC,EACtC,cAAiC;QAPnC,SAAI,GAAG,sCAA0B,CAAC;QAShC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;CACF;AAvBD,sEAuBC;AA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;IAChB,YAAY,YAAoB,EAAE,OAAgB;QAJlD,gBAAgB;QAChB,SAAI,GAAG,oCAAwB,CAAC;QAI9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAbD,kEAaC;AAED;;;;GAIG;AACH,MAAa,6BAA6B;IAYxC,gBAAgB;IAChB,YAAY,YAAoB,EAAE,QAAgB,EAAE,KAAsB,EAAE,OAAgB;QAJ5F,gBAAgB;QAChB,SAAI,GAAG,sCAA0B,CAAC;QAIhC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAnBD,sEAmBC;AAED;;;;GAIG;AACH,MAAa,0BAA0B;IAYrC,gBAAgB;IAChB,YAAY,YAAoB,EAAE,QAAgB,EAAE,OAAc,EAAE,OAAgB;QAJpF,gBAAgB;QAChB,SAAI,GAAG,mCAAuB,CAAC;QAI7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAnBD,gEAmBC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/monitor.js b/node_modules/mongodb/lib/sdam/monitor.js
new file mode 100644
index 00000000..ee8e085b
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/monitor.js
@@ -0,0 +1,544 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.RTTSampler = exports.MonitorInterval = exports.RTTPinger = exports.Monitor = exports.ServerMonitoringMode = void 0;
+const timers_1 = require("timers");
+const bson_1 = require("../bson");
+const connect_1 = require("../cmap/connect");
+const client_metadata_1 = require("../cmap/handshake/client_metadata");
+const constants_1 = require("../constants");
+const error_1 = require("../error");
+const mongo_logger_1 = require("../mongo_logger");
+const mongo_types_1 = require("../mongo_types");
+const utils_1 = require("../utils");
+const common_1 = require("./common");
+const events_1 = require("./events");
+const server_1 = require("./server");
+const STATE_IDLE = 'idle';
+const STATE_MONITORING = 'monitoring';
+const stateTransition = (0, utils_1.makeStateMachine)({
+ [common_1.STATE_CLOSING]: [common_1.STATE_CLOSING, STATE_IDLE, common_1.STATE_CLOSED],
+ [common_1.STATE_CLOSED]: [common_1.STATE_CLOSED, STATE_MONITORING],
+ [STATE_IDLE]: [STATE_IDLE, STATE_MONITORING, common_1.STATE_CLOSING],
+ [STATE_MONITORING]: [STATE_MONITORING, STATE_IDLE, common_1.STATE_CLOSING]
+});
+const INVALID_REQUEST_CHECK_STATES = new Set([common_1.STATE_CLOSING, common_1.STATE_CLOSED, STATE_MONITORING]);
+function isInCloseState(monitor) {
+ return monitor.s.state === common_1.STATE_CLOSED || monitor.s.state === common_1.STATE_CLOSING;
+}
+/** @public */
+exports.ServerMonitoringMode = Object.freeze({
+ auto: 'auto',
+ poll: 'poll',
+ stream: 'stream'
+});
+/** @internal */
+class Monitor extends mongo_types_1.TypedEventEmitter {
+ constructor(server, options) {
+ super();
+ /** @internal */
+ this.component = mongo_logger_1.MongoLoggableComponent.TOPOLOGY;
+ this.on('error', utils_1.noop);
+ this.server = server;
+ this.connection = null;
+ this.cancellationToken = new mongo_types_1.CancellationToken();
+ this.cancellationToken.setMaxListeners(Infinity);
+ this.monitorId = undefined;
+ this.s = {
+ state: common_1.STATE_CLOSED
+ };
+ this.address = server.description.address;
+ this.options = Object.freeze({
+ connectTimeoutMS: options.connectTimeoutMS ?? 10000,
+ heartbeatFrequencyMS: options.heartbeatFrequencyMS ?? 10000,
+ minHeartbeatFrequencyMS: options.minHeartbeatFrequencyMS ?? 500,
+ serverMonitoringMode: options.serverMonitoringMode
+ });
+ this.isRunningInFaasEnv = (0, client_metadata_1.getFAASEnv)() != null;
+ this.mongoLogger = this.server.topology.client?.mongoLogger;
+ this.rttSampler = new RTTSampler(10);
+ const cancellationToken = this.cancellationToken;
+ // TODO: refactor this to pull it directly from the pool, requires new ConnectionPool integration
+ const connectOptions = {
+ id: '',
+ generation: server.pool.generation,
+ cancellationToken,
+ hostAddress: server.description.hostAddress,
+ ...options,
+ // force BSON serialization options
+ raw: false,
+ useBigInt64: false,
+ promoteLongs: true,
+ promoteValues: true,
+ promoteBuffers: true
+ };
+ // ensure no authentication is used for monitoring
+ delete connectOptions.credentials;
+ if (connectOptions.autoEncrypter) {
+ delete connectOptions.autoEncrypter;
+ }
+ this.connectOptions = Object.freeze(connectOptions);
+ }
+ connect() {
+ if (this.s.state !== common_1.STATE_CLOSED) {
+ return;
+ }
+ // start
+ const heartbeatFrequencyMS = this.options.heartbeatFrequencyMS;
+ const minHeartbeatFrequencyMS = this.options.minHeartbeatFrequencyMS;
+ this.monitorId = new MonitorInterval(monitorServer(this), {
+ heartbeatFrequencyMS: heartbeatFrequencyMS,
+ minHeartbeatFrequencyMS: minHeartbeatFrequencyMS,
+ immediate: true
+ });
+ }
+ requestCheck() {
+ if (INVALID_REQUEST_CHECK_STATES.has(this.s.state)) {
+ return;
+ }
+ this.monitorId?.wake();
+ }
+ reset() {
+ const topologyVersion = this.server.description.topologyVersion;
+ if (isInCloseState(this) || topologyVersion == null) {
+ return;
+ }
+ stateTransition(this, common_1.STATE_CLOSING);
+ resetMonitorState(this);
+ // restart monitor
+ stateTransition(this, STATE_IDLE);
+ // restart monitoring
+ const heartbeatFrequencyMS = this.options.heartbeatFrequencyMS;
+ const minHeartbeatFrequencyMS = this.options.minHeartbeatFrequencyMS;
+ this.monitorId = new MonitorInterval(monitorServer(this), {
+ heartbeatFrequencyMS: heartbeatFrequencyMS,
+ minHeartbeatFrequencyMS: minHeartbeatFrequencyMS
+ });
+ }
+ close() {
+ if (isInCloseState(this)) {
+ return;
+ }
+ stateTransition(this, common_1.STATE_CLOSING);
+ resetMonitorState(this);
+ // close monitor
+ this.emit('close');
+ stateTransition(this, common_1.STATE_CLOSED);
+ }
+ get roundTripTime() {
+ return this.rttSampler.average();
+ }
+ get minRoundTripTime() {
+ return this.rttSampler.min();
+ }
+ get latestRtt() {
+ return this.rttSampler.last;
+ }
+ addRttSample(rtt) {
+ this.rttSampler.addSample(rtt);
+ }
+ clearRttSamples() {
+ this.rttSampler.clear();
+ }
+}
+exports.Monitor = Monitor;
+function resetMonitorState(monitor) {
+ monitor.monitorId?.stop();
+ monitor.monitorId = undefined;
+ monitor.rttPinger?.close();
+ monitor.rttPinger = undefined;
+ monitor.cancellationToken.emit('cancel');
+ monitor.connection?.destroy();
+ monitor.connection = null;
+ monitor.clearRttSamples();
+}
+function useStreamingProtocol(monitor, topologyVersion) {
+ // If we have no topology version we always poll no matter
+ // what the user provided, since the server does not support
+ // the streaming protocol.
+ if (topologyVersion == null)
+ return false;
+ const serverMonitoringMode = monitor.options.serverMonitoringMode;
+ if (serverMonitoringMode === exports.ServerMonitoringMode.poll)
+ return false;
+ if (serverMonitoringMode === exports.ServerMonitoringMode.stream)
+ return true;
+ // If we are in auto mode, we need to figure out if we're in a FaaS
+ // environment or not and choose the appropriate mode.
+ if (monitor.isRunningInFaasEnv)
+ return false;
+ return true;
+}
+function checkServer(monitor, callback) {
+ let start;
+ let awaited;
+ const topologyVersion = monitor.server.description.topologyVersion;
+ const isAwaitable = useStreamingProtocol(monitor, topologyVersion);
+ monitor.emitAndLogHeartbeat(server_1.Server.SERVER_HEARTBEAT_STARTED, monitor.server.topology.s.id, undefined, new events_1.ServerHeartbeatStartedEvent(monitor.address, isAwaitable));
+ function onHeartbeatFailed(err) {
+ monitor.connection?.destroy();
+ monitor.connection = null;
+ monitor.emitAndLogHeartbeat(server_1.Server.SERVER_HEARTBEAT_FAILED, monitor.server.topology.s.id, undefined, new events_1.ServerHeartbeatFailedEvent(monitor.address, (0, utils_1.calculateDurationInMs)(start), err, awaited));
+ const error = !(err instanceof error_1.MongoError)
+ ? new error_1.MongoError(error_1.MongoError.buildErrorMessage(err), { cause: err })
+ : err;
+ error.addErrorLabel(error_1.MongoErrorLabel.ResetPool);
+ if (error instanceof error_1.MongoNetworkTimeoutError) {
+ error.addErrorLabel(error_1.MongoErrorLabel.InterruptInUseConnections);
+ }
+ monitor.emit('resetServer', error);
+ callback(err);
+ }
+ function onHeartbeatSucceeded(hello) {
+ if (!('isWritablePrimary' in hello)) {
+ // Provide hello-style response document.
+ hello.isWritablePrimary = hello[constants_1.LEGACY_HELLO_COMMAND];
+ }
+ // NOTE: here we use the latestRtt as this measurement corresponds with the value
+ // obtained for this successful heartbeat, if there is no latestRtt, then we calculate the
+ // duration
+ const duration = isAwaitable && monitor.rttPinger
+ ? (monitor.rttPinger.latestRtt ?? (0, utils_1.calculateDurationInMs)(start))
+ : (0, utils_1.calculateDurationInMs)(start);
+ monitor.addRttSample(duration);
+ monitor.emitAndLogHeartbeat(server_1.Server.SERVER_HEARTBEAT_SUCCEEDED, monitor.server.topology.s.id, hello.connectionId, new events_1.ServerHeartbeatSucceededEvent(monitor.address, duration, hello, isAwaitable));
+ if (isAwaitable) {
+ // If we are using the streaming protocol then we immediately issue another 'started'
+ // event, otherwise the "check" is complete and return to the main monitor loop
+ monitor.emitAndLogHeartbeat(server_1.Server.SERVER_HEARTBEAT_STARTED, monitor.server.topology.s.id, undefined, new events_1.ServerHeartbeatStartedEvent(monitor.address, true));
+ // We have not actually sent an outgoing handshake, but when we get the next response we
+ // want the duration to reflect the time since we last heard from the server
+ start = (0, utils_1.processTimeMS)();
+ }
+ else {
+ monitor.rttPinger?.close();
+ monitor.rttPinger = undefined;
+ callback(undefined, hello);
+ }
+ }
+ const { connection } = monitor;
+ if (connection && !connection.closed) {
+ const { serverApi, helloOk } = connection;
+ const connectTimeoutMS = monitor.options.connectTimeoutMS;
+ const maxAwaitTimeMS = monitor.options.heartbeatFrequencyMS;
+ const cmd = {
+ [serverApi?.version || helloOk ? 'hello' : constants_1.LEGACY_HELLO_COMMAND]: 1,
+ ...(isAwaitable && topologyVersion
+ ? { maxAwaitTimeMS, topologyVersion: makeTopologyVersion(topologyVersion) }
+ : {})
+ };
+ const options = isAwaitable
+ ? {
+ socketTimeoutMS: connectTimeoutMS ? connectTimeoutMS + maxAwaitTimeMS : 0,
+ exhaustAllowed: true
+ }
+ : { socketTimeoutMS: connectTimeoutMS };
+ if (isAwaitable && monitor.rttPinger == null) {
+ monitor.rttPinger = new RTTPinger(monitor);
+ }
+ // Record new start time before sending handshake
+ start = (0, utils_1.processTimeMS)();
+ if (isAwaitable) {
+ awaited = true;
+ return connection.exhaustCommand((0, utils_1.ns)('admin.$cmd'), cmd, options, (error, hello) => {
+ if (error)
+ return onHeartbeatFailed(error);
+ return onHeartbeatSucceeded(hello);
+ });
+ }
+ awaited = false;
+ connection
+ .command((0, utils_1.ns)('admin.$cmd'), cmd, options)
+ .then(onHeartbeatSucceeded, onHeartbeatFailed);
+ return;
+ }
+ // connecting does an implicit `hello`
+ (async () => {
+ const socket = await (0, connect_1.makeSocket)(monitor.connectOptions);
+ const connection = (0, connect_1.makeConnection)(monitor.connectOptions, socket);
+ // The start time is after socket creation but before the handshake
+ start = (0, utils_1.processTimeMS)();
+ try {
+ await (0, connect_1.performInitialHandshake)(connection, monitor.connectOptions);
+ return connection;
+ }
+ catch (error) {
+ connection.destroy();
+ throw error;
+ }
+ })().then(connection => {
+ if (isInCloseState(monitor)) {
+ connection.destroy();
+ return;
+ }
+ const duration = (0, utils_1.calculateDurationInMs)(start);
+ monitor.addRttSample(duration);
+ monitor.connection = connection;
+ monitor.emitAndLogHeartbeat(server_1.Server.SERVER_HEARTBEAT_SUCCEEDED, monitor.server.topology.s.id, connection.hello?.connectionId, new events_1.ServerHeartbeatSucceededEvent(monitor.address, duration, connection.hello, useStreamingProtocol(monitor, connection.hello?.topologyVersion)));
+ callback(undefined, connection.hello);
+ }, error => {
+ monitor.connection = null;
+ awaited = false;
+ onHeartbeatFailed(error);
+ });
+}
+function monitorServer(monitor) {
+ return (callback) => {
+ if (monitor.s.state === STATE_MONITORING) {
+ queueMicrotask(callback);
+ return;
+ }
+ stateTransition(monitor, STATE_MONITORING);
+ function done() {
+ if (!isInCloseState(monitor)) {
+ stateTransition(monitor, STATE_IDLE);
+ }
+ callback();
+ }
+ checkServer(monitor, (err, hello) => {
+ if (err) {
+ // otherwise an error occurred on initial discovery, also bail
+ if (monitor.server.description.type === common_1.ServerType.Unknown) {
+ return done();
+ }
+ }
+ // if the check indicates streaming is supported, immediately reschedule monitoring
+ if (useStreamingProtocol(monitor, hello?.topologyVersion)) {
+ (0, timers_1.setTimeout)(() => {
+ if (!isInCloseState(monitor)) {
+ monitor.monitorId?.wake();
+ }
+ }, 0);
+ }
+ done();
+ });
+ };
+}
+function makeTopologyVersion(tv) {
+ return {
+ processId: tv.processId,
+ // tests mock counter as just number, but in a real situation counter should always be a Long
+ // TODO(NODE-2674): Preserve int64 sent from MongoDB
+ counter: bson_1.Long.isLong(tv.counter) ? tv.counter : bson_1.Long.fromNumber(tv.counter)
+ };
+}
+/** @internal */
+class RTTPinger {
+ constructor(monitor) {
+ this.connection = undefined;
+ this.cancellationToken = monitor.cancellationToken;
+ this.closed = false;
+ this.monitor = monitor;
+ this.latestRtt = monitor.latestRtt ?? undefined;
+ const heartbeatFrequencyMS = monitor.options.heartbeatFrequencyMS;
+ this.monitorId = (0, timers_1.setTimeout)(() => this.measureRoundTripTime(), heartbeatFrequencyMS);
+ }
+ get roundTripTime() {
+ return this.monitor.roundTripTime;
+ }
+ get minRoundTripTime() {
+ return this.monitor.minRoundTripTime;
+ }
+ close() {
+ this.closed = true;
+ (0, timers_1.clearTimeout)(this.monitorId);
+ this.connection?.destroy();
+ this.connection = undefined;
+ }
+ measureAndReschedule(start, conn) {
+ if (this.closed) {
+ conn?.destroy();
+ return;
+ }
+ if (this.connection == null) {
+ this.connection = conn;
+ }
+ this.latestRtt = (0, utils_1.calculateDurationInMs)(start);
+ this.monitorId = (0, timers_1.setTimeout)(() => this.measureRoundTripTime(), this.monitor.options.heartbeatFrequencyMS);
+ }
+ measureRoundTripTime() {
+ const start = (0, utils_1.processTimeMS)();
+ if (this.closed) {
+ return;
+ }
+ const connection = this.connection;
+ if (connection == null) {
+ (0, connect_1.connect)(this.monitor.connectOptions).then(connection => {
+ this.measureAndReschedule(start, connection);
+ }, () => {
+ this.connection = undefined;
+ });
+ return;
+ }
+ const commandName = connection.serverApi?.version || connection.helloOk ? 'hello' : constants_1.LEGACY_HELLO_COMMAND;
+ connection.command((0, utils_1.ns)('admin.$cmd'), { [commandName]: 1 }, undefined).then(() => this.measureAndReschedule(start), () => {
+ this.connection?.destroy();
+ this.connection = undefined;
+ return;
+ });
+ }
+}
+exports.RTTPinger = RTTPinger;
+/**
+ * @internal
+ */
+class MonitorInterval {
+ constructor(fn, options = {}) {
+ this.isExpeditedCallToFnScheduled = false;
+ this.stopped = false;
+ this.isExecutionInProgress = false;
+ this.hasExecutedOnce = false;
+ this._executeAndReschedule = () => {
+ if (this.stopped)
+ return;
+ if (this.timerId) {
+ (0, timers_1.clearTimeout)(this.timerId);
+ }
+ this.isExpeditedCallToFnScheduled = false;
+ this.isExecutionInProgress = true;
+ this.fn(() => {
+ this.lastExecutionEnded = (0, utils_1.processTimeMS)();
+ this.isExecutionInProgress = false;
+ this._reschedule(this.heartbeatFrequencyMS);
+ });
+ };
+ this.fn = fn;
+ this.lastExecutionEnded = -Infinity;
+ this.heartbeatFrequencyMS = options.heartbeatFrequencyMS ?? 1000;
+ this.minHeartbeatFrequencyMS = options.minHeartbeatFrequencyMS ?? 500;
+ if (options.immediate) {
+ this._executeAndReschedule();
+ }
+ else {
+ this._reschedule(undefined);
+ }
+ }
+ wake() {
+ const currentTime = (0, utils_1.processTimeMS)();
+ const timeSinceLastCall = currentTime - this.lastExecutionEnded;
+ // TODO(NODE-4674): Add error handling and logging to the monitor
+ if (timeSinceLastCall < 0) {
+ return this._executeAndReschedule();
+ }
+ if (this.isExecutionInProgress) {
+ return;
+ }
+ // debounce multiple calls to wake within the `minInterval`
+ if (this.isExpeditedCallToFnScheduled) {
+ return;
+ }
+ // reschedule a call as soon as possible, ensuring the call never happens
+ // faster than the `minInterval`
+ if (timeSinceLastCall < this.minHeartbeatFrequencyMS) {
+ this.isExpeditedCallToFnScheduled = true;
+ this._reschedule(this.minHeartbeatFrequencyMS - timeSinceLastCall);
+ return;
+ }
+ this._executeAndReschedule();
+ }
+ stop() {
+ this.stopped = true;
+ if (this.timerId) {
+ (0, timers_1.clearTimeout)(this.timerId);
+ this.timerId = undefined;
+ }
+ this.lastExecutionEnded = -Infinity;
+ this.isExpeditedCallToFnScheduled = false;
+ }
+ toString() {
+ return JSON.stringify(this);
+ }
+ toJSON() {
+ const currentTime = (0, utils_1.processTimeMS)();
+ const timeSinceLastCall = currentTime - this.lastExecutionEnded;
+ return {
+ timerId: this.timerId != null ? 'set' : 'cleared',
+ lastCallTime: this.lastExecutionEnded,
+ isExpeditedCheckScheduled: this.isExpeditedCallToFnScheduled,
+ stopped: this.stopped,
+ heartbeatFrequencyMS: this.heartbeatFrequencyMS,
+ minHeartbeatFrequencyMS: this.minHeartbeatFrequencyMS,
+ currentTime,
+ timeSinceLastCall
+ };
+ }
+ _reschedule(ms) {
+ if (this.stopped)
+ return;
+ if (this.timerId) {
+ (0, timers_1.clearTimeout)(this.timerId);
+ }
+ this.timerId = (0, timers_1.setTimeout)(this._executeAndReschedule, ms || this.heartbeatFrequencyMS);
+ }
+}
+exports.MonitorInterval = MonitorInterval;
+/** @internal
+ * This class implements the RTT sampling logic specified for [CSOT](https://github.com/mongodb/specifications/blob/bbb335e60cd7ea1e0f7cd9a9443cb95fc9d3b64d/source/client-side-operations-timeout/client-side-operations-timeout.md#drivers-use-minimum-rtt-to-short-circuit-operations)
+ *
+ * This is implemented as a [circular buffer](https://en.wikipedia.org/wiki/Circular_buffer) keeping
+ * the most recent `windowSize` samples
+ * */
+class RTTSampler {
+ constructor(windowSize = 10) {
+ this.rttSamples = new Float64Array(windowSize);
+ this.length = 0;
+ this.writeIndex = 0;
+ }
+ /**
+ * Adds an rtt sample to the end of the circular buffer
+ * When `windowSize` samples have been collected, `addSample` overwrites the least recently added
+ * sample
+ */
+ addSample(sample) {
+ this.rttSamples[this.writeIndex++] = sample;
+ if (this.length < this.rttSamples.length) {
+ this.length++;
+ }
+ this.writeIndex %= this.rttSamples.length;
+ }
+ /**
+ * When \< 2 samples have been collected, returns 0
+ * Otherwise computes the minimum value samples contained in the buffer
+ */
+ min() {
+ if (this.length < 2)
+ return 0;
+ let min = this.rttSamples[0];
+ for (let i = 1; i < this.length; i++) {
+ if (this.rttSamples[i] < min)
+ min = this.rttSamples[i];
+ }
+ return min;
+ }
+ /**
+ * Returns mean of samples contained in the buffer
+ */
+ average() {
+ if (this.length === 0)
+ return 0;
+ let sum = 0;
+ for (let i = 0; i < this.length; i++) {
+ sum += this.rttSamples[i];
+ }
+ return sum / this.length;
+ }
+ /**
+ * Returns most recently inserted element in the buffer
+ * Returns null if the buffer is empty
+ * */
+ get last() {
+ if (this.length === 0)
+ return null;
+ return this.rttSamples[this.writeIndex === 0 ? this.length - 1 : this.writeIndex - 1];
+ }
+ /**
+ * Clear the buffer
+ * NOTE: this does not overwrite the data held in the internal array, just the pointers into
+ * this array
+ */
+ clear() {
+ this.length = 0;
+ this.writeIndex = 0;
+ }
+}
+exports.RTTSampler = RTTSampler;
+//# sourceMappingURL=monitor.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/monitor.js.map b/node_modules/mongodb/lib/sdam/monitor.js.map
new file mode 100644
index 00000000..a587d019
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/monitor.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../src/sdam/monitor.ts"],"names":[],"mappings":";;;AAAA,mCAAkD;AAElD,kCAA8C;AAC9C,6CAA+F;AAE/F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G,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG;gBAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QAChC,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED;;;SAGK;IACL,IAAI,IAAI;QACN,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IACxF,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;IACtB,CAAC;CACF;AAvED,gCAuEC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/server.js b/node_modules/mongodb/lib/sdam/server.js
new file mode 100644
index 00000000..aa39369e
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/server.js
@@ -0,0 +1,404 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Server = void 0;
+const connection_1 = require("../cmap/connection");
+const connection_pool_1 = require("../cmap/connection_pool");
+const errors_1 = require("../cmap/errors");
+const constants_1 = require("../constants");
+const error_1 = require("../error");
+const mongo_types_1 = require("../mongo_types");
+const aggregate_1 = require("../operations/aggregate");
+const transactions_1 = require("../transactions");
+const utils_1 = require("../utils");
+const write_concern_1 = require("../write_concern");
+const common_1 = require("./common");
+const monitor_1 = require("./monitor");
+const server_description_1 = require("./server_description");
+const server_selection_1 = require("./server_selection");
+const stateTransition = (0, utils_1.makeStateMachine)({
+ [common_1.STATE_CLOSED]: [common_1.STATE_CLOSED, common_1.STATE_CONNECTING],
+ [common_1.STATE_CONNECTING]: [common_1.STATE_CONNECTING, common_1.STATE_CLOSING, common_1.STATE_CONNECTED, common_1.STATE_CLOSED],
+ [common_1.STATE_CONNECTED]: [common_1.STATE_CONNECTED, common_1.STATE_CLOSING, common_1.STATE_CLOSED],
+ [common_1.STATE_CLOSING]: [common_1.STATE_CLOSING, common_1.STATE_CLOSED]
+});
+/** @internal */
+class Server extends mongo_types_1.TypedEventEmitter {
+ /** @event */
+ static { this.SERVER_HEARTBEAT_STARTED = constants_1.SERVER_HEARTBEAT_STARTED; }
+ /** @event */
+ static { this.SERVER_HEARTBEAT_SUCCEEDED = constants_1.SERVER_HEARTBEAT_SUCCEEDED; }
+ /** @event */
+ static { this.SERVER_HEARTBEAT_FAILED = constants_1.SERVER_HEARTBEAT_FAILED; }
+ /** @event */
+ static { this.CONNECT = constants_1.CONNECT; }
+ /** @event */
+ static { this.DESCRIPTION_RECEIVED = constants_1.DESCRIPTION_RECEIVED; }
+ /** @event */
+ static { this.CLOSED = constants_1.CLOSED; }
+ /** @event */
+ static { this.ENDED = constants_1.ENDED; }
+ /**
+ * Create a server
+ */
+ constructor(topology, description, options) {
+ super();
+ this.on('error', utils_1.noop);
+ this.serverApi = options.serverApi;
+ const poolOptions = { hostAddress: description.hostAddress, ...options };
+ this.topology = topology;
+ this.pool = new connection_pool_1.ConnectionPool(this, poolOptions);
+ this.s = {
+ description,
+ options,
+ state: common_1.STATE_CLOSED,
+ operationCount: 0
+ };
+ for (const event of [...constants_1.CMAP_EVENTS, ...constants_1.APM_EVENTS]) {
+ this.pool.on(event, (e) => this.emit(event, e));
+ }
+ this.pool.on(connection_1.Connection.CLUSTER_TIME_RECEIVED, (clusterTime) => {
+ this.clusterTime = clusterTime;
+ });
+ if (this.loadBalanced) {
+ this.monitor = null;
+ // monitoring is disabled in load balancing mode
+ return;
+ }
+ // create the monitor
+ this.monitor = new monitor_1.Monitor(this, this.s.options);
+ for (const event of constants_1.HEARTBEAT_EVENTS) {
+ this.monitor.on(event, (e) => this.emit(event, e));
+ }
+ this.monitor.on('resetServer', (error) => markServerUnknown(this, error));
+ this.monitor.on(Server.SERVER_HEARTBEAT_SUCCEEDED, (event) => {
+ this.emit(Server.DESCRIPTION_RECEIVED, new server_description_1.ServerDescription(this.description.hostAddress, event.reply, {
+ roundTripTime: this.monitor?.roundTripTime,
+ minRoundTripTime: this.monitor?.minRoundTripTime
+ }));
+ if (this.s.state === common_1.STATE_CONNECTING) {
+ stateTransition(this, common_1.STATE_CONNECTED);
+ this.emit(Server.CONNECT, this);
+ }
+ });
+ }
+ get clusterTime() {
+ return this.topology.clusterTime;
+ }
+ set clusterTime(clusterTime) {
+ this.topology.clusterTime = clusterTime;
+ }
+ get description() {
+ return this.s.description;
+ }
+ get name() {
+ return this.s.description.address;
+ }
+ get autoEncrypter() {
+ if (this.s.options && this.s.options.autoEncrypter) {
+ return this.s.options.autoEncrypter;
+ }
+ return;
+ }
+ get loadBalanced() {
+ return this.topology.description.type === common_1.TopologyType.LoadBalanced;
+ }
+ /**
+ * Initiate server connect
+ */
+ connect() {
+ if (this.s.state !== common_1.STATE_CLOSED) {
+ return;
+ }
+ stateTransition(this, common_1.STATE_CONNECTING);
+ // If in load balancer mode we automatically set the server to
+ // a load balancer. It never transitions out of this state and
+ // has no monitor.
+ if (!this.loadBalanced) {
+ this.monitor?.connect();
+ }
+ else {
+ stateTransition(this, common_1.STATE_CONNECTED);
+ this.emit(Server.CONNECT, this);
+ }
+ }
+ closeCheckedOutConnections() {
+ return this.pool.closeCheckedOutConnections();
+ }
+ /** Destroy the server connection */
+ close() {
+ if (this.s.state === common_1.STATE_CLOSED) {
+ return;
+ }
+ stateTransition(this, common_1.STATE_CLOSING);
+ if (!this.loadBalanced) {
+ this.monitor?.close();
+ }
+ this.pool.close();
+ stateTransition(this, common_1.STATE_CLOSED);
+ this.emit('closed');
+ }
+ /**
+ * Immediately schedule monitoring of this server. If there already an attempt being made
+ * this will be a no-op.
+ */
+ requestCheck() {
+ if (!this.loadBalanced) {
+ this.monitor?.requestCheck();
+ }
+ }
+ async command(operation, timeoutContext) {
+ if (this.s.state === common_1.STATE_CLOSING || this.s.state === common_1.STATE_CLOSED) {
+ throw new error_1.MongoServerClosedError();
+ }
+ const session = operation.session;
+ let conn = session?.pinnedConnection;
+ this.incrementOperationCount();
+ if (conn == null) {
+ try {
+ conn = await this.pool.checkOut({ timeoutContext, signal: operation.options.signal });
+ }
+ catch (checkoutError) {
+ this.decrementOperationCount();
+ if (!(checkoutError instanceof errors_1.PoolClearedError))
+ this.handleError(checkoutError);
+ throw checkoutError;
+ }
+ }
+ let reauthPromise = null;
+ const cleanup = () => {
+ this.decrementOperationCount();
+ if (session?.pinnedConnection !== conn) {
+ if (reauthPromise != null) {
+ // The reauth promise only exists if it hasn't thrown.
+ const checkBackIn = () => {
+ this.pool.checkIn(conn);
+ };
+ void reauthPromise.then(checkBackIn, checkBackIn);
+ }
+ else {
+ this.pool.checkIn(conn);
+ }
+ }
+ };
+ let cmd;
+ try {
+ cmd = operation.buildCommand(conn, session);
+ }
+ catch (e) {
+ cleanup();
+ throw e;
+ }
+ const options = operation.buildOptions(timeoutContext);
+ const ns = operation.ns;
+ if (this.loadBalanced && isPinnableCommand(cmd, session) && !session?.pinnedConnection) {
+ session?.pin(conn);
+ }
+ options.directConnection = this.topology.s.options.directConnection;
+ const omitReadPreference = operation instanceof aggregate_1.AggregateOperation &&
+ operation.hasWriteStage &&
+ (0, utils_1.maxWireVersion)(conn) < server_selection_1.MIN_SECONDARY_WRITE_WIRE_VERSION;
+ if (omitReadPreference) {
+ delete options.readPreference;
+ }
+ if (this.description.iscryptd) {
+ options.omitMaxTimeMS = true;
+ }
+ try {
+ try {
+ const res = await conn.command(ns, cmd, options, operation.SERVER_COMMAND_RESPONSE_TYPE);
+ (0, write_concern_1.throwIfWriteConcernError)(res);
+ return res;
+ }
+ catch (commandError) {
+ throw this.decorateCommandError(conn, cmd, options, commandError);
+ }
+ }
+ catch (operationError) {
+ if (operationError instanceof error_1.MongoError &&
+ operationError.code?.valueOf() === error_1.MONGODB_ERROR_CODES.Reauthenticate) {
+ reauthPromise = this.pool.reauthenticate(conn);
+ reauthPromise.then(undefined, error => {
+ reauthPromise = null;
+ (0, utils_1.squashError)(error);
+ });
+ await (0, utils_1.abortable)(reauthPromise, options);
+ reauthPromise = null; // only reachable if reauth succeeds
+ try {
+ const res = await conn.command(ns, cmd, options, operation.SERVER_COMMAND_RESPONSE_TYPE);
+ (0, write_concern_1.throwIfWriteConcernError)(res);
+ return res;
+ }
+ catch (commandError) {
+ throw this.decorateCommandError(conn, cmd, options, commandError);
+ }
+ }
+ else {
+ throw operationError;
+ }
+ }
+ finally {
+ cleanup();
+ }
+ }
+ /**
+ * Handle SDAM error
+ * @internal
+ */
+ handleError(error, connection) {
+ if (!(error instanceof error_1.MongoError)) {
+ return;
+ }
+ if (isStaleError(this, error)) {
+ return;
+ }
+ const isNetworkNonTimeoutError = error instanceof error_1.MongoNetworkError && !(error instanceof error_1.MongoNetworkTimeoutError);
+ const isNetworkTimeoutBeforeHandshakeError = error instanceof error_1.MongoNetworkError && error.beforeHandshake;
+ const isAuthOrEstablishmentHandshakeError = error.hasErrorLabel(error_1.MongoErrorLabel.HandshakeError);
+ const isSystemOverloadError = error.hasErrorLabel(error_1.MongoErrorLabel.SystemOverloadedError);
+ // Perhaps questionable and divergent from the spec, but considering MongoParseErrors like state change errors was legacy behavior.
+ if ((0, error_1.isStateChangeError)(error) || error instanceof error_1.MongoParseError) {
+ const shouldClearPool = (0, error_1.isNodeShuttingDownError)(error);
+ // from the SDAM spec: The driver MUST synchronize clearing the pool with updating the topology.
+ // In load balanced mode: there is no monitoring, so there is no topology to update. We simply clear the pool.
+ // For other topologies: the `ResetPool` label instructs the topology to clear the server's pool in `updateServer()`.
+ if (!this.loadBalanced) {
+ if (shouldClearPool) {
+ error.addErrorLabel(error_1.MongoErrorLabel.ResetPool);
+ }
+ markServerUnknown(this, error);
+ queueMicrotask(() => this.requestCheck());
+ return;
+ }
+ if (connection && shouldClearPool) {
+ this.pool.clear({ serviceId: connection.serviceId });
+ }
+ }
+ else if (isNetworkNonTimeoutError ||
+ isNetworkTimeoutBeforeHandshakeError ||
+ isAuthOrEstablishmentHandshakeError) {
+ // Do NOT clear the pool if we encounter a system overloaded error.
+ if (isSystemOverloadError) {
+ return;
+ }
+ // from the SDAM spec: The driver MUST synchronize clearing the pool with updating the topology.
+ // In load balanced mode: there is no monitoring, so there is no topology to update. We simply clear the pool.
+ // For other topologies: the `ResetPool` label instructs the topology to clear the server's pool in `updateServer()`.
+ if (!this.loadBalanced) {
+ error.addErrorLabel(error_1.MongoErrorLabel.ResetPool);
+ markServerUnknown(this, error);
+ }
+ else if (connection) {
+ this.pool.clear({ serviceId: connection.serviceId });
+ }
+ }
+ }
+ /**
+ * Ensure that error is properly decorated and internal state is updated before throwing
+ * @internal
+ */
+ decorateCommandError(connection, cmd, options, error) {
+ if (typeof error !== 'object' || error == null || !('name' in error)) {
+ throw new error_1.MongoRuntimeError('An unexpected error type: ' + typeof error);
+ }
+ if (error.name === 'AbortError' && 'cause' in error && error.cause instanceof error_1.MongoError) {
+ error = error.cause;
+ }
+ if (!(error instanceof error_1.MongoError)) {
+ // Node.js or some other error we have not special handling for
+ return error;
+ }
+ if (connectionIsStale(this.pool, connection)) {
+ return error;
+ }
+ const session = options?.session;
+ if (error instanceof error_1.MongoNetworkError) {
+ if (session && !session.hasEnded && session.serverSession) {
+ session.serverSession.isDirty = true;
+ }
+ // inActiveTransaction check handles commit and abort.
+ if (inActiveTransaction(session, cmd) &&
+ !error.hasErrorLabel(error_1.MongoErrorLabel.TransientTransactionError)) {
+ error.addErrorLabel(error_1.MongoErrorLabel.TransientTransactionError);
+ }
+ if ((isRetryableWritesEnabled(this.topology) || (0, transactions_1.isTransactionCommand)(cmd)) &&
+ (0, utils_1.supportsRetryableWrites)(this) &&
+ !inActiveTransaction(session, cmd)) {
+ error.addErrorLabel(error_1.MongoErrorLabel.RetryableWriteError);
+ }
+ }
+ else {
+ if ((isRetryableWritesEnabled(this.topology) || (0, transactions_1.isTransactionCommand)(cmd)) &&
+ (0, error_1.needsRetryableWriteLabel)(error, (0, utils_1.maxWireVersion)(this), this.description.type) &&
+ !inActiveTransaction(session, cmd)) {
+ error.addErrorLabel(error_1.MongoErrorLabel.RetryableWriteError);
+ }
+ }
+ if (session &&
+ session.isPinned &&
+ error.hasErrorLabel(error_1.MongoErrorLabel.TransientTransactionError)) {
+ session.unpin({ force: true });
+ }
+ this.handleError(error, connection);
+ return error;
+ }
+ /**
+ * Decrement the operation count, returning the new count.
+ */
+ decrementOperationCount() {
+ return (this.s.operationCount -= 1);
+ }
+ /**
+ * Increment the operation count, returning the new count.
+ */
+ incrementOperationCount() {
+ return (this.s.operationCount += 1);
+ }
+}
+exports.Server = Server;
+function markServerUnknown(server, error) {
+ // Load balancer servers can never be marked unknown.
+ if (server.loadBalanced) {
+ return;
+ }
+ if (error instanceof error_1.MongoNetworkError && !(error instanceof error_1.MongoNetworkTimeoutError)) {
+ server.monitor?.reset();
+ }
+ server.emit(Server.DESCRIPTION_RECEIVED, new server_description_1.ServerDescription(server.description.hostAddress, undefined, { error }));
+}
+function isPinnableCommand(cmd, session) {
+ if (session) {
+ return (session.inTransaction() ||
+ (session.transaction.isCommitted && 'commitTransaction' in cmd) ||
+ 'aggregate' in cmd ||
+ 'find' in cmd ||
+ 'getMore' in cmd ||
+ 'listCollections' in cmd ||
+ 'listIndexes' in cmd ||
+ 'bulkWrite' in cmd);
+ }
+ return false;
+}
+function connectionIsStale(pool, connection) {
+ if (connection.serviceId) {
+ return (connection.generation !== pool.serviceGenerations.get(connection.serviceId.toHexString()));
+ }
+ return connection.generation !== pool.generation;
+}
+function inActiveTransaction(session, cmd) {
+ return session && session.inTransaction() && !(0, transactions_1.isTransactionCommand)(cmd);
+}
+/** this checks the retryWrites option passed down from the client options, it
+ * does not check if the server supports retryable writes */
+function isRetryableWritesEnabled(topology) {
+ return topology.s.options.retryWrites !== false;
+}
+function isStaleError(server, error) {
+ const currentGeneration = server.pool.generation;
+ const generation = error.connectionGeneration;
+ if (generation && generation < currentGeneration) {
+ return true;
+ }
+ const currentTopologyVersion = server.description.topologyVersion;
+ return (0, server_description_1.compareTopologyVersion)(currentTopologyVersion, error.topologyVersion) >= 0;
+}
+//# sourceMappingURL=server.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/server.js.map b/node_modules/mongodb/lib/sdam/server.js.map
new file mode 100644
index 00000000..486bc9e8
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/server.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/sdam/server.ts"],"names":[],"mappings":";;;AAEA,mDAAqE;AACrE,6DAIiC;AACjC,2CAAkD;AAClD,4CAWsB;AACtB,oCAckB;AAElB,gDAAmE;AACnE,uDAA6D;AAK7D,kDAAuD;AACvD,oCAQkB;AAClB,oDAA4D;AAC5D,qCAOkB;AAMlB,uCAAyD;AACzD,6DAAiF;AACjF,yDAAsE;AAGtE,MAAM,eAAe,GAAG,IAAA,wBAAgB,EAAC;IACvC,CAAC,qBAAY,CAAC,EAAE,CAAC,qBAAY,EAAE,yBAAgB,CA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wB,CAAC,QAAkB;IAClD,OAAO,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,KAAK,KAAK,CAAC;AAClD,CAAC;AAED,SAAS,YAAY,CAAC,MAAc,EAAE,KAAiB;IACrD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;IACjD,MAAM,UAAU,GAAG,KAAK,CAAC,oBAAoB,CAAC;IAE9C,IAAI,UAAU,IAAI,UAAU,GAAG,iBAAiB,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,sBAAsB,GAAG,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC;IAClE,OAAO,IAAA,2CAAsB,EAAC,sBAAsB,EAAE,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/server_description.js b/node_modules/mongodb/lib/sdam/server_description.js
new file mode 100644
index 00000000..654253d1
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/server_description.js
@@ -0,0 +1,204 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ServerDescription = void 0;
+exports.parseServerType = parseServerType;
+exports.compareTopologyVersion = compareTopologyVersion;
+const bson_1 = require("../bson");
+const error_1 = require("../error");
+const utils_1 = require("../utils");
+const common_1 = require("./common");
+const WRITABLE_SERVER_TYPES = new Set([
+ common_1.ServerType.RSPrimary,
+ common_1.ServerType.Standalone,
+ common_1.ServerType.Mongos,
+ common_1.ServerType.LoadBalancer
+]);
+const DATA_BEARING_SERVER_TYPES = new Set([
+ common_1.ServerType.RSPrimary,
+ common_1.ServerType.RSSecondary,
+ common_1.ServerType.Mongos,
+ common_1.ServerType.Standalone,
+ common_1.ServerType.LoadBalancer
+]);
+/**
+ * The client's view of a single server, based on the most recent hello outcome.
+ *
+ * Internal type, not meant to be directly instantiated
+ * @public
+ */
+class ServerDescription {
+ /**
+ * Create a ServerDescription
+ * @internal
+ *
+ * @param address - The address of the server
+ * @param hello - An optional hello response for this server
+ */
+ constructor(address, hello, options = {}) {
+ if (address == null || address === '') {
+ throw new error_1.MongoRuntimeError('ServerDescription must be provided with a non-empty address');
+ }
+ this.address =
+ typeof address === 'string'
+ ? utils_1.HostAddress.fromString(address).toString() // Use HostAddress to normalize
+ : address.toString();
+ this.type = parseServerType(hello, options);
+ this.hosts = hello?.hosts?.map((host) => host.toLowerCase()) ?? [];
+ this.passives = hello?.passives?.map((host) => host.toLowerCase()) ?? [];
+ this.arbiters = hello?.arbiters?.map((host) => host.toLowerCase()) ?? [];
+ this.tags = hello?.tags ?? {};
+ this.minWireVersion = hello?.minWireVersion ?? 0;
+ this.maxWireVersion = hello?.maxWireVersion ?? 0;
+ this.roundTripTime = options?.roundTripTime ?? -1;
+ this.minRoundTripTime = options?.minRoundTripTime ?? 0;
+ this.lastUpdateTime = (0, utils_1.processTimeMS)();
+ this.lastWriteDate = hello?.lastWrite?.lastWriteDate ?? 0;
+ // NOTE: This actually builds the stack string instead of holding onto the getter and all its
+ // associated references. This is done to prevent a memory leak.
+ this.error = options.error ?? null;
+ this.error?.stack;
+ // TODO(NODE-2674): Preserve int64 sent from MongoDB
+ this.topologyVersion = this.error?.topologyVersion ?? hello?.topologyVersion ?? null;
+ this.setName = hello?.setName ?? null;
+ this.setVersion = hello?.setVersion ?? null;
+ this.electionId = hello?.electionId ?? null;
+ this.logicalSessionTimeoutMinutes = hello?.logicalSessionTimeoutMinutes ?? null;
+ this.maxMessageSizeBytes = hello?.maxMessageSizeBytes ?? null;
+ this.maxWriteBatchSize = hello?.maxWriteBatchSize ?? null;
+ this.maxBsonObjectSize = hello?.maxBsonObjectSize ?? null;
+ this.primary = hello?.primary ?? null;
+ this.me = hello?.me?.toLowerCase() ?? null;
+ this.$clusterTime = hello?.$clusterTime ?? null;
+ this.iscryptd = Boolean(hello?.iscryptd);
+ }
+ get hostAddress() {
+ return utils_1.HostAddress.fromString(this.address);
+ }
+ get allHosts() {
+ return this.hosts.concat(this.arbiters).concat(this.passives);
+ }
+ /** Is this server available for reads*/
+ get isReadable() {
+ return this.type === common_1.ServerType.RSSecondary || this.isWritable;
+ }
+ /** Is this server data bearing */
+ get isDataBearing() {
+ return DATA_BEARING_SERVER_TYPES.has(this.type);
+ }
+ /** Is this server available for writes */
+ get isWritable() {
+ return WRITABLE_SERVER_TYPES.has(this.type);
+ }
+ get host() {
+ const chopLength = `:${this.port}`.length;
+ return this.address.slice(0, -chopLength);
+ }
+ get port() {
+ const port = this.address.split(':').pop();
+ return port ? Number.parseInt(port, 10) : 27017;
+ }
+ /**
+ * Determines if another `ServerDescription` is equal to this one per the rules defined in the SDAM specification.
+ * @see https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md
+ */
+ equals(other) {
+ // Despite using the comparator that would determine a nullish topologyVersion as greater than
+ // for equality we should only always perform direct equality comparison
+ const topologyVersionsEqual = this.topologyVersion === other?.topologyVersion ||
+ compareTopologyVersion(this.topologyVersion, other?.topologyVersion) === 0;
+ const electionIdsEqual = this.electionId != null && other?.electionId != null
+ ? (0, utils_1.compareObjectId)(this.electionId, other.electionId) === 0
+ : this.electionId === other?.electionId;
+ return (other != null &&
+ other.iscryptd === this.iscryptd &&
+ (0, utils_1.errorStrictEqual)(this.error, other.error) &&
+ this.type === other.type &&
+ this.minWireVersion === other.minWireVersion &&
+ (0, utils_1.arrayStrictEqual)(this.hosts, other.hosts) &&
+ tagsStrictEqual(this.tags, other.tags) &&
+ this.setName === other.setName &&
+ this.setVersion === other.setVersion &&
+ electionIdsEqual &&
+ this.primary === other.primary &&
+ this.logicalSessionTimeoutMinutes === other.logicalSessionTimeoutMinutes &&
+ topologyVersionsEqual);
+ }
+}
+exports.ServerDescription = ServerDescription;
+// Parses a `hello` message and determines the server type
+function parseServerType(hello, options) {
+ if (options?.loadBalanced) {
+ return common_1.ServerType.LoadBalancer;
+ }
+ if (!hello || !hello.ok) {
+ return common_1.ServerType.Unknown;
+ }
+ if (hello.isreplicaset) {
+ return common_1.ServerType.RSGhost;
+ }
+ if (hello.msg && hello.msg === 'isdbgrid') {
+ return common_1.ServerType.Mongos;
+ }
+ if (hello.setName) {
+ if (hello.hidden) {
+ return common_1.ServerType.RSOther;
+ }
+ else if (hello.isWritablePrimary) {
+ return common_1.ServerType.RSPrimary;
+ }
+ else if (hello.secondary) {
+ return common_1.ServerType.RSSecondary;
+ }
+ else if (hello.arbiterOnly) {
+ return common_1.ServerType.RSArbiter;
+ }
+ else {
+ return common_1.ServerType.RSOther;
+ }
+ }
+ return common_1.ServerType.Standalone;
+}
+function tagsStrictEqual(tags, tags2) {
+ const tagsKeys = Object.keys(tags);
+ const tags2Keys = Object.keys(tags2);
+ return (tagsKeys.length === tags2Keys.length &&
+ tagsKeys.every((key) => tags2[key] === tags[key]));
+}
+/**
+ * Compares two topology versions.
+ *
+ * 1. If the response topologyVersion is unset or the ServerDescription's
+ * topologyVersion is null, the client MUST assume the response is more recent.
+ * 1. If the response's topologyVersion.processId is not equal to the
+ * ServerDescription's, the client MUST assume the response is more recent.
+ * 1. If the response's topologyVersion.processId is equal to the
+ * ServerDescription's, the client MUST use the counter field to determine
+ * which topologyVersion is more recent.
+ *
+ * ```ts
+ * currentTv < newTv === -1
+ * currentTv === newTv === 0
+ * currentTv > newTv === 1
+ * ```
+ */
+function compareTopologyVersion(currentTv, newTv) {
+ if (currentTv == null || newTv == null) {
+ return -1;
+ }
+ if (!currentTv.processId.equals(newTv.processId)) {
+ return -1;
+ }
+ // TODO(NODE-2674): Preserve int64 sent from MongoDB
+ const currentCounter = typeof currentTv.counter === 'bigint'
+ ? bson_1.Long.fromBigInt(currentTv.counter)
+ : bson_1.Long.isLong(currentTv.counter)
+ ? currentTv.counter
+ : bson_1.Long.fromNumber(currentTv.counter);
+ const newCounter = typeof newTv.counter === 'bigint'
+ ? bson_1.Long.fromBigInt(newTv.counter)
+ : bson_1.Long.isLong(newTv.counter)
+ ? newTv.counter
+ : bson_1.Long.fromNumber(newTv.counter);
+ return currentCounter.compare(newCounter);
+}
+//# sourceMappingURL=server_description.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/server_description.js.map b/node_modules/mongodb/lib/sdam/server_description.js.map
new file mode 100644
index 00000000..09d6e2e0
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/server_description.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"server_description.js","sourceRoot":"","sources":["../../src/sdam/server_description.ts"],"names":[],"mappings":";;;AA+MA,0CAgCC;AA6BD,wDA4BC;AAxSD,kCAA6D;AAC7D,oCAA8D;AAC9D,oCAMkB;AAClB,qCAAwD;AAExD,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAa;IAChD,mBAAU,CAAC,SAAS;IACpB,mBAAU,CAAC,UAAU;IACrB,mBAAU,CAAC,MAAM;IACjB,mBAAU,CAAC,YAAY;CACxB,CAAC,CAAC;AAEH,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAa;IACpD,mBAAU,CAAC,SAAS;IACpB,mBAAU,CAAC,WAAW;IACtB,mBAAU,CAAC,MAAM;IACjB,mBAAU,CAAC,UAAU;IACrB,mBAAU,CAAC,YAAY;CACxB,CAAC,CAAC;AAyBH;;;;;GAKG;AACH,MAAa,iBAAiB;IAkC5B;;;;;;OAMG;IACH,YACE,OAA6B,EAC7B,KAAgB,EAChB,UAAoC,EAAE;QAEtC,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,yBAAiB,CAAC,6DAA6D,CAAC,CAAC;QAC7F,CAAC;QAED,IAAI,CAAC,OAAO;YACV,OAAO,OAAO,KAAK,QAAQ;gBACzB,CAAC,CAAC,mBAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,+BAA+B;gBAC5E,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,e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nB,CAAC,CAAC,WAAI,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAE3C,MAAM,UAAU,GACd,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;QAC/B,CAAC,CAAC,WAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC;QAChC,CAAC,CAAC,WAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;YAC1B,CAAC,CAAC,KAAK,CAAC,OAAO;YACf,CAAC,CAAC,WAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAC5C,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/server_selection.js b/node_modules/mongodb/lib/sdam/server_selection.js
new file mode 100644
index 00000000..838506b0
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/server_selection.js
@@ -0,0 +1,294 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.DeprioritizedServers = exports.MIN_SECONDARY_WRITE_WIRE_VERSION = void 0;
+exports.writableServerSelector = writableServerSelector;
+exports.sameServerSelector = sameServerSelector;
+exports.secondaryWritableServerSelector = secondaryWritableServerSelector;
+exports.readPreferenceServerSelector = readPreferenceServerSelector;
+const error_1 = require("../error");
+const read_preference_1 = require("../read_preference");
+const common_1 = require("./common");
+// max staleness constants
+const IDLE_WRITE_PERIOD = 10000;
+const SMALLEST_MAX_STALENESS_SECONDS = 90;
+// Minimum version to try writes on secondaries.
+exports.MIN_SECONDARY_WRITE_WIRE_VERSION = 13;
+/** @internal */
+class DeprioritizedServers {
+ constructor(descriptions) {
+ this.deprioritized = new Set();
+ for (const description of descriptions ?? []) {
+ this.add(description);
+ }
+ }
+ add({ address }) {
+ this.deprioritized.add(address);
+ }
+ has({ address }) {
+ return this.deprioritized.has(address);
+ }
+}
+exports.DeprioritizedServers = DeprioritizedServers;
+function filterDeprioritized(candidates, deprioritized) {
+ const filtered = candidates.filter(candidate => !deprioritized.has(candidate));
+ return filtered.length ? filtered : candidates;
+}
+/**
+ * Returns a server selector that selects for writable servers
+ */
+function writableServerSelector() {
+ return function writableServer(topologyDescription, servers, deprioritized) {
+ const eligibleServers = filterDeprioritized(servers.filter(({ isWritable }) => isWritable), deprioritized);
+ return latencyWindowReducer(topologyDescription, eligibleServers);
+ };
+}
+/**
+ * The purpose of this selector is to select the same server, only
+ * if it is in a state that it can have commands sent to it.
+ */
+function sameServerSelector(description) {
+ return function sameServerSelector(_topologyDescription, servers, _deprioritized) {
+ if (!description)
+ return [];
+ // Filter the servers to match the provided description only if
+ // the type is not unknown.
+ return servers.filter(sd => {
+ return sd.address === description.address && sd.type !== common_1.ServerType.Unknown;
+ });
+ };
+}
+/**
+ * Returns a server selector that uses a read preference to select a
+ * server potentially for a write on a secondary.
+ */
+function secondaryWritableServerSelector(wireVersion, readPreference) {
+ // If server version < 5.0, read preference always primary.
+ // If server version >= 5.0...
+ // - If read preference is supplied, use that.
+ // - If no read preference is supplied, use primary.
+ if (!readPreference ||
+ !wireVersion ||
+ (wireVersion && wireVersion < exports.MIN_SECONDARY_WRITE_WIRE_VERSION)) {
+ return readPreferenceServerSelector(read_preference_1.ReadPreference.primary);
+ }
+ return readPreferenceServerSelector(readPreference);
+}
+/**
+ * Reduces the passed in array of servers by the rules of the "Max Staleness" specification
+ * found here:
+ *
+ * @see https://github.com/mongodb/specifications/blob/master/source/max-staleness/max-staleness.md
+ *
+ * @param readPreference - The read preference providing max staleness guidance
+ * @param topologyDescription - The topology description
+ * @param servers - The list of server descriptions to be reduced
+ * @returns The list of servers that satisfy the requirements of max staleness
+ */
+function maxStalenessReducer(readPreference, topologyDescription, servers) {
+ if (readPreference.maxStalenessSeconds == null || readPreference.maxStalenessSeconds < 0) {
+ return servers;
+ }
+ const maxStaleness = readPreference.maxStalenessSeconds;
+ const maxStalenessVariance = (topologyDescription.heartbeatFrequencyMS + IDLE_WRITE_PERIOD) / 1000;
+ if (maxStaleness < maxStalenessVariance) {
+ throw new error_1.MongoInvalidArgumentError(`Option "maxStalenessSeconds" must be at least ${maxStalenessVariance} seconds`);
+ }
+ if (maxStaleness < SMALLEST_MAX_STALENESS_SECONDS) {
+ throw new error_1.MongoInvalidArgumentError(`Option "maxStalenessSeconds" must be at least ${SMALLEST_MAX_STALENESS_SECONDS} seconds`);
+ }
+ if (topologyDescription.type === common_1.TopologyType.ReplicaSetWithPrimary) {
+ const primary = Array.from(topologyDescription.servers.values()).filter(primaryFilter)[0];
+ return servers.filter((server) => {
+ const stalenessMS = server.lastUpdateTime -
+ server.lastWriteDate -
+ (primary.lastUpdateTime - primary.lastWriteDate) +
+ topologyDescription.heartbeatFrequencyMS;
+ const staleness = stalenessMS / 1000;
+ const maxStalenessSeconds = readPreference.maxStalenessSeconds ?? 0;
+ return staleness <= maxStalenessSeconds;
+ });
+ }
+ if (topologyDescription.type === common_1.TopologyType.ReplicaSetNoPrimary) {
+ if (servers.length === 0) {
+ return servers;
+ }
+ const sMax = servers.reduce((max, s) => s.lastWriteDate > max.lastWriteDate ? s : max);
+ return servers.filter((server) => {
+ const stalenessMS = sMax.lastWriteDate - server.lastWriteDate + topologyDescription.heartbeatFrequencyMS;
+ const staleness = stalenessMS / 1000;
+ const maxStalenessSeconds = readPreference.maxStalenessSeconds ?? 0;
+ return staleness <= maxStalenessSeconds;
+ });
+ }
+ return servers;
+}
+/**
+ * Determines whether a server's tags match a given set of tags.
+ *
+ * A tagset matches the server's tags if every k-v pair in the tagset
+ * is also in the server's tagset.
+ *
+ * Note that this does not requires that every k-v pair in the server's tagset is also
+ * in the client's tagset. The server's tagset is required only to be a superset of the
+ * client's tags.
+ *
+ * @see https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.md#tag_sets
+ *
+ * @param tagSet - The requested tag set to match
+ * @param serverTags - The server's tags
+ */
+function tagSetMatch(tagSet, serverTags) {
+ return Object.entries(tagSet).every(([key, value]) => serverTags[key] != null && serverTags[key] === value);
+}
+/**
+ * Reduces a set of server descriptions based on tags requested by the read preference
+ *
+ * @param readPreference - The read preference providing the requested tags
+ * @param servers - The list of server descriptions to reduce
+ * @returns The list of servers matching the requested tags
+ */
+function tagSetReducer({ tags }, servers) {
+ if (tags == null || tags.length === 0) {
+ // empty tag sets match all servers
+ return servers;
+ }
+ for (const tagSet of tags) {
+ const serversMatchingTagset = servers.filter((s) => tagSetMatch(tagSet, s.tags));
+ if (serversMatchingTagset.length) {
+ return serversMatchingTagset;
+ }
+ }
+ return [];
+}
+/**
+ * Reduces a list of servers to ensure they fall within an acceptable latency window. This is
+ * further specified in the "Server Selection" specification, found here:
+ *
+ * @see https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.md
+ *
+ * @param topologyDescription - The topology description
+ * @param servers - The list of servers to reduce
+ * @returns The servers which fall within an acceptable latency window
+ */
+function latencyWindowReducer(topologyDescription, servers) {
+ const low = servers.reduce((min, server) => Math.min(server.roundTripTime, min), Infinity);
+ const high = low + topologyDescription.localThresholdMS;
+ return servers.filter(server => server.roundTripTime <= high && server.roundTripTime >= low);
+}
+// filters
+function primaryFilter(server) {
+ return server.type === common_1.ServerType.RSPrimary;
+}
+function secondaryFilter(server) {
+ return server.type === common_1.ServerType.RSSecondary;
+}
+function nearestFilter(server) {
+ return server.type === common_1.ServerType.RSSecondary || server.type === common_1.ServerType.RSPrimary;
+}
+function knownFilter(server) {
+ return server.type !== common_1.ServerType.Unknown;
+}
+function loadBalancerFilter(server) {
+ return server.type === common_1.ServerType.LoadBalancer;
+}
+function isDeprioritizedFactory(deprioritized) {
+ return server =>
+ // if any deprioritized servers equal the server, here we are.
+ !deprioritized.has(server);
+}
+function secondarySelector(readPreference, topologyDescription, servers, deprioritized) {
+ const mode = readPreference.mode;
+ switch (mode) {
+ case 'primary':
+ // Note: no need to filter for deprioritized servers. A replica set has only one primary; that means that
+ // we are in one of two scenarios:
+ // 1. deprioritized servers is empty - return the primary.
+ // 2. deprioritized servers contains the primary - return the primary.
+ return servers.filter(primaryFilter);
+ case 'primaryPreferred': {
+ const primary = servers.filter(primaryFilter);
+ // If there is a primary and it is not deprioritized, use the primary. Otherwise,
+ // check for secondaries.
+ const eligiblePrimary = primary.filter(isDeprioritizedFactory(deprioritized));
+ if (eligiblePrimary.length) {
+ return eligiblePrimary;
+ }
+ // If we make it here, we either have:
+ // 1. a deprioritized primary
+ // 2. no eligible primary
+ // secondaries take precedence of deprioritized primaries.
+ const secondaries = tagSetReducer(readPreference, maxStalenessReducer(readPreference, topologyDescription, servers.filter(secondaryFilter)));
+ const eligibleSecondaries = secondaries.filter(isDeprioritizedFactory(deprioritized));
+ if (eligibleSecondaries.length) {
+ return latencyWindowReducer(topologyDescription, eligibleSecondaries);
+ }
+ // if we make it here, we have no primaries or secondaries that not deprioritized.
+ // prefer the primary (which may not exist, if the topology has no primary).
+ // otherwise, return the secondaries (which also may not exist, but there is nothing else to check here).
+ return primary.length ? primary : latencyWindowReducer(topologyDescription, secondaries);
+ }
+ case 'nearest': {
+ const eligible = filterDeprioritized(tagSetReducer(readPreference, maxStalenessReducer(readPreference, topologyDescription, servers.filter(nearestFilter))), deprioritized);
+ return latencyWindowReducer(topologyDescription, eligible);
+ }
+ case 'secondary':
+ case 'secondaryPreferred': {
+ const secondaries = tagSetReducer(readPreference, maxStalenessReducer(readPreference, topologyDescription, servers.filter(secondaryFilter)));
+ const eligibleSecondaries = secondaries.filter(isDeprioritizedFactory(deprioritized));
+ if (eligibleSecondaries.length) {
+ return latencyWindowReducer(topologyDescription, eligibleSecondaries);
+ }
+ // we have no eligible secondaries, try for a primary if we can.
+ if (mode === read_preference_1.ReadPreference.SECONDARY_PREFERRED) {
+ const primary = servers.filter(primaryFilter);
+ // unlike readPreference=primary, here we do filter for deprioritized servers.
+ // if the primary is deprioritized, deprioritized secondaries take precedence.
+ const eligiblePrimary = primary.filter(isDeprioritizedFactory(deprioritized));
+ if (eligiblePrimary.length)
+ return eligiblePrimary;
+ // we have no eligible primary nor secondaries that have not been deprioritized
+ return secondaries.length
+ ? latencyWindowReducer(topologyDescription, secondaries)
+ : primary;
+ }
+ // return all secondaries in the latency window.
+ return latencyWindowReducer(topologyDescription, secondaries);
+ }
+ default: {
+ const _exhaustiveCheck = mode;
+ throw new error_1.MongoRuntimeError(`unexpected readPreference=${mode} (should never happen). Please report a bug in the Node driver Jira project.`);
+ }
+ }
+}
+/**
+ * Returns a function which selects servers based on a provided read preference
+ *
+ * @param readPreference - The read preference to select with
+ */
+function readPreferenceServerSelector(readPreference) {
+ if (!readPreference.isValid()) {
+ throw new error_1.MongoInvalidArgumentError('Invalid read preference specified');
+ }
+ return function readPreferenceServers(topologyDescription, servers, deprioritized) {
+ switch (topologyDescription.type) {
+ case 'Single':
+ return latencyWindowReducer(topologyDescription, servers.filter(knownFilter));
+ case 'ReplicaSetNoPrimary':
+ case 'ReplicaSetWithPrimary':
+ return secondarySelector(readPreference, topologyDescription, servers, deprioritized);
+ case 'Sharded': {
+ const selectable = filterDeprioritized(servers, deprioritized);
+ return latencyWindowReducer(topologyDescription, selectable.filter(knownFilter));
+ }
+ case 'Unknown':
+ return [];
+ case 'LoadBalanced':
+ return servers.filter(loadBalancerFilter);
+ default: {
+ const _exhaustiveCheck = topologyDescription.type;
+ throw new error_1.MongoRuntimeError(`unexpected topology type: ${topologyDescription.type} (this should never happen). Please file a bug in the Node driver Jira project.`);
+ }
+ }
+ };
+}
+//# sourceMappingURL=server_selection.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/server_selection.js.map b/node_modules/mongodb/lib/sdam/server_selection.js.map
new file mode 100644
index 00000000..cbb635a4
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/server_selection.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"server_selection.js","sourceRoot":"","sources":["../../src/sdam/server_selection.ts"],"names":[],"mappings":";;;AAmDA,wDAaC;AAMD,gDAaC;AAMD,0EAgBC;AAqRD,oEAgCC;AA9ZD,oCAAwE;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GAIG;AACH,SAAgB,4BAA4B,CAAC,cAA8B;IACzE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC;QAC9B,MAAM,IAAI,iCAAyB,CAAC,mCAAmC,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,SAAS,qBAAqB,CACnC,mBAAwC,EACxC,OAA4B,EAC5B,aAAmC;QAEnC,QAAQ,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACjC,KAAK,QAAQ;gBACX,OAAO,oBAAoB,CAAC,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;YAChF,KAAK,qBAAqB,CAAC;YAC3B,KAAK,uBAAuB;gBAC1B,OAAO,iBAAiB,CAAC,cAAc,EAAE,mBAAmB,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;YACxF,KAAK,SAAS,CAAC,CAAC,CAAC;gBACf,MAAM,UAAU,GAAG,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;gBAC/D,OAAO,oBAAoB,CAAC,mBAAmB,EAAE,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;YACnF,CAAC;YACD,KAAK,SAAS;gBACZ,OAAO,EAAE,CAAC;YACZ,KAAK,cAAc;gBACjB,OAAO,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;YAC5C,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,gBAAgB,GAAU,mBAAmB,CAAC,IAAI,CAAC;gBACzD,MAAM,IAAI,yBAAiB,CACzB,6BAA6B,mBAAmB,CAAC,IAAI,kFAAkF,CACxI,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/server_selection_events.js b/node_modules/mongodb/lib/sdam/server_selection_events.js
new file mode 100644
index 00000000..20bc95b0
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/server_selection_events.js
@@ -0,0 +1,85 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.WaitingForSuitableServerEvent = exports.ServerSelectionSucceededEvent = exports.ServerSelectionFailedEvent = exports.ServerSelectionStartedEvent = exports.ServerSelectionEvent = void 0;
+const utils_1 = require(".././utils");
+const constants_1 = require("../constants");
+/**
+ * The base export class for all logs published from server selection
+ * @internal
+ * @category Log Type
+ */
+class ServerSelectionEvent {
+ /** @internal */
+ constructor(selector, topologyDescription, operation) {
+ this.selector = selector;
+ this.operation = operation;
+ this.topologyDescription = topologyDescription;
+ }
+}
+exports.ServerSelectionEvent = ServerSelectionEvent;
+/**
+ * An event published when server selection starts
+ * @internal
+ * @category Event
+ */
+class ServerSelectionStartedEvent extends ServerSelectionEvent {
+ /** @internal */
+ constructor(selector, topologyDescription, operation) {
+ super(selector, topologyDescription, operation);
+ /** @internal */
+ this.name = constants_1.SERVER_SELECTION_STARTED;
+ this.message = 'Server selection started';
+ }
+}
+exports.ServerSelectionStartedEvent = ServerSelectionStartedEvent;
+/**
+ * An event published when a server selection fails
+ * @internal
+ * @category Event
+ */
+class ServerSelectionFailedEvent extends ServerSelectionEvent {
+ /** @internal */
+ constructor(selector, topologyDescription, error, operation) {
+ super(selector, topologyDescription, operation);
+ /** @internal */
+ this.name = constants_1.SERVER_SELECTION_FAILED;
+ this.message = 'Server selection failed';
+ this.failure = error;
+ }
+}
+exports.ServerSelectionFailedEvent = ServerSelectionFailedEvent;
+/**
+ * An event published when server selection succeeds
+ * @internal
+ * @category Event
+ */
+class ServerSelectionSucceededEvent extends ServerSelectionEvent {
+ /** @internal */
+ constructor(selector, topologyDescription, address, operation) {
+ super(selector, topologyDescription, operation);
+ /** @internal */
+ this.name = constants_1.SERVER_SELECTION_SUCCEEDED;
+ this.message = 'Server selection succeeded';
+ const { host, port } = utils_1.HostAddress.fromString(address).toHostPort();
+ this.serverHost = host;
+ this.serverPort = port;
+ }
+}
+exports.ServerSelectionSucceededEvent = ServerSelectionSucceededEvent;
+/**
+ * An event published when server selection is waiting for a suitable server to become available
+ * @internal
+ * @category Event
+ */
+class WaitingForSuitableServerEvent extends ServerSelectionEvent {
+ /** @internal */
+ constructor(selector, topologyDescription, remainingTimeMS, operation) {
+ super(selector, topologyDescription, operation);
+ /** @internal */
+ this.name = constants_1.WAITING_FOR_SUITABLE_SERVER;
+ this.message = 'Waiting for suitable server to become available';
+ this.remainingTimeMS = remainingTimeMS;
+ }
+}
+exports.WaitingForSuitableServerEvent = WaitingForSuitableServerEvent;
+//# sourceMappingURL=server_selection_events.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/server_selection_events.js.map b/node_modules/mongodb/lib/sdam/server_selection_events.js.map
new file mode 100644
index 00000000..b6c719ed
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/server_selection_events.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"server_selection_events.js","sourceRoot":"","sources":["../../src/sdam/server_selection_events.ts"],"names":[],"mappings":";;;AAAA,sCAAyC;AACzC,4CAKsB;AAKtB;;;;GAIG;AACH,MAAsB,oBAAoB;IAmBxC,gBAAgB;IAChB,YACE,QAAkD,EAClD,mBAAwC,EACxC,SAAiB;QAEjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,CAAC;CACF;AA7BD,oDA6BC;AAED;;;;GAIG;AACH,MAAa,2BAA4B,SAAQ,oBAAoB;IAKnE,gBAAgB;IAChB,YACE,QAAkD,EAClD,mBAAwC,EACxC,SAAiB;QAEjB,KAAK,CAAC,QAAQ,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;QAVlD,gBAAgB;QAChB,SAAI,GAAG,oCAAwB,CAAC;QAChC,YAAO,GAAG,0BAA0B,CAAC;IASrC,CAAC;CACF;AAbD,kEAaC;AAED;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,oBAAoB;IAOlE,gBAAgB;IAChB,YACE,QAAkD,EAClD,mBAAwC,EACxC,KAAY,EACZ,SAAiB;QAEjB,KAAK,CAAC,QAAQ,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;QAblD,gBAAgB;QAChB,SAAI,GAAG,mCAAuB,CAAC;QAC/B,YAAO,GAAG,yBAAyB,CAAC;QAYlC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;CACF;AAjBD,gEAiBC;AAED;;;;GAIG;AACH,MAAa,6BAA8B,SAAQ,oBAAoB;IASrE,gBAAgB;IAChB,YACE,QAAkD,EAClD,mBAAwC,EACxC,OAAe,EACf,SAAiB;QAEjB,KAAK,CAAC,QAAQ,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;QAflD,gBAAgB;QAChB,SAAI,GAAG,sCAA0B,CAAC;QAClC,YAAO,GAAG,4BAA4B,CAAC;QAcrC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,mBAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC;QACpE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;CACF;AArBD,sEAqBC;AAED;;;;GAIG;AACH,MAAa,6BAA8B,SAAQ,oBAAoB;IAOrE,gBAAgB;IAChB,YACE,QAAkD,EAClD,mBAAwC,EACxC,eAAuB,EACvB,SAAiB;QAEjB,KAAK,CAAC,QAAQ,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;QAblD,gBAAgB;QAChB,SAAI,GAAG,uCAA2B,CAAC;QACnC,YAAO,GAAG,iDAAiD,CAAC;QAY1D,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;CACF;AAjBD,sEAiBC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/srv_polling.js b/node_modules/mongodb/lib/sdam/srv_polling.js
new file mode 100644
index 00000000..33863388
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/srv_polling.js
@@ -0,0 +1,108 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.SrvPoller = exports.SrvPollingEvent = void 0;
+const dns = require("dns");
+const timers_1 = require("timers");
+const error_1 = require("../error");
+const mongo_types_1 = require("../mongo_types");
+const utils_1 = require("../utils");
+/**
+ * @internal
+ * @category Event
+ */
+class SrvPollingEvent {
+ constructor(srvRecords) {
+ this.srvRecords = srvRecords;
+ }
+ hostnames() {
+ return new Set(this.srvRecords.map(r => utils_1.HostAddress.fromSrvRecord(r).toString()));
+ }
+}
+exports.SrvPollingEvent = SrvPollingEvent;
+/** @internal */
+class SrvPoller extends mongo_types_1.TypedEventEmitter {
+ /** @event */
+ static { this.SRV_RECORD_DISCOVERY = 'srvRecordDiscovery'; }
+ constructor(options) {
+ super();
+ this.on('error', utils_1.noop);
+ if (!options || !options.srvHost) {
+ throw new error_1.MongoRuntimeError('Options for SrvPoller must exist and include srvHost');
+ }
+ this.srvHost = options.srvHost;
+ this.srvMaxHosts = options.srvMaxHosts ?? 0;
+ this.srvServiceName = options.srvServiceName ?? 'mongodb';
+ this.rescanSrvIntervalMS = 60000;
+ this.heartbeatFrequencyMS = options.heartbeatFrequencyMS ?? 10000;
+ this.haMode = false;
+ this.generation = 0;
+ this._timeout = undefined;
+ }
+ get srvAddress() {
+ return `_${this.srvServiceName}._tcp.${this.srvHost}`;
+ }
+ get intervalMS() {
+ return this.haMode ? this.heartbeatFrequencyMS : this.rescanSrvIntervalMS;
+ }
+ start() {
+ if (!this._timeout) {
+ this.schedule();
+ }
+ }
+ stop() {
+ if (this._timeout) {
+ (0, timers_1.clearTimeout)(this._timeout);
+ this.generation += 1;
+ this._timeout = undefined;
+ }
+ }
+ // TODO(NODE-4994): implement new logging logic for SrvPoller failures
+ schedule() {
+ if (this._timeout) {
+ (0, timers_1.clearTimeout)(this._timeout);
+ }
+ this._timeout = (0, timers_1.setTimeout)(() => {
+ this._poll().then(undefined, utils_1.squashError);
+ }, this.intervalMS);
+ }
+ success(srvRecords) {
+ this.haMode = false;
+ this.schedule();
+ this.emit(SrvPoller.SRV_RECORD_DISCOVERY, new SrvPollingEvent(srvRecords));
+ }
+ failure() {
+ this.haMode = true;
+ this.schedule();
+ }
+ async _poll() {
+ const generation = this.generation;
+ let srvRecords;
+ try {
+ srvRecords = await dns.promises.resolve(this.srvAddress, 'SRV');
+ }
+ catch {
+ this.failure();
+ return;
+ }
+ if (generation !== this.generation) {
+ return;
+ }
+ const finalAddresses = [];
+ for (const record of srvRecords) {
+ try {
+ (0, utils_1.checkParentDomainMatch)(record.name, this.srvHost);
+ finalAddresses.push(record);
+ }
+ catch (error) {
+ (0, utils_1.squashError)(error);
+ }
+ }
+ if (!finalAddresses.length) {
+ this.failure();
+ return;
+ }
+ this.success(finalAddresses);
+ }
+}
+exports.SrvPoller = SrvPoller;
+//# sourceMappingURL=srv_polling.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/srv_polling.js.map b/node_modules/mongodb/lib/sdam/srv_polling.js.map
new file mode 100644
index 00000000..d041ef14
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/srv_polling.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"srv_polling.js","sourceRoot":"","sources":["../../src/sdam/srv_polling.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AAC3B,mCAAkD;AAElD,oCAA6C;AAC7C,gDAAmD;AACnD,oCAAkF;AAElF;;;GAGG;AACH,MAAa,eAAe;IAE1B,YAAY,UAA2B;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,mBAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACpF,CAAC;CACF;AATD,0CASC;AAeD,gBA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CAAC;YAChC,IAAI,CAAC;gBACH,IAAA,8BAAsB,EAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAClD,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC9B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAA,mBAAW,EAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/B,CAAC;;AA5GH,8BA6GC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/topology.js b/node_modules/mongodb/lib/sdam/topology.js
new file mode 100644
index 00000000..f24ad306
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/topology.js
@@ -0,0 +1,654 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Topology = void 0;
+const connection_string_1 = require("../connection_string");
+const constants_1 = require("../constants");
+const error_1 = require("../error");
+const mongo_logger_1 = require("../mongo_logger");
+const mongo_types_1 = require("../mongo_types");
+const read_preference_1 = require("../read_preference");
+const timeout_1 = require("../timeout");
+const utils_1 = require("../utils");
+const common_1 = require("./common");
+const events_1 = require("./events");
+const server_1 = require("./server");
+const server_description_1 = require("./server_description");
+const server_selection_1 = require("./server_selection");
+const server_selection_events_1 = require("./server_selection_events");
+const srv_polling_1 = require("./srv_polling");
+const topology_description_1 = require("./topology_description");
+// Global state
+let globalTopologyCounter = 0;
+const stateTransition = (0, utils_1.makeStateMachine)({
+ [common_1.STATE_CLOSED]: [common_1.STATE_CLOSED, common_1.STATE_CONNECTING],
+ [common_1.STATE_CONNECTING]: [common_1.STATE_CONNECTING, common_1.STATE_CLOSING, common_1.STATE_CONNECTED, common_1.STATE_CLOSED],
+ [common_1.STATE_CONNECTED]: [common_1.STATE_CONNECTED, common_1.STATE_CLOSING, common_1.STATE_CLOSED],
+ [common_1.STATE_CLOSING]: [common_1.STATE_CLOSING, common_1.STATE_CLOSED]
+});
+/**
+ * A container of server instances representing a connection to a MongoDB topology.
+ * @internal
+ */
+class Topology extends mongo_types_1.TypedEventEmitter {
+ /** @event */
+ static { this.SERVER_OPENING = constants_1.SERVER_OPENING; }
+ /** @event */
+ static { this.SERVER_CLOSED = constants_1.SERVER_CLOSED; }
+ /** @event */
+ static { this.SERVER_DESCRIPTION_CHANGED = constants_1.SERVER_DESCRIPTION_CHANGED; }
+ /** @event */
+ static { this.TOPOLOGY_OPENING = constants_1.TOPOLOGY_OPENING; }
+ /** @event */
+ static { this.TOPOLOGY_CLOSED = constants_1.TOPOLOGY_CLOSED; }
+ /** @event */
+ static { this.TOPOLOGY_DESCRIPTION_CHANGED = constants_1.TOPOLOGY_DESCRIPTION_CHANGED; }
+ /** @event */
+ static { this.ERROR = constants_1.ERROR; }
+ /** @event */
+ static { this.OPEN = constants_1.OPEN; }
+ /** @event */
+ static { this.CONNECT = constants_1.CONNECT; }
+ /** @event */
+ static { this.CLOSE = constants_1.CLOSE; }
+ /** @event */
+ static { this.TIMEOUT = constants_1.TIMEOUT; }
+ /**
+ * @param seedlist - a list of HostAddress instances to connect to
+ */
+ constructor(client, seeds, options) {
+ super();
+ this.on('error', utils_1.noop);
+ this.client = client;
+ // Options should only be undefined in tests, MongoClient will always have defined options
+ options = options ?? {
+ hosts: [utils_1.HostAddress.fromString('localhost:27017')],
+ ...Object.fromEntries(connection_string_1.DEFAULT_OPTIONS.entries())
+ };
+ if (typeof seeds === 'string') {
+ seeds = [utils_1.HostAddress.fromString(seeds)];
+ }
+ else if (!Array.isArray(seeds)) {
+ seeds = [seeds];
+ }
+ const seedlist = [];
+ for (const seed of seeds) {
+ if (typeof seed === 'string') {
+ seedlist.push(utils_1.HostAddress.fromString(seed));
+ }
+ else if (seed instanceof utils_1.HostAddress) {
+ seedlist.push(seed);
+ }
+ else {
+ // FIXME(NODE-3483): May need to be a MongoParseError
+ throw new error_1.MongoRuntimeError(`Topology cannot be constructed from ${JSON.stringify(seed)}`);
+ }
+ }
+ const topologyType = topologyTypeFromOptions(options);
+ const topologyId = globalTopologyCounter++;
+ const selectedHosts = options.srvMaxHosts == null ||
+ options.srvMaxHosts === 0 ||
+ options.srvMaxHosts >= seedlist.length
+ ? seedlist
+ : (0, utils_1.shuffle)(seedlist, options.srvMaxHosts);
+ const serverDescriptions = new Map();
+ for (const hostAddress of selectedHosts) {
+ serverDescriptions.set(hostAddress.toString(), new server_description_1.ServerDescription(hostAddress));
+ }
+ this.waitQueue = new utils_1.List();
+ this.s = {
+ // the id of this topology
+ id: topologyId,
+ // passed in options
+ options,
+ // initial seedlist of servers to connect to
+ seedlist,
+ // initial state
+ state: common_1.STATE_CLOSED,
+ // the topology description
+ description: new topology_description_1.TopologyDescription(topologyType, serverDescriptions, options.replicaSet, undefined, undefined, undefined, options),
+ serverSelectionTimeoutMS: options.serverSelectionTimeoutMS,
+ heartbeatFrequencyMS: options.heartbeatFrequencyMS,
+ minHeartbeatFrequencyMS: options.minHeartbeatFrequencyMS,
+ // a map of server instances to normalized addresses
+ servers: new Map(),
+ credentials: options?.credentials,
+ clusterTime: undefined,
+ detectShardedTopology: ev => this.detectShardedTopology(ev),
+ detectSrvRecords: ev => this.detectSrvRecords(ev)
+ };
+ this.mongoLogger = client.mongoLogger;
+ this.component = 'topology';
+ if (options.srvHost && !options.loadBalanced) {
+ this.s.srvPoller =
+ options.srvPoller ??
+ new srv_polling_1.SrvPoller({
+ heartbeatFrequencyMS: this.s.heartbeatFrequencyMS,
+ srvHost: options.srvHost,
+ srvMaxHosts: options.srvMaxHosts,
+ srvServiceName: options.srvServiceName
+ });
+ this.on(Topology.TOPOLOGY_DESCRIPTION_CHANGED, this.s.detectShardedTopology);
+ }
+ this.connectionLock = undefined;
+ }
+ detectShardedTopology(event) {
+ const previousType = event.previousDescription.type;
+ const newType = event.newDescription.type;
+ const transitionToSharded = previousType !== common_1.TopologyType.Sharded && newType === common_1.TopologyType.Sharded;
+ const srvListeners = this.s.srvPoller?.listeners(srv_polling_1.SrvPoller.SRV_RECORD_DISCOVERY);
+ const listeningToSrvPolling = !!srvListeners?.includes(this.s.detectSrvRecords);
+ if (transitionToSharded && !listeningToSrvPolling) {
+ this.s.srvPoller?.on(srv_polling_1.SrvPoller.SRV_RECORD_DISCOVERY, this.s.detectSrvRecords);
+ this.s.srvPoller?.start();
+ }
+ }
+ detectSrvRecords(ev) {
+ const previousTopologyDescription = this.s.description;
+ this.s.description = this.s.description.updateFromSrvPollingEvent(ev, this.s.options.srvMaxHosts);
+ if (this.s.description === previousTopologyDescription) {
+ // Nothing changed, so return
+ return;
+ }
+ updateServers(this);
+ this.emitAndLog(Topology.TOPOLOGY_DESCRIPTION_CHANGED, new events_1.TopologyDescriptionChangedEvent(this.s.id, previousTopologyDescription, this.s.description));
+ }
+ /**
+ * @returns A `TopologyDescription` for this topology
+ */
+ get description() {
+ return this.s.description;
+ }
+ get loadBalanced() {
+ return this.s.options.loadBalanced;
+ }
+ get serverApi() {
+ return this.s.options.serverApi;
+ }
+ /** Initiate server connect */
+ async connect(options) {
+ this.connectionLock ??= this._connect(options);
+ try {
+ await this.connectionLock;
+ return this;
+ }
+ finally {
+ this.connectionLock = undefined;
+ }
+ }
+ async _connect(options) {
+ options = options ?? {};
+ if (this.s.state === common_1.STATE_CONNECTED) {
+ return this;
+ }
+ stateTransition(this, common_1.STATE_CONNECTING);
+ // emit SDAM monitoring events
+ this.emitAndLog(Topology.TOPOLOGY_OPENING, new events_1.TopologyOpeningEvent(this.s.id));
+ // emit an event for the topology change
+ this.emitAndLog(Topology.TOPOLOGY_DESCRIPTION_CHANGED, new events_1.TopologyDescriptionChangedEvent(this.s.id, new topology_description_1.TopologyDescription(common_1.TopologyType.Unknown), // initial is always Unknown
+ this.s.description));
+ // connect all known servers, then attempt server selection to connect
+ const serverDescriptions = Array.from(this.s.description.servers.values());
+ this.s.servers = new Map(serverDescriptions.map(serverDescription => [
+ serverDescription.address,
+ createAndConnectServer(this, serverDescription)
+ ]));
+ // In load balancer mode we need to fake a server description getting
+ // emitted from the monitor, since the monitor doesn't exist.
+ if (this.s.options.loadBalanced) {
+ for (const description of serverDescriptions) {
+ const newDescription = new server_description_1.ServerDescription(description.hostAddress, undefined, {
+ loadBalanced: this.s.options.loadBalanced
+ });
+ this.serverUpdateHandler(newDescription);
+ }
+ }
+ const serverSelectionTimeoutMS = this.client.s.options.serverSelectionTimeoutMS;
+ const readPreference = options.readPreference ?? read_preference_1.ReadPreference.primary;
+ const timeoutContext = timeout_1.TimeoutContext.create({
+ // TODO(NODE-6448): auto-connect ignores timeoutMS; potential future feature
+ timeoutMS: undefined,
+ serverSelectionTimeoutMS,
+ waitQueueTimeoutMS: this.client.s.options.waitQueueTimeoutMS
+ });
+ const selectServerOptions = {
+ operationName: 'handshake',
+ ...options,
+ timeoutContext,
+ deprioritizedServers: new server_selection_1.DeprioritizedServers()
+ };
+ try {
+ const server = await this.selectServer((0, server_selection_1.readPreferenceServerSelector)(readPreference), selectServerOptions);
+ const skipPingOnConnect = this.s.options.__skipPingOnConnect === true;
+ if (!skipPingOnConnect) {
+ const connection = await server.pool.checkOut({ timeoutContext: timeoutContext });
+ server.pool.checkIn(connection);
+ stateTransition(this, common_1.STATE_CONNECTED);
+ this.emit(Topology.OPEN, this);
+ this.emit(Topology.CONNECT, this);
+ return this;
+ }
+ stateTransition(this, common_1.STATE_CONNECTED);
+ this.emit(Topology.OPEN, this);
+ this.emit(Topology.CONNECT, this);
+ return this;
+ }
+ catch (error) {
+ this.close();
+ throw error;
+ }
+ }
+ closeCheckedOutConnections() {
+ for (const server of this.s.servers.values()) {
+ return server.closeCheckedOutConnections();
+ }
+ }
+ /** Close this topology */
+ close() {
+ if (this.s.state === common_1.STATE_CLOSED || this.s.state === common_1.STATE_CLOSING) {
+ return;
+ }
+ for (const server of this.s.servers.values()) {
+ closeServer(server, this);
+ }
+ this.s.servers.clear();
+ stateTransition(this, common_1.STATE_CLOSING);
+ drainWaitQueue(this.waitQueue, new error_1.MongoTopologyClosedError());
+ if (this.s.srvPoller) {
+ this.s.srvPoller.stop();
+ this.s.srvPoller.removeListener(srv_polling_1.SrvPoller.SRV_RECORD_DISCOVERY, this.s.detectSrvRecords);
+ }
+ this.removeListener(Topology.TOPOLOGY_DESCRIPTION_CHANGED, this.s.detectShardedTopology);
+ stateTransition(this, common_1.STATE_CLOSED);
+ // emit an event for close
+ this.emitAndLog(Topology.TOPOLOGY_CLOSED, new events_1.TopologyClosedEvent(this.s.id));
+ }
+ /**
+ * Selects a server according to the selection predicate provided
+ *
+ * @param selector - An optional selector to select servers by, defaults to a random selection within a latency window
+ * @param options - Optional settings related to server selection
+ * @param callback - The callback used to indicate success or failure
+ * @returns An instance of a `Server` meeting the criteria of the predicate provided
+ */
+ async selectServer(selector, options) {
+ let serverSelector;
+ if (typeof selector !== 'function') {
+ if (typeof selector === 'string') {
+ serverSelector = (0, server_selection_1.readPreferenceServerSelector)(read_preference_1.ReadPreference.fromString(selector));
+ }
+ else {
+ let readPreference;
+ if (selector instanceof read_preference_1.ReadPreference) {
+ readPreference = selector;
+ }
+ else {
+ read_preference_1.ReadPreference.translate(options);
+ readPreference = options.readPreference || read_preference_1.ReadPreference.primary;
+ }
+ serverSelector = (0, server_selection_1.readPreferenceServerSelector)(readPreference);
+ }
+ }
+ else {
+ serverSelector = selector;
+ }
+ options = { serverSelectionTimeoutMS: this.s.serverSelectionTimeoutMS, ...options };
+ if (this.client.mongoLogger?.willLog(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, mongo_logger_1.SeverityLevel.DEBUG)) {
+ this.client.mongoLogger?.debug(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, new server_selection_events_1.ServerSelectionStartedEvent(selector, this.description, options.operationName));
+ }
+ let timeout;
+ if (options.timeoutContext)
+ timeout = options.timeoutContext.serverSelectionTimeout;
+ else {
+ timeout = timeout_1.Timeout.expires(options.serverSelectionTimeoutMS ?? 0);
+ }
+ const isSharded = this.description.type === common_1.TopologyType.Sharded;
+ const session = options.session;
+ const transaction = session && session.transaction;
+ if (isSharded && transaction && transaction.server) {
+ if (this.client.mongoLogger?.willLog(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, mongo_logger_1.SeverityLevel.DEBUG)) {
+ this.client.mongoLogger?.debug(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, new server_selection_events_1.ServerSelectionSucceededEvent(selector, this.description, transaction.server.pool.address, options.operationName));
+ }
+ if (!options.timeoutContext || options.timeoutContext.clearServerSelectionTimeout) {
+ timeout?.clear();
+ }
+ return transaction.server;
+ }
+ const { promise: serverPromise, resolve, reject } = (0, utils_1.promiseWithResolvers)();
+ const waitQueueMember = {
+ serverSelector,
+ topologyDescription: this.description,
+ mongoLogger: this.client.mongoLogger,
+ transaction,
+ resolve,
+ reject,
+ cancelled: false,
+ startTime: (0, utils_1.processTimeMS)(),
+ operationName: options.operationName,
+ waitingLogged: false,
+ deprioritizedServers: options.deprioritizedServers
+ };
+ const abortListener = (0, utils_1.addAbortListener)(options.signal, function () {
+ waitQueueMember.cancelled = true;
+ reject(this.reason);
+ });
+ this.waitQueue.push(waitQueueMember);
+ processWaitQueue(this);
+ try {
+ timeout?.throwIfExpired();
+ const server = await (timeout ? Promise.race([serverPromise, timeout]) : serverPromise);
+ if (options.timeoutContext?.csotEnabled() && server.description.minRoundTripTime !== 0) {
+ options.timeoutContext.minRoundTripTime = server.description.minRoundTripTime;
+ }
+ return server;
+ }
+ catch (error) {
+ if (timeout_1.TimeoutError.is(error)) {
+ // Timeout
+ waitQueueMember.cancelled = true;
+ const timeoutError = new error_1.MongoServerSelectionError(`Server selection timed out after ${timeout?.duration} ms`, this.description);
+ if (this.client.mongoLogger?.willLog(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, mongo_logger_1.SeverityLevel.DEBUG)) {
+ this.client.mongoLogger?.debug(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, new server_selection_events_1.ServerSelectionFailedEvent(selector, this.description, timeoutError, options.operationName));
+ }
+ if (options.timeoutContext?.csotEnabled()) {
+ throw new error_1.MongoOperationTimeoutError('Timed out during server selection', {
+ cause: timeoutError
+ });
+ }
+ throw timeoutError;
+ }
+ // Other server selection error
+ throw error;
+ }
+ finally {
+ abortListener?.[utils_1.kDispose]();
+ if (!options.timeoutContext || options.timeoutContext.clearServerSelectionTimeout) {
+ timeout?.clear();
+ }
+ }
+ }
+ /**
+ * Update the internal TopologyDescription with a ServerDescription
+ *
+ * @param serverDescription - The server to update in the internal list of server descriptions
+ */
+ serverUpdateHandler(serverDescription) {
+ if (!this.s.description.hasServer(serverDescription.address)) {
+ return;
+ }
+ // ignore this server update if its from an outdated topologyVersion
+ if (isStaleServerDescription(this.s.description, serverDescription)) {
+ return;
+ }
+ // these will be used for monitoring events later
+ const previousTopologyDescription = this.s.description;
+ const previousServerDescription = this.s.description.servers.get(serverDescription.address);
+ if (!previousServerDescription) {
+ return;
+ }
+ // Driver Sessions Spec: "Whenever a driver receives a cluster time from
+ // a server it MUST compare it to the current highest seen cluster time
+ // for the deployment. If the new cluster time is higher than the
+ // highest seen cluster time it MUST become the new highest seen cluster
+ // time. Two cluster times are compared using only the BsonTimestamp
+ // value of the clusterTime embedded field."
+ const clusterTime = serverDescription.$clusterTime;
+ if (clusterTime) {
+ (0, common_1._advanceClusterTime)(this, clusterTime);
+ }
+ // If we already know all the information contained in this updated description, then
+ // we don't need to emit SDAM events, but still need to update the description, in order
+ // to keep client-tracked attributes like last update time and round trip time up to date
+ const equalDescriptions = previousServerDescription && previousServerDescription.equals(serverDescription);
+ // first update the TopologyDescription
+ this.s.description = this.s.description.update(serverDescription);
+ if (this.s.description.compatibilityError) {
+ this.emit(Topology.ERROR, new error_1.MongoCompatibilityError(this.s.description.compatibilityError));
+ return;
+ }
+ // emit monitoring events for this change
+ if (!equalDescriptions) {
+ const newDescription = this.s.description.servers.get(serverDescription.address);
+ if (newDescription) {
+ this.emit(Topology.SERVER_DESCRIPTION_CHANGED, new events_1.ServerDescriptionChangedEvent(this.s.id, serverDescription.address, previousServerDescription, newDescription));
+ }
+ }
+ // update server list from updated descriptions
+ updateServers(this, serverDescription);
+ // attempt to resolve any outstanding server selection attempts
+ if (this.waitQueue.length > 0) {
+ processWaitQueue(this);
+ }
+ if (!equalDescriptions) {
+ this.emitAndLog(Topology.TOPOLOGY_DESCRIPTION_CHANGED, new events_1.TopologyDescriptionChangedEvent(this.s.id, previousTopologyDescription, this.s.description));
+ }
+ }
+ auth(credentials, callback) {
+ if (typeof credentials === 'function')
+ ((callback = credentials), (credentials = undefined));
+ if (typeof callback === 'function')
+ callback(undefined, true);
+ }
+ isConnected() {
+ return this.s.state === common_1.STATE_CONNECTED;
+ }
+ isDestroyed() {
+ return this.s.state === common_1.STATE_CLOSED;
+ }
+ // NOTE: There are many places in code where we explicitly check the last hello
+ // to do feature support detection. This should be done any other way, but for
+ // now we will just return the first hello seen, which should suffice.
+ lastHello() {
+ const serverDescriptions = Array.from(this.description.servers.values());
+ if (serverDescriptions.length === 0)
+ return {};
+ const sd = serverDescriptions.filter((sd) => sd.type !== common_1.ServerType.Unknown)[0];
+ const result = sd || { maxWireVersion: this.description.commonWireVersion };
+ return result;
+ }
+ get commonWireVersion() {
+ return this.description.commonWireVersion;
+ }
+ get logicalSessionTimeoutMinutes() {
+ return this.description.logicalSessionTimeoutMinutes;
+ }
+ get clusterTime() {
+ return this.s.clusterTime;
+ }
+ set clusterTime(clusterTime) {
+ this.s.clusterTime = clusterTime;
+ }
+}
+exports.Topology = Topology;
+/** Destroys a server, and removes all event listeners from the instance */
+function closeServer(server, topology) {
+ for (const event of constants_1.LOCAL_SERVER_EVENTS) {
+ server.removeAllListeners(event);
+ }
+ server.close();
+ topology.emitAndLog(Topology.SERVER_CLOSED, new events_1.ServerClosedEvent(topology.s.id, server.description.address));
+ for (const event of constants_1.SERVER_RELAY_EVENTS) {
+ server.removeAllListeners(event);
+ }
+}
+/** Predicts the TopologyType from options */
+function topologyTypeFromOptions(options) {
+ if (options?.directConnection) {
+ return common_1.TopologyType.Single;
+ }
+ if (options?.replicaSet) {
+ return common_1.TopologyType.ReplicaSetNoPrimary;
+ }
+ if (options?.loadBalanced) {
+ return common_1.TopologyType.LoadBalanced;
+ }
+ return common_1.TopologyType.Unknown;
+}
+/**
+ * Creates new server instances and attempts to connect them
+ *
+ * @param topology - The topology that this server belongs to
+ * @param serverDescription - The description for the server to initialize and connect to
+ */
+function createAndConnectServer(topology, serverDescription) {
+ topology.emitAndLog(Topology.SERVER_OPENING, new events_1.ServerOpeningEvent(topology.s.id, serverDescription.address));
+ const server = new server_1.Server(topology, serverDescription, topology.s.options);
+ for (const event of constants_1.SERVER_RELAY_EVENTS) {
+ server.on(event, (e) => topology.emit(event, e));
+ }
+ server.on(server_1.Server.DESCRIPTION_RECEIVED, description => topology.serverUpdateHandler(description));
+ server.connect();
+ return server;
+}
+/**
+ * @param topology - Topology to update.
+ * @param incomingServerDescription - New server description.
+ */
+function updateServers(topology, incomingServerDescription) {
+ // update the internal server's description
+ if (incomingServerDescription && topology.s.servers.has(incomingServerDescription.address)) {
+ const server = topology.s.servers.get(incomingServerDescription.address);
+ if (server) {
+ server.s.description = incomingServerDescription;
+ if (incomingServerDescription.error instanceof error_1.MongoError &&
+ incomingServerDescription.error.hasErrorLabel(error_1.MongoErrorLabel.ResetPool)) {
+ const interruptInUseConnections = incomingServerDescription.error.hasErrorLabel(error_1.MongoErrorLabel.InterruptInUseConnections);
+ server.pool.clear({ interruptInUseConnections });
+ }
+ else if (incomingServerDescription.error == null) {
+ const newTopologyType = topology.s.description.type;
+ const shouldMarkPoolReady = incomingServerDescription.isDataBearing ||
+ (incomingServerDescription.type !== common_1.ServerType.Unknown &&
+ newTopologyType === common_1.TopologyType.Single);
+ if (shouldMarkPoolReady) {
+ server.pool.ready();
+ }
+ }
+ }
+ }
+ // add new servers for all descriptions we currently don't know about locally
+ for (const serverDescription of topology.description.servers.values()) {
+ if (!topology.s.servers.has(serverDescription.address)) {
+ const server = createAndConnectServer(topology, serverDescription);
+ topology.s.servers.set(serverDescription.address, server);
+ }
+ }
+ // for all servers no longer known, remove their descriptions and destroy their instances
+ for (const entry of topology.s.servers) {
+ const serverAddress = entry[0];
+ if (topology.description.hasServer(serverAddress)) {
+ continue;
+ }
+ if (!topology.s.servers.has(serverAddress)) {
+ continue;
+ }
+ const server = topology.s.servers.get(serverAddress);
+ topology.s.servers.delete(serverAddress);
+ // prepare server for garbage collection
+ if (server) {
+ closeServer(server, topology);
+ }
+ }
+}
+function drainWaitQueue(queue, drainError) {
+ while (queue.length) {
+ const waitQueueMember = queue.shift();
+ if (!waitQueueMember) {
+ continue;
+ }
+ if (!waitQueueMember.cancelled) {
+ if (waitQueueMember.mongoLogger?.willLog(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, mongo_logger_1.SeverityLevel.DEBUG)) {
+ waitQueueMember.mongoLogger?.debug(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, new server_selection_events_1.ServerSelectionFailedEvent(waitQueueMember.serverSelector, waitQueueMember.topologyDescription, drainError, waitQueueMember.operationName));
+ }
+ waitQueueMember.reject(drainError);
+ }
+ }
+}
+function processWaitQueue(topology) {
+ if (topology.s.state === common_1.STATE_CLOSED) {
+ drainWaitQueue(topology.waitQueue, new error_1.MongoTopologyClosedError());
+ return;
+ }
+ const isSharded = topology.description.type === common_1.TopologyType.Sharded;
+ const serverDescriptions = Array.from(topology.description.servers.values());
+ const membersToProcess = topology.waitQueue.length;
+ for (let i = 0; i < membersToProcess; ++i) {
+ const waitQueueMember = topology.waitQueue.shift();
+ if (!waitQueueMember) {
+ continue;
+ }
+ if (waitQueueMember.cancelled) {
+ continue;
+ }
+ let selectedDescriptions;
+ try {
+ const serverSelector = waitQueueMember.serverSelector;
+ const deprioritizedServers = waitQueueMember.deprioritizedServers;
+ selectedDescriptions = serverSelector
+ ? serverSelector(topology.description, serverDescriptions, deprioritizedServers)
+ : serverDescriptions;
+ }
+ catch (selectorError) {
+ if (topology.client.mongoLogger?.willLog(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, mongo_logger_1.SeverityLevel.DEBUG)) {
+ topology.client.mongoLogger?.debug(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, new server_selection_events_1.ServerSelectionFailedEvent(waitQueueMember.serverSelector, topology.description, selectorError, waitQueueMember.operationName));
+ }
+ waitQueueMember.reject(selectorError);
+ continue;
+ }
+ let selectedServer;
+ if (selectedDescriptions.length === 0) {
+ if (!waitQueueMember.waitingLogged) {
+ if (topology.client.mongoLogger?.willLog(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, mongo_logger_1.SeverityLevel.INFORMATIONAL)) {
+ topology.client.mongoLogger?.info(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, new server_selection_events_1.WaitingForSuitableServerEvent(waitQueueMember.serverSelector, topology.description, topology.s.serverSelectionTimeoutMS !== 0
+ ? topology.s.serverSelectionTimeoutMS -
+ ((0, utils_1.processTimeMS)() - waitQueueMember.startTime)
+ : -1, waitQueueMember.operationName));
+ }
+ waitQueueMember.waitingLogged = true;
+ }
+ topology.waitQueue.push(waitQueueMember);
+ continue;
+ }
+ else if (selectedDescriptions.length === 1) {
+ selectedServer = topology.s.servers.get(selectedDescriptions[0].address);
+ }
+ else {
+ const descriptions = (0, utils_1.shuffle)(selectedDescriptions, 2);
+ const server1 = topology.s.servers.get(descriptions[0].address);
+ const server2 = topology.s.servers.get(descriptions[1].address);
+ selectedServer =
+ server1 && server2 && server1.s.operationCount < server2.s.operationCount
+ ? server1
+ : server2;
+ }
+ if (!selectedServer) {
+ const serverSelectionError = new error_1.MongoServerSelectionError('server selection returned a server description but the server was not found in the topology', topology.description);
+ if (topology.client.mongoLogger?.willLog(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, mongo_logger_1.SeverityLevel.DEBUG)) {
+ topology.client.mongoLogger?.debug(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, new server_selection_events_1.ServerSelectionFailedEvent(waitQueueMember.serverSelector, topology.description, serverSelectionError, waitQueueMember.operationName));
+ }
+ waitQueueMember.reject(serverSelectionError);
+ return;
+ }
+ const transaction = waitQueueMember.transaction;
+ if (isSharded && transaction && transaction.isActive && selectedServer) {
+ transaction.pinServer(selectedServer);
+ }
+ if (topology.client.mongoLogger?.willLog(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, mongo_logger_1.SeverityLevel.DEBUG)) {
+ topology.client.mongoLogger?.debug(mongo_logger_1.MongoLoggableComponent.SERVER_SELECTION, new server_selection_events_1.ServerSelectionSucceededEvent(waitQueueMember.serverSelector, waitQueueMember.topologyDescription, selectedServer.pool.address, waitQueueMember.operationName));
+ }
+ waitQueueMember.resolve(selectedServer);
+ }
+ if (topology.waitQueue.length > 0) {
+ // ensure all server monitors attempt monitoring soon
+ for (const [, server] of topology.s.servers) {
+ queueMicrotask(function scheduleServerCheck() {
+ return server.requestCheck();
+ });
+ }
+ }
+}
+function isStaleServerDescription(topologyDescription, incomingServerDescription) {
+ const currentServerDescription = topologyDescription.servers.get(incomingServerDescription.address);
+ const currentTopologyVersion = currentServerDescription?.topologyVersion;
+ return ((0, server_description_1.compareTopologyVersion)(currentTopologyVersion, incomingServerDescription.topologyVersion) > 0);
+}
+//# sourceMappingURL=topology.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/topology.js.map b/node_modules/mongodb/lib/sdam/topology.js.map
new file mode 100644
index 00000000..d08f6c93
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/topology.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"topology.js","sourceRoot":"","sources":["../../src/sdam/topology.ts"],"names":[],"mappings":";;;AAKA,4DAAuD;AACvD,4CAcsB;AACtB,oCASkB;AAElB,kDAA0F;AAC1F,gDAAmE;AACnE,wDAA6E;AAE7E,wCAAmE;AAEnE,oCAYkB;A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modules/mongodb/lib/sdam/topology_description.js b/node_modules/mongodb/lib/sdam/topology_description.js
new file mode 100644
index 00000000..287b4d77
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/topology_description.js
@@ -0,0 +1,383 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.TopologyDescription = void 0;
+const bson_1 = require("../bson");
+const WIRE_CONSTANTS = require("../cmap/wire_protocol/constants");
+const error_1 = require("../error");
+const utils_1 = require("../utils");
+const common_1 = require("./common");
+const server_description_1 = require("./server_description");
+// constants related to compatibility checks
+const MIN_SUPPORTED_SERVER_VERSION = WIRE_CONSTANTS.MIN_SUPPORTED_SERVER_VERSION;
+const MAX_SUPPORTED_SERVER_VERSION = WIRE_CONSTANTS.MAX_SUPPORTED_SERVER_VERSION;
+const MIN_SUPPORTED_WIRE_VERSION = WIRE_CONSTANTS.MIN_SUPPORTED_WIRE_VERSION;
+const MAX_SUPPORTED_WIRE_VERSION = WIRE_CONSTANTS.MAX_SUPPORTED_WIRE_VERSION;
+const MONGOS_OR_UNKNOWN = new Set([common_1.ServerType.Mongos, common_1.ServerType.Unknown]);
+const MONGOS_OR_STANDALONE = new Set([common_1.ServerType.Mongos, common_1.ServerType.Standalone]);
+const NON_PRIMARY_RS_MEMBERS = new Set([
+ common_1.ServerType.RSSecondary,
+ common_1.ServerType.RSArbiter,
+ common_1.ServerType.RSOther
+]);
+/**
+ * Representation of a deployment of servers
+ * @public
+ */
+class TopologyDescription {
+ /**
+ * Create a TopologyDescription
+ */
+ constructor(topologyType, serverDescriptions = null, setName = null, maxSetVersion = null, maxElectionId = null, commonWireVersion = null, options = null) {
+ options = options ?? {};
+ this.type = topologyType ?? common_1.TopologyType.Unknown;
+ this.servers = serverDescriptions ?? new Map();
+ this.stale = false;
+ this.compatible = true;
+ this.heartbeatFrequencyMS = options.heartbeatFrequencyMS ?? 0;
+ this.localThresholdMS = options.localThresholdMS ?? 15;
+ this.setName = setName ?? null;
+ this.maxElectionId = maxElectionId ?? null;
+ this.maxSetVersion = maxSetVersion ?? null;
+ this.commonWireVersion = commonWireVersion ?? 0;
+ // determine server compatibility
+ for (const serverDescription of this.servers.values()) {
+ // Load balancer mode is always compatible.
+ if (serverDescription.type === common_1.ServerType.Unknown ||
+ serverDescription.type === common_1.ServerType.LoadBalancer) {
+ continue;
+ }
+ if (serverDescription.minWireVersion > MAX_SUPPORTED_WIRE_VERSION) {
+ this.compatible = false;
+ this.compatibilityError = `Server at ${serverDescription.address} requires wire version ${serverDescription.minWireVersion}, but this version of the driver only supports up to ${MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${MAX_SUPPORTED_SERVER_VERSION})`;
+ }
+ if (serverDescription.maxWireVersion < MIN_SUPPORTED_WIRE_VERSION) {
+ this.compatible = false;
+ this.compatibilityError = `Server at ${serverDescription.address} reports wire version ${serverDescription.maxWireVersion}, but this version of the driver requires at least ${MIN_SUPPORTED_WIRE_VERSION} (MongoDB ${MIN_SUPPORTED_SERVER_VERSION}).`;
+ break;
+ }
+ }
+ // Whenever a client updates the TopologyDescription from a hello response, it MUST set
+ // TopologyDescription.logicalSessionTimeoutMinutes to the smallest logicalSessionTimeoutMinutes
+ // value among ServerDescriptions of all data-bearing server types. If any have a null
+ // logicalSessionTimeoutMinutes, then TopologyDescription.logicalSessionTimeoutMinutes MUST be
+ // set to null.
+ this.logicalSessionTimeoutMinutes = null;
+ for (const [, server] of this.servers) {
+ if (server.isReadable) {
+ if (server.logicalSessionTimeoutMinutes == null) {
+ // If any of the servers have a null logicalSessionsTimeout, then the whole topology does
+ this.logicalSessionTimeoutMinutes = null;
+ break;
+ }
+ if (this.logicalSessionTimeoutMinutes == null) {
+ // First server with a non null logicalSessionsTimeout
+ this.logicalSessionTimeoutMinutes = server.logicalSessionTimeoutMinutes;
+ continue;
+ }
+ // Always select the smaller of the:
+ // current server logicalSessionsTimeout and the topologies logicalSessionsTimeout
+ this.logicalSessionTimeoutMinutes = Math.min(this.logicalSessionTimeoutMinutes, server.logicalSessionTimeoutMinutes);
+ }
+ }
+ }
+ /**
+ * Returns a new TopologyDescription based on the SrvPollingEvent
+ * @internal
+ */
+ updateFromSrvPollingEvent(ev, srvMaxHosts = 0) {
+ /** The SRV addresses defines the set of addresses we should be using */
+ const incomingHostnames = ev.hostnames();
+ const currentHostnames = new Set(this.servers.keys());
+ const hostnamesToAdd = new Set(incomingHostnames);
+ const hostnamesToRemove = new Set();
+ for (const hostname of currentHostnames) {
+ // filter hostnamesToAdd (made from incomingHostnames) down to what is *not* present in currentHostnames
+ hostnamesToAdd.delete(hostname);
+ if (!incomingHostnames.has(hostname)) {
+ // If the SRV Records no longer include this hostname
+ // we have to stop using it
+ hostnamesToRemove.add(hostname);
+ }
+ }
+ if (hostnamesToAdd.size === 0 && hostnamesToRemove.size === 0) {
+ // No new hosts to add and none to remove
+ return this;
+ }
+ const serverDescriptions = new Map(this.servers);
+ for (const removedHost of hostnamesToRemove) {
+ serverDescriptions.delete(removedHost);
+ }
+ if (hostnamesToAdd.size > 0) {
+ if (srvMaxHosts === 0) {
+ // Add all!
+ for (const hostToAdd of hostnamesToAdd) {
+ serverDescriptions.set(hostToAdd, new server_description_1.ServerDescription(hostToAdd));
+ }
+ }
+ else if (serverDescriptions.size < srvMaxHosts) {
+ // Add only the amount needed to get us back to srvMaxHosts
+ const selectedHosts = (0, utils_1.shuffle)(hostnamesToAdd, srvMaxHosts - serverDescriptions.size);
+ for (const selectedHostToAdd of selectedHosts) {
+ serverDescriptions.set(selectedHostToAdd, new server_description_1.ServerDescription(selectedHostToAdd));
+ }
+ }
+ }
+ return new TopologyDescription(this.type, serverDescriptions, this.setName, this.maxSetVersion, this.maxElectionId, this.commonWireVersion, { heartbeatFrequencyMS: this.heartbeatFrequencyMS, localThresholdMS: this.localThresholdMS });
+ }
+ /**
+ * Returns a copy of this description updated with a given ServerDescription
+ * @internal
+ */
+ update(serverDescription) {
+ const address = serverDescription.address;
+ // potentially mutated values
+ let { type: topologyType, setName, maxSetVersion, maxElectionId, commonWireVersion } = this;
+ const serverType = serverDescription.type;
+ const serverDescriptions = new Map(this.servers);
+ // update common wire version
+ if (serverDescription.maxWireVersion !== 0) {
+ if (commonWireVersion === 0) {
+ commonWireVersion = serverDescription.maxWireVersion;
+ }
+ else {
+ commonWireVersion = Math.min(commonWireVersion, serverDescription.maxWireVersion);
+ }
+ }
+ if (typeof serverDescription.setName === 'string' &&
+ typeof setName === 'string' &&
+ serverDescription.setName !== setName) {
+ if (topologyType === common_1.TopologyType.Single) {
+ // "Single" Topology with setName mismatch is direct connection usage, mark unknown do not remove
+ serverDescription = new server_description_1.ServerDescription(address);
+ }
+ else {
+ serverDescriptions.delete(address);
+ }
+ }
+ // update the actual server description
+ serverDescriptions.set(address, serverDescription);
+ if (topologyType === common_1.TopologyType.Single) {
+ // once we are defined as single, that never changes
+ return new TopologyDescription(common_1.TopologyType.Single, serverDescriptions, setName, maxSetVersion, maxElectionId, commonWireVersion, { heartbeatFrequencyMS: this.heartbeatFrequencyMS, localThresholdMS: this.localThresholdMS });
+ }
+ if (topologyType === common_1.TopologyType.Unknown) {
+ if (serverType === common_1.ServerType.Standalone && this.servers.size !== 1) {
+ serverDescriptions.delete(address);
+ }
+ else {
+ topologyType = topologyTypeForServerType(serverType);
+ }
+ }
+ if (topologyType === common_1.TopologyType.Sharded) {
+ if (!MONGOS_OR_UNKNOWN.has(serverType)) {
+ serverDescriptions.delete(address);
+ }
+ }
+ if (topologyType === common_1.TopologyType.ReplicaSetNoPrimary) {
+ if (MONGOS_OR_STANDALONE.has(serverType)) {
+ serverDescriptions.delete(address);
+ }
+ if (serverType === common_1.ServerType.RSPrimary) {
+ const result = updateRsFromPrimary(serverDescriptions, serverDescription, setName, maxSetVersion, maxElectionId);
+ topologyType = result[0];
+ setName = result[1];
+ maxSetVersion = result[2];
+ maxElectionId = result[3];
+ }
+ else if (NON_PRIMARY_RS_MEMBERS.has(serverType)) {
+ const result = updateRsNoPrimaryFromMember(serverDescriptions, serverDescription, setName);
+ topologyType = result[0];
+ setName = result[1];
+ }
+ }
+ if (topologyType === common_1.TopologyType.ReplicaSetWithPrimary) {
+ if (MONGOS_OR_STANDALONE.has(serverType)) {
+ serverDescriptions.delete(address);
+ topologyType = checkHasPrimary(serverDescriptions);
+ }
+ else if (serverType === common_1.ServerType.RSPrimary) {
+ const result = updateRsFromPrimary(serverDescriptions, serverDescription, setName, maxSetVersion, maxElectionId);
+ topologyType = result[0];
+ setName = result[1];
+ maxSetVersion = result[2];
+ maxElectionId = result[3];
+ }
+ else if (NON_PRIMARY_RS_MEMBERS.has(serverType)) {
+ topologyType = updateRsWithPrimaryFromMember(serverDescriptions, serverDescription, setName);
+ }
+ else {
+ topologyType = checkHasPrimary(serverDescriptions);
+ }
+ }
+ return new TopologyDescription(topologyType, serverDescriptions, setName, maxSetVersion, maxElectionId, commonWireVersion, { heartbeatFrequencyMS: this.heartbeatFrequencyMS, localThresholdMS: this.localThresholdMS });
+ }
+ get error() {
+ const descriptionsWithError = Array.from(this.servers.values()).filter((sd) => sd.error);
+ if (descriptionsWithError.length > 0) {
+ return descriptionsWithError[0].error;
+ }
+ return null;
+ }
+ /**
+ * Determines if the topology description has any known servers
+ */
+ get hasKnownServers() {
+ return Array.from(this.servers.values()).some((sd) => sd.type !== common_1.ServerType.Unknown);
+ }
+ /**
+ * Determines if this topology description has a data-bearing server available.
+ */
+ get hasDataBearingServers() {
+ return Array.from(this.servers.values()).some((sd) => sd.isDataBearing);
+ }
+ /**
+ * Determines if the topology has a definition for the provided address
+ * @internal
+ */
+ hasServer(address) {
+ return this.servers.has(address);
+ }
+ /**
+ * Returns a JSON-serializable representation of the TopologyDescription. This is primarily
+ * intended for use with JSON.stringify().
+ *
+ * This method will not throw.
+ */
+ toJSON() {
+ return bson_1.EJSON.serialize(this);
+ }
+}
+exports.TopologyDescription = TopologyDescription;
+function topologyTypeForServerType(serverType) {
+ switch (serverType) {
+ case common_1.ServerType.Standalone:
+ return common_1.TopologyType.Single;
+ case common_1.ServerType.Mongos:
+ return common_1.TopologyType.Sharded;
+ case common_1.ServerType.RSPrimary:
+ return common_1.TopologyType.ReplicaSetWithPrimary;
+ case common_1.ServerType.RSOther:
+ case common_1.ServerType.RSSecondary:
+ return common_1.TopologyType.ReplicaSetNoPrimary;
+ default:
+ return common_1.TopologyType.Unknown;
+ }
+}
+function updateRsFromPrimary(serverDescriptions, serverDescription, setName = null, maxSetVersion = null, maxElectionId = null) {
+ const setVersionElectionIdMismatch = (serverDescription, maxSetVersion, maxElectionId) => {
+ return (`primary marked stale due to electionId/setVersion mismatch:` +
+ ` server setVersion: ${serverDescription.setVersion},` +
+ ` server electionId: ${serverDescription.electionId},` +
+ ` topology setVersion: ${maxSetVersion},` +
+ ` topology electionId: ${maxElectionId}`);
+ };
+ setName = setName || serverDescription.setName;
+ if (setName !== serverDescription.setName) {
+ serverDescriptions.delete(serverDescription.address);
+ return [checkHasPrimary(serverDescriptions), setName, maxSetVersion, maxElectionId];
+ }
+ if (serverDescription.maxWireVersion >= 17) {
+ const electionIdComparison = (0, utils_1.compareObjectId)(maxElectionId, serverDescription.electionId);
+ const maxElectionIdIsEqual = electionIdComparison === 0;
+ const maxElectionIdIsLess = electionIdComparison === -1;
+ const maxSetVersionIsLessOrEqual = (maxSetVersion ?? -1) <= (serverDescription.setVersion ?? -1);
+ if (maxElectionIdIsLess || (maxElectionIdIsEqual && maxSetVersionIsLessOrEqual)) {
+ // The reported electionId was greater
+ // or the electionId was equal and reported setVersion was greater
+ // Always update both values, they are a tuple
+ maxElectionId = serverDescription.electionId;
+ maxSetVersion = serverDescription.setVersion;
+ }
+ else {
+ // Stale primary
+ // replace serverDescription with a default ServerDescription of type "Unknown"
+ serverDescriptions.set(serverDescription.address, new server_description_1.ServerDescription(serverDescription.address, undefined, {
+ error: new error_1.MongoStalePrimaryError(setVersionElectionIdMismatch(serverDescription, maxSetVersion, maxElectionId))
+ }));
+ return [checkHasPrimary(serverDescriptions), setName, maxSetVersion, maxElectionId];
+ }
+ }
+ else {
+ const electionId = serverDescription.electionId ? serverDescription.electionId : null;
+ if (serverDescription.setVersion && electionId) {
+ if (maxSetVersion && maxElectionId) {
+ if (maxSetVersion > serverDescription.setVersion ||
+ (0, utils_1.compareObjectId)(maxElectionId, electionId) > 0) {
+ // this primary is stale, we must remove it
+ serverDescriptions.set(serverDescription.address, new server_description_1.ServerDescription(serverDescription.address, undefined, {
+ error: new error_1.MongoStalePrimaryError(setVersionElectionIdMismatch(serverDescription, maxSetVersion, maxElectionId))
+ }));
+ return [checkHasPrimary(serverDescriptions), setName, maxSetVersion, maxElectionId];
+ }
+ }
+ maxElectionId = serverDescription.electionId;
+ }
+ if (serverDescription.setVersion != null &&
+ (maxSetVersion == null || serverDescription.setVersion > maxSetVersion)) {
+ maxSetVersion = serverDescription.setVersion;
+ }
+ }
+ // We've heard from the primary. Is it the same primary as before?
+ for (const [address, server] of serverDescriptions) {
+ if (server.type === common_1.ServerType.RSPrimary && server.address !== serverDescription.address) {
+ // Reset old primary's type to Unknown.
+ serverDescriptions.set(address, new server_description_1.ServerDescription(server.address, undefined, {
+ error: new error_1.MongoStalePrimaryError('primary marked stale due to discovery of newer primary')
+ }));
+ // There can only be one primary
+ break;
+ }
+ }
+ // Discover new hosts from this primary's response.
+ serverDescription.allHosts.forEach((address) => {
+ if (!serverDescriptions.has(address)) {
+ serverDescriptions.set(address, new server_description_1.ServerDescription(address));
+ }
+ });
+ // Remove hosts not in the response.
+ const currentAddresses = Array.from(serverDescriptions.keys());
+ const responseAddresses = serverDescription.allHosts;
+ currentAddresses
+ .filter((addr) => responseAddresses.indexOf(addr) === -1)
+ .forEach((address) => {
+ serverDescriptions.delete(address);
+ });
+ return [checkHasPrimary(serverDescriptions), setName, maxSetVersion, maxElectionId];
+}
+function updateRsWithPrimaryFromMember(serverDescriptions, serverDescription, setName = null) {
+ if (setName == null) {
+ // TODO(NODE-3483): should be an appropriate runtime error
+ throw new error_1.MongoRuntimeError('Argument "setName" is required if connected to a replica set');
+ }
+ if (setName !== serverDescription.setName ||
+ (serverDescription.me && serverDescription.address !== serverDescription.me)) {
+ serverDescriptions.delete(serverDescription.address);
+ }
+ return checkHasPrimary(serverDescriptions);
+}
+function updateRsNoPrimaryFromMember(serverDescriptions, serverDescription, setName = null) {
+ const topologyType = common_1.TopologyType.ReplicaSetNoPrimary;
+ setName = setName ?? serverDescription.setName;
+ if (setName !== serverDescription.setName) {
+ serverDescriptions.delete(serverDescription.address);
+ return [topologyType, setName];
+ }
+ serverDescription.allHosts.forEach((address) => {
+ if (!serverDescriptions.has(address)) {
+ serverDescriptions.set(address, new server_description_1.ServerDescription(address));
+ }
+ });
+ if (serverDescription.me && serverDescription.address !== serverDescription.me) {
+ serverDescriptions.delete(serverDescription.address);
+ }
+ return [topologyType, setName];
+}
+function checkHasPrimary(serverDescriptions) {
+ for (const serverDescription of serverDescriptions.values()) {
+ if (serverDescription.type === common_1.ServerType.RSPrimary) {
+ return common_1.TopologyType.ReplicaSetWithPrimary;
+ }
+ }
+ return common_1.TopologyType.ReplicaSetNoPrimary;
+}
+//# sourceMappingURL=topology_description.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sdam/topology_description.js.map b/node_modules/mongodb/lib/sdam/topology_description.js.map
new file mode 100644
index 00000000..e6c189f3
--- /dev/null
+++ b/node_modules/mongodb/lib/sdam/topology_description.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"topology_description.js","sourceRoot":"","sources":["../../src/sdam/topology_description.ts"],"names":[],"mappings":";;;AAAA,kCAA+C;AAC/C,kEAAkE;AAClE,oCAAsF;AACtF,oCAAoD;AACpD,qCAAoD;AACpD,6DAAyD;AAGzD,4CAA4C;AAC5C,MAAM,4BAA4B,GAAG,cAAc,CAAC,4BAA4B,CAAC;AACjF,MAAM,4BAA4B,GAAG,cAAc,CAAC,4BAA4B,CAAC;AACjF,MAAM,0BAA0B,GAAG,cAAc,CAAC,0BAA0B,CAAC;AAC7E,MAAM,0BAA0B,GAAG,cAAc,CAAC,0BAA0B,CA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,CAAC;IAEH,IAAI,iBAAiB,CAAC,EAAE,IAAI,iBAAiB,CAAC,OAAO,KAAK,iBAAiB,CAAC,EAAE,EAAE,CAAC;QAC/E,kBAAkB,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,eAAe,CAAC,kBAAkD;IACzE,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC;QAC5D,IAAI,iBAAiB,CAAC,IAAI,KAAK,mBAAU,CAAC,SAAS,EAAE,CAAC;YACpD,OAAO,qBAAY,CAAC,qBAAqB,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,OAAO,qBAAY,CAAC,mBAAmB,CAAC;AAC1C,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sessions.js b/node_modules/mongodb/lib/sessions.js
new file mode 100644
index 00000000..9bfe8ee5
--- /dev/null
+++ b/node_modules/mongodb/lib/sessions.js
@@ -0,0 +1,937 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ServerSessionPool = exports.ServerSession = exports.ClientSession = void 0;
+exports.maybeClearPinnedConnection = maybeClearPinnedConnection;
+exports.applySession = applySession;
+exports.updateSessionFromResponse = updateSessionFromResponse;
+const promises_1 = require("timers/promises");
+const bson_1 = require("./bson");
+const metrics_1 = require("./cmap/metrics");
+const constants_1 = require("./constants");
+const error_1 = require("./error");
+const mongo_types_1 = require("./mongo_types");
+const execute_operation_1 = require("./operations/execute_operation");
+const run_command_1 = require("./operations/run_command");
+const read_concern_1 = require("./read_concern");
+const read_preference_1 = require("./read_preference");
+const common_1 = require("./sdam/common");
+const timeout_1 = require("./timeout");
+const transactions_1 = require("./transactions");
+const utils_1 = require("./utils");
+const write_concern_1 = require("./write_concern");
+/**
+ * A class representing a client session on the server
+ *
+ * NOTE: not meant to be instantiated directly.
+ * @public
+ */
+class ClientSession extends mongo_types_1.TypedEventEmitter {
+ /**
+ * Create a client session.
+ * @internal
+ * @param client - The current client
+ * @param sessionPool - The server session pool (Internal Class)
+ * @param options - Optional settings
+ * @param clientOptions - Optional settings provided when creating a MongoClient
+ */
+ constructor(client, sessionPool, options, clientOptions) {
+ super();
+ /** @internal */
+ this.timeoutContext = null;
+ this.on('error', utils_1.noop);
+ if (client == null) {
+ // TODO(NODE-3483)
+ throw new error_1.MongoRuntimeError('ClientSession requires a MongoClient');
+ }
+ if (sessionPool == null || !(sessionPool instanceof ServerSessionPool)) {
+ // TODO(NODE-3483)
+ throw new error_1.MongoRuntimeError('ClientSession requires a ServerSessionPool');
+ }
+ options = options ?? {};
+ this.snapshotEnabled = options.snapshot === true;
+ if (options.causalConsistency === true && this.snapshotEnabled) {
+ throw new error_1.MongoInvalidArgumentError('Properties "causalConsistency" and "snapshot" are mutually exclusive');
+ }
+ this.client = client;
+ this.sessionPool = sessionPool;
+ this.hasEnded = false;
+ this.clientOptions = clientOptions;
+ this.timeoutMS = options.defaultTimeoutMS ?? client.s.options?.timeoutMS;
+ this.explicit = !!options.explicit;
+ this._serverSession = this.explicit ? this.sessionPool.acquire() : null;
+ this.txnNumberIncrement = 0;
+ const defaultCausalConsistencyValue = this.explicit && options.snapshot !== true;
+ this.supports = {
+ // if we can enable causal consistency, do so by default
+ causalConsistency: options.causalConsistency ?? defaultCausalConsistencyValue
+ };
+ this.clusterTime = options.initialClusterTime;
+ this.operationTime = undefined;
+ this.owner = options.owner;
+ this.defaultTransactionOptions = { ...options.defaultTransactionOptions };
+ this.transaction = new transactions_1.Transaction();
+ }
+ /** The server id associated with this session */
+ get id() {
+ return this.serverSession?.id;
+ }
+ get serverSession() {
+ let serverSession = this._serverSession;
+ if (serverSession == null) {
+ if (this.explicit) {
+ throw new error_1.MongoRuntimeError('Unexpected null serverSession for an explicit session');
+ }
+ if (this.hasEnded) {
+ throw new error_1.MongoRuntimeError('Unexpected null serverSession for an ended implicit session');
+ }
+ serverSession = this.sessionPool.acquire();
+ this._serverSession = serverSession;
+ }
+ return serverSession;
+ }
+ get loadBalanced() {
+ return this.client.topology?.description.type === common_1.TopologyType.LoadBalanced;
+ }
+ /** @internal */
+ pin(conn) {
+ if (this.pinnedConnection) {
+ throw TypeError('Cannot pin multiple connections to the same session');
+ }
+ this.pinnedConnection = conn;
+ conn.emit(constants_1.PINNED, this.inTransaction() ? metrics_1.ConnectionPoolMetrics.TXN : metrics_1.ConnectionPoolMetrics.CURSOR);
+ }
+ /** @internal */
+ unpin(options) {
+ if (this.loadBalanced) {
+ return maybeClearPinnedConnection(this, options);
+ }
+ this.transaction.unpinServer();
+ }
+ get isPinned() {
+ return this.loadBalanced ? !!this.pinnedConnection : this.transaction.isPinned;
+ }
+ /**
+ * Frees any client-side resources held by the current session. If a session is in a transaction,
+ * the transaction is aborted.
+ *
+ * Does not end the session on the server.
+ *
+ * @param options - Optional settings. Currently reserved for future use
+ */
+ async endSession(options) {
+ try {
+ if (this.inTransaction()) {
+ await this.abortTransaction({ ...options, throwTimeout: true });
+ }
+ }
+ catch (error) {
+ // spec indicates that we should ignore all errors for `endSessions`
+ if (error.name === 'MongoOperationTimeoutError')
+ throw error;
+ (0, utils_1.squashError)(error);
+ }
+ finally {
+ if (!this.hasEnded) {
+ const serverSession = this.serverSession;
+ if (serverSession != null) {
+ // release the server session back to the pool
+ this.sessionPool.release(serverSession);
+ // Store a clone of the server session for reference (debugging)
+ this._serverSession = new ServerSession(serverSession);
+ }
+ // mark the session as ended, and emit a signal
+ this.hasEnded = true;
+ this.emit('ended', this);
+ }
+ maybeClearPinnedConnection(this, { force: true, ...options });
+ }
+ }
+ /**
+ * @experimental
+ * An alias for {@link ClientSession.endSession|ClientSession.endSession()}.
+ */
+ async [Symbol.asyncDispose]() {
+ await this.endSession({ force: true });
+ }
+ /**
+ * Advances the operationTime for a ClientSession.
+ *
+ * @param operationTime - the `BSON.Timestamp` of the operation type it is desired to advance to
+ */
+ advanceOperationTime(operationTime) {
+ if (this.operationTime == null) {
+ this.operationTime = operationTime;
+ return;
+ }
+ if (operationTime.greaterThan(this.operationTime)) {
+ this.operationTime = operationTime;
+ }
+ }
+ /**
+ * Advances the clusterTime for a ClientSession to the provided clusterTime of another ClientSession
+ *
+ * @param clusterTime - the $clusterTime returned by the server from another session in the form of a document containing the `BSON.Timestamp` clusterTime and signature
+ */
+ advanceClusterTime(clusterTime) {
+ if (!clusterTime || typeof clusterTime !== 'object') {
+ throw new error_1.MongoInvalidArgumentError('input cluster time must be an object');
+ }
+ if (!clusterTime.clusterTime || clusterTime.clusterTime._bsontype !== 'Timestamp') {
+ throw new error_1.MongoInvalidArgumentError('input cluster time "clusterTime" property must be a valid BSON Timestamp');
+ }
+ if (!clusterTime.signature ||
+ clusterTime.signature.hash?._bsontype !== 'Binary' ||
+ (typeof clusterTime.signature.keyId !== 'bigint' &&
+ typeof clusterTime.signature.keyId !== 'number' &&
+ clusterTime.signature.keyId?._bsontype !== 'Long') // apparently we decode the key to number?
+ ) {
+ throw new error_1.MongoInvalidArgumentError('input cluster time must have a valid "signature" property with BSON Binary hash and BSON Long keyId');
+ }
+ (0, common_1._advanceClusterTime)(this, clusterTime);
+ }
+ /**
+ * Used to determine if this session equals another
+ *
+ * @param session - The session to compare to
+ */
+ equals(session) {
+ if (!(session instanceof ClientSession)) {
+ return false;
+ }
+ if (this.id == null || session.id == null) {
+ return false;
+ }
+ return bson_1.ByteUtils.equals(this.id.id.buffer, session.id.id.buffer);
+ }
+ /**
+ * Increment the transaction number on the internal ServerSession
+ *
+ * @privateRemarks
+ * This helper increments a value stored on the client session that will be
+ * added to the serverSession's txnNumber upon applying it to a command.
+ * This is because the serverSession is lazily acquired after a connection is obtained
+ */
+ incrementTransactionNumber() {
+ this.txnNumberIncrement += 1;
+ }
+ /** @returns whether this session is currently in a transaction or not */
+ inTransaction() {
+ return this.transaction.isActive;
+ }
+ /**
+ * Starts a new transaction with the given options.
+ *
+ * @remarks
+ * **IMPORTANT**: Running operations in parallel is not supported during a transaction. The use of `Promise.all`,
+ * `Promise.allSettled`, `Promise.race`, etc to parallelize operations inside a transaction is
+ * undefined behaviour.
+ *
+ * @param options - Options for the transaction
+ */
+ startTransaction(options) {
+ if (this.snapshotEnabled) {
+ throw new error_1.MongoCompatibilityError('Transactions are not supported in snapshot sessions');
+ }
+ if (this.inTransaction()) {
+ throw new error_1.MongoTransactionError('Transaction already in progress');
+ }
+ if (this.isPinned && this.transaction.isCommitted) {
+ this.unpin();
+ }
+ this.commitAttempted = false;
+ // increment txnNumber
+ this.incrementTransactionNumber();
+ // create transaction state
+ this.transaction = new transactions_1.Transaction({
+ readConcern: options?.readConcern ??
+ this.defaultTransactionOptions.readConcern ??
+ this.clientOptions?.readConcern,
+ writeConcern: options?.writeConcern ??
+ this.defaultTransactionOptions.writeConcern ??
+ this.clientOptions?.writeConcern,
+ readPreference: options?.readPreference ??
+ this.defaultTransactionOptions.readPreference ??
+ this.clientOptions?.readPreference,
+ maxCommitTimeMS: options?.maxCommitTimeMS ?? this.defaultTransactionOptions.maxCommitTimeMS
+ });
+ this.transaction.transition(transactions_1.TxnState.STARTING_TRANSACTION);
+ }
+ /**
+ * Commits the currently active transaction in this session.
+ *
+ * @param options - Optional options, can be used to override `defaultTimeoutMS`.
+ */
+ async commitTransaction(options) {
+ if (this.transaction.state === transactions_1.TxnState.NO_TRANSACTION) {
+ throw new error_1.MongoTransactionError('No transaction started');
+ }
+ if (this.transaction.state === transactions_1.TxnState.STARTING_TRANSACTION ||
+ this.transaction.state === transactions_1.TxnState.TRANSACTION_COMMITTED_EMPTY) {
+ // the transaction was never started, we can safely exit here
+ this.transaction.transition(transactions_1.TxnState.TRANSACTION_COMMITTED_EMPTY);
+ return;
+ }
+ if (this.transaction.state === transactions_1.TxnState.TRANSACTION_ABORTED) {
+ throw new error_1.MongoTransactionError('Cannot call commitTransaction after calling abortTransaction');
+ }
+ const command = { commitTransaction: 1 };
+ const timeoutMS = typeof options?.timeoutMS === 'number'
+ ? options.timeoutMS
+ : typeof this.timeoutMS === 'number'
+ ? this.timeoutMS
+ : null;
+ const wc = this.transaction.options.writeConcern ?? this.clientOptions?.writeConcern;
+ if (wc != null) {
+ if (timeoutMS == null && this.timeoutContext == null) {
+ write_concern_1.WriteConcern.apply(command, { wtimeoutMS: 10000, w: 'majority', ...wc });
+ }
+ else {
+ const wcKeys = Object.keys(wc);
+ if (wcKeys.length > 2 || (!wcKeys.includes('wtimeoutMS') && !wcKeys.includes('wTimeoutMS')))
+ // if the write concern was specified with wTimeoutMS, then we set both wtimeoutMS
+ // and wTimeoutMS, guaranteeing at least two keys, so if we have more than two keys,
+ // then we can automatically assume that we should add the write concern to the command.
+ // If it has 2 or fewer keys, we need to check that those keys aren't the wtimeoutMS
+ // or wTimeoutMS options before we add the write concern to the command
+ write_concern_1.WriteConcern.apply(command, { ...wc, wtimeoutMS: undefined });
+ }
+ }
+ if (this.transaction.state === transactions_1.TxnState.TRANSACTION_COMMITTED || this.commitAttempted) {
+ if (timeoutMS == null && this.timeoutContext == null) {
+ write_concern_1.WriteConcern.apply(command, { wtimeoutMS: 10000, ...wc, w: 'majority' });
+ }
+ else {
+ write_concern_1.WriteConcern.apply(command, { w: 'majority', ...wc, wtimeoutMS: undefined });
+ }
+ }
+ if (typeof this.transaction.options.maxTimeMS === 'number') {
+ command.maxTimeMS = this.transaction.options.maxTimeMS;
+ }
+ if (this.transaction.recoveryToken) {
+ command.recoveryToken = this.transaction.recoveryToken;
+ }
+ const operation = new run_command_1.RunCommandOperation(new utils_1.MongoDBNamespace('admin'), command, {
+ session: this,
+ readPreference: read_preference_1.ReadPreference.primary,
+ bypassPinningCheck: true
+ });
+ operation.maxAttempts = this.clientOptions.maxAdaptiveRetries + 1;
+ const timeoutContext = this.timeoutContext ??
+ (typeof timeoutMS === 'number'
+ ? timeout_1.TimeoutContext.create({
+ serverSelectionTimeoutMS: this.clientOptions.serverSelectionTimeoutMS,
+ socketTimeoutMS: this.clientOptions.socketTimeoutMS,
+ timeoutMS
+ })
+ : null);
+ try {
+ await (0, execute_operation_1.executeOperation)(this.client, operation, timeoutContext);
+ this.commitAttempted = undefined;
+ return;
+ }
+ catch (firstCommitError) {
+ this.commitAttempted = true;
+ const remainingAttempts = this.clientOptions.maxAdaptiveRetries + 1 - operation.attemptsMade;
+ if (remainingAttempts <= 0) {
+ throw firstCommitError;
+ }
+ if (firstCommitError instanceof error_1.MongoError && (0, error_1.isRetryableWriteError)(firstCommitError)) {
+ // SPEC-1185: apply majority write concern when retrying commitTransaction
+ write_concern_1.WriteConcern.apply(command, { wtimeoutMS: 10000, ...wc, w: 'majority' });
+ // per txns spec, must unpin session in this case
+ this.unpin({ force: true });
+ try {
+ const op = new run_command_1.RunCommandOperation(new utils_1.MongoDBNamespace('admin'), command, {
+ session: this,
+ readPreference: read_preference_1.ReadPreference.primary,
+ bypassPinningCheck: true
+ });
+ op.maxAttempts = remainingAttempts;
+ await (0, execute_operation_1.executeOperation)(this.client, op, timeoutContext);
+ return;
+ }
+ catch (retryCommitError) {
+ // If the retry failed, we process that error instead of the original
+ if (shouldAddUnknownTransactionCommitResultLabel(retryCommitError)) {
+ retryCommitError.addErrorLabel(error_1.MongoErrorLabel.UnknownTransactionCommitResult);
+ }
+ if (shouldUnpinAfterCommitError(retryCommitError)) {
+ this.unpin({ error: retryCommitError });
+ }
+ throw retryCommitError;
+ }
+ }
+ if (shouldAddUnknownTransactionCommitResultLabel(firstCommitError)) {
+ firstCommitError.addErrorLabel(error_1.MongoErrorLabel.UnknownTransactionCommitResult);
+ }
+ if (shouldUnpinAfterCommitError(firstCommitError)) {
+ this.unpin({ error: firstCommitError });
+ }
+ throw firstCommitError;
+ }
+ finally {
+ this.transaction.transition(transactions_1.TxnState.TRANSACTION_COMMITTED);
+ }
+ }
+ async abortTransaction(options) {
+ if (this.transaction.state === transactions_1.TxnState.NO_TRANSACTION) {
+ throw new error_1.MongoTransactionError('No transaction started');
+ }
+ if (this.transaction.state === transactions_1.TxnState.STARTING_TRANSACTION) {
+ // the transaction was never started, we can safely exit here
+ this.transaction.transition(transactions_1.TxnState.TRANSACTION_ABORTED);
+ return;
+ }
+ if (this.transaction.state === transactions_1.TxnState.TRANSACTION_ABORTED) {
+ throw new error_1.MongoTransactionError('Cannot call abortTransaction twice');
+ }
+ if (this.transaction.state === transactions_1.TxnState.TRANSACTION_COMMITTED ||
+ this.transaction.state === transactions_1.TxnState.TRANSACTION_COMMITTED_EMPTY) {
+ throw new error_1.MongoTransactionError('Cannot call abortTransaction after calling commitTransaction');
+ }
+ const command = { abortTransaction: 1 };
+ const timeoutMS = typeof options?.timeoutMS === 'number'
+ ? options.timeoutMS
+ : this.timeoutContext?.csotEnabled()
+ ? this.timeoutContext.timeoutMS // refresh timeoutMS for abort operation
+ : typeof this.timeoutMS === 'number'
+ ? this.timeoutMS
+ : null;
+ const timeoutContext = timeoutMS != null
+ ? timeout_1.TimeoutContext.create({
+ timeoutMS,
+ serverSelectionTimeoutMS: this.clientOptions.serverSelectionTimeoutMS,
+ socketTimeoutMS: this.clientOptions.socketTimeoutMS
+ })
+ : null;
+ const wc = this.transaction.options.writeConcern ?? this.clientOptions?.writeConcern;
+ if (wc != null && timeoutMS == null) {
+ write_concern_1.WriteConcern.apply(command, { wtimeoutMS: 10000, w: 'majority', ...wc });
+ }
+ if (this.transaction.recoveryToken) {
+ command.recoveryToken = this.transaction.recoveryToken;
+ }
+ const operation = new run_command_1.RunCommandOperation(new utils_1.MongoDBNamespace('admin'), command, {
+ session: this,
+ readPreference: read_preference_1.ReadPreference.primary,
+ bypassPinningCheck: true
+ });
+ try {
+ await (0, execute_operation_1.executeOperation)(this.client, operation, timeoutContext);
+ this.unpin();
+ return;
+ }
+ catch (firstAbortError) {
+ this.unpin();
+ if (firstAbortError.name === 'MongoRuntimeError')
+ throw firstAbortError;
+ if (options?.throwTimeout && firstAbortError.name === 'MongoOperationTimeoutError') {
+ throw firstAbortError;
+ }
+ if (firstAbortError instanceof error_1.MongoError && (0, error_1.isRetryableWriteError)(firstAbortError)) {
+ try {
+ await (0, execute_operation_1.executeOperation)(this.client, operation, timeoutContext);
+ return;
+ }
+ catch (secondAbortError) {
+ if (secondAbortError.name === 'MongoRuntimeError')
+ throw secondAbortError;
+ if (options?.throwTimeout && secondAbortError.name === 'MongoOperationTimeoutError') {
+ throw secondAbortError;
+ }
+ // we do not retry the retry
+ }
+ }
+ // The spec indicates that if the operation times out or fails with a non-retryable error, we should ignore all errors on `abortTransaction`
+ }
+ finally {
+ this.transaction.transition(transactions_1.TxnState.TRANSACTION_ABORTED);
+ if (this.loadBalanced) {
+ maybeClearPinnedConnection(this, { force: false });
+ }
+ }
+ }
+ /**
+ * This is here to ensure that ClientSession is never serialized to BSON.
+ */
+ toBSON() {
+ throw new error_1.MongoRuntimeError('ClientSession cannot be serialized to BSON.');
+ }
+ /**
+ * Starts a transaction and runs a provided function, ensuring the commitTransaction is always attempted when all operations run in the function have completed.
+ *
+ * **IMPORTANT:** This method requires the function passed in to return a Promise. That promise must be made by `await`-ing all operations in such a way that rejections are propagated to the returned promise.
+ *
+ * **IMPORTANT:** Running operations in parallel is not supported during a transaction. The use of `Promise.all`,
+ * `Promise.allSettled`, `Promise.race`, etc to parallelize operations inside a transaction is
+ * undefined behaviour.
+ *
+ * **IMPORTANT:** When running an operation inside a `withTransaction` callback, if it is not
+ * provided the explicit session in its options, it will not be part of the transaction and it will not respect timeoutMS.
+ *
+ *
+ * @remarks
+ * - If all operations successfully complete and the `commitTransaction` operation is successful, then the provided function will return the result of the provided function.
+ * - If the transaction is unable to complete or an error is thrown from within the provided function, then the provided function will throw an error.
+ * - If the transaction is manually aborted within the provided function it will not throw.
+ * - If the driver needs to attempt to retry the operations, the provided function may be called multiple times.
+ *
+ * Checkout a descriptive example here:
+ * @see https://www.mongodb.com/blog/post/quick-start-nodejs--mongodb--how-to-implement-transactions
+ *
+ * If a command inside withTransaction fails:
+ * - It may cause the transaction on the server to be aborted.
+ * - This situation is normally handled transparently by the driver.
+ * - However, if the application catches such an error and does not rethrow it, the driver will not be able to determine whether the transaction was aborted or not.
+ * - The driver will then retry the transaction indefinitely.
+ *
+ * To avoid this situation, the application must not silently handle errors within the provided function.
+ * If the application needs to handle errors within, it must await all operations such that if an operation is rejected it becomes the rejection of the callback function passed into withTransaction.
+ *
+ * @param fn - callback to run within a transaction
+ * @param options - optional settings for the transaction
+ * @returns A raw command response or undefined
+ */
+ async withTransaction(fn, options) {
+ const MAX_TIMEOUT = 120_000;
+ const timeoutMS = options?.timeoutMS ?? this.timeoutMS ?? null;
+ this.timeoutContext =
+ timeoutMS != null
+ ? timeout_1.TimeoutContext.create({
+ timeoutMS,
+ serverSelectionTimeoutMS: this.clientOptions.serverSelectionTimeoutMS,
+ socketTimeoutMS: this.clientOptions.socketTimeoutMS
+ })
+ : null;
+ // 1. Define the following:
+ // 1.1 Record the current monotonic time, which will be used to enforce the 120-second / CSOT timeout before later retry attempts.
+ // 1.2 Set `transactionAttempt` to `0`.
+ // 1.3 Set `TIMEOUT_MS` to be `timeoutMS` if given, otherwise MAX_TIMEOUT (120-seconds).
+ // Timeout Error propagation
+ // When the previously encountered error needs to be propagated because there is no more time for another attempt,
+ // and it is not already a timeout error, then:
+ // - A timeout error MUST be propagated instead. It MUST expose the previously encountered error as specified in
+ // the "Errors" section of the CSOT specification.
+ // - If exposing the previously encountered error from a timeout error is impossible in a driver, then the driver
+ // is exempt from the requirement and MUST propagate the previously encountered error as is. The timeout error
+ // MUST copy all error labels from the previously encountered error.
+ // The spec describes timeout checks as "elapsed time < TIMEOUT_MS" (where elapsed = now - start).
+ // We precompute `deadline = now + remainingTimeMS` so each check becomes simply `now < deadline`.
+ const csotEnabled = !!this.timeoutContext?.csotEnabled();
+ const remainingTimeMS = this.timeoutContext?.csotEnabled()
+ ? this.timeoutContext.remainingTimeMS
+ : MAX_TIMEOUT;
+ const deadline = (0, utils_1.processTimeMS)() + remainingTimeMS;
+ let committed = false;
+ let result;
+ let lastError = null;
+ try {
+ retryTransaction: for (let transactionAttempt = 0, isRetry = false; !committed; ++transactionAttempt, isRetry = transactionAttempt > 0) {
+ // 2. If `transactionAttempt` > 0:
+ if (isRetry) {
+ // 2.1 Calculate backoffMS to be jitter * min(BACKOFF_INITIAL * 1.5 ** (transactionAttempt - 1), BACKOFF_MAX).
+ // If elapsed time + backoffMS > TIMEOUT_MS, then propagate the previously encountered error to the caller of
+ // withTransaction as per timeout error propagation and return immediately. Otherwise, sleep for backoffMS.
+ // 2.1.1 jitter is a random float between [0, 1), optionally including 1, depending on what is most natural
+ // for the given driver language.
+ // 2.1.2 transactionAttempt is the variable defined in step 1.
+ // 2.1.3 BACKOFF_INITIAL is 5ms
+ // 2.1.4 BACKOFF_MAX is 500ms
+ const BACKOFF_INITIAL_MS = 5;
+ const BACKOFF_MAX_MS = 500;
+ const BACKOFF_GROWTH = 1.5;
+ const jitter = Math.random();
+ const backoffMS = jitter *
+ Math.min(BACKOFF_INITIAL_MS * BACKOFF_GROWTH ** (transactionAttempt - 1), BACKOFF_MAX_MS);
+ if ((0, utils_1.processTimeMS)() + backoffMS >= deadline) {
+ throw makeTimeoutError(lastError ??
+ new error_1.MongoRuntimeError(`Transaction retry did not record an error: should never occur. Please file a bug.`), csotEnabled);
+ }
+ await (0, promises_1.setTimeout)(backoffMS);
+ }
+ // 3. Invoke startTransaction on the session and increment transactionAttempt. If TransactionOptions were
+ // specified in the call to withTransaction, those MUST be used for startTransaction. Note that
+ // ClientSession.defaultTransactionOptions will be used in the absence of any explicit TransactionOptions.
+ // 4. If startTransaction reported an error, propagate that error to the caller of withTransaction as is and
+ // return immediately.
+ this.startTransaction(options);
+ try {
+ // 5. Invoke the callback. Drivers MUST ensure that the ClientSession can be accessed within the callback
+ // (e.g. pass ClientSession as the first parameter, rely on lexical scoping). Drivers MAY pass additional
+ // parameters as needed (e.g. user data solicited by withTransaction).
+ const promise = fn(this);
+ if (!(0, utils_1.isPromiseLike)(promise)) {
+ throw new error_1.MongoInvalidArgumentError('Function provided to `withTransaction` must return a Promise');
+ }
+ // 6. Control returns to withTransaction. Determine the current state of the ClientSession and whether the
+ // callback reported an error (e.g. thrown exception, error output parameter).
+ result = await promise;
+ // 8. If the ClientSession is in the "no transaction", "transaction aborted", or "transaction committed"
+ // state, assume the callback intentionally aborted or committed the transaction and return immediately.
+ if (this.transaction.state === transactions_1.TxnState.NO_TRANSACTION ||
+ this.transaction.state === transactions_1.TxnState.TRANSACTION_COMMITTED ||
+ this.transaction.state === transactions_1.TxnState.TRANSACTION_ABORTED) {
+ return result;
+ }
+ }
+ catch (fnError) {
+ // 7. If the callback reported an error
+ if (!(fnError instanceof error_1.MongoError) || fnError instanceof error_1.MongoInvalidArgumentError) {
+ // This first preemptive abort regardless of TxnState isn't spec,
+ // and it's unclear whether it's serving a practical purpose, but this logic is OLD
+ await this.abortTransaction();
+ throw fnError;
+ }
+ lastError = fnError;
+ // 7.1 If the ClientSession is in the "starting transaction" or "transaction in progress"
+ // state, invoke abortTransaction on the session.
+ if (this.transaction.state === transactions_1.TxnState.STARTING_TRANSACTION ||
+ this.transaction.state === transactions_1.TxnState.TRANSACTION_IN_PROGRESS) {
+ await this.abortTransaction();
+ }
+ // 7.2 If the callback's error includes a "TransientTransactionError" label, jump back to step two.
+ if (fnError.hasErrorLabel(error_1.MongoErrorLabel.TransientTransactionError)) {
+ if ((0, utils_1.processTimeMS)() >= deadline) {
+ throw makeTimeoutError(lastError, csotEnabled);
+ }
+ continue retryTransaction;
+ }
+ // 7.3 If the callback's error includes a "UnknownTransactionCommitResult" label, the callback must
+ // have manually committed a transaction, propagate the callback's error to the caller of withTransaction
+ // as is and return immediately.
+ // 7.4 Otherwise, propagate the callback's error to the caller of withTransaction as is and return immediately.
+ throw fnError;
+ }
+ retryCommit: while (!committed) {
+ try {
+ // 9. Invoke commitTransaction on the session.
+ await this.commitTransaction();
+ committed = true;
+ }
+ catch (commitError) {
+ // 10. If commitTransaction reported an error:
+ lastError = commitError;
+ // 10.1 If the commitTransaction error includes a UnknownTransactionCommitResult label and the error is
+ // not MaxTimeMSExpired
+ if (commitError.hasErrorLabel(error_1.MongoErrorLabel.UnknownTransactionCommitResult) &&
+ !isMaxTimeMSExpiredError(commitError)) {
+ // 10.1.1 If the elapsed time of withTransaction exceeded TIMEOUT_MS, propagate the commitTransaction
+ // error to the caller of withTransaction as per timeout error propagation and return immediately.
+ if ((0, utils_1.processTimeMS)() >= deadline) {
+ throw makeTimeoutError(commitError, csotEnabled);
+ }
+ // 10.1.2 Otherwise, jump back to step nine. We will trust commitTransaction to apply a majority write
+ // concern on retry attempts (see: Majority write concern is used when retrying commitTransaction).
+ continue retryCommit;
+ }
+ // 10.2 If the commitTransaction error includes a TransientTransactionError label, jump back to step two.
+ if (commitError.hasErrorLabel(error_1.MongoErrorLabel.TransientTransactionError)) {
+ continue retryTransaction;
+ }
+ // 10.3 Otherwise, propagate the commitTransaction error to the caller of withTransaction as is and return
+ // immediately.
+ throw commitError;
+ }
+ }
+ }
+ // 11. The transaction was committed successfully. Return immediately.
+ // @ts-expect-error Result is always defined if we reach here, the for-loop above convinces TS it is not.
+ return result;
+ }
+ finally {
+ this.timeoutContext = null;
+ }
+ }
+}
+exports.ClientSession = ClientSession;
+function makeTimeoutError(cause, csotEnabled) {
+ // Async APIs know how to cancel themselves and might return CSOT error
+ if (cause instanceof error_1.MongoOperationTimeoutError) {
+ return cause;
+ }
+ if (csotEnabled) {
+ const timeoutError = new error_1.MongoOperationTimeoutError('Timed out during withTransaction', {
+ cause
+ });
+ if (cause instanceof error_1.MongoError) {
+ for (const label of cause.errorLabels) {
+ timeoutError.addErrorLabel(label);
+ }
+ }
+ return timeoutError;
+ }
+ return cause;
+}
+const NON_DETERMINISTIC_WRITE_CONCERN_ERRORS = new Set([
+ 'CannotSatisfyWriteConcern',
+ 'UnknownReplWriteConcern',
+ 'UnsatisfiableWriteConcern'
+]);
+function shouldUnpinAfterCommitError(commitError) {
+ if (commitError instanceof error_1.MongoError) {
+ if ((0, error_1.isRetryableWriteError)(commitError) ||
+ commitError instanceof error_1.MongoWriteConcernError ||
+ isMaxTimeMSExpiredError(commitError)) {
+ if (isUnknownTransactionCommitResult(commitError)) {
+ // per txns spec, must unpin session in this case
+ return true;
+ }
+ }
+ else if (commitError.hasErrorLabel(error_1.MongoErrorLabel.TransientTransactionError)) {
+ return true;
+ }
+ }
+ return false;
+}
+function shouldAddUnknownTransactionCommitResultLabel(commitError) {
+ let ok = (0, error_1.isRetryableWriteError)(commitError);
+ ok ||= commitError instanceof error_1.MongoWriteConcernError;
+ ok ||= isMaxTimeMSExpiredError(commitError);
+ ok &&= isUnknownTransactionCommitResult(commitError);
+ return ok;
+}
+function isUnknownTransactionCommitResult(err) {
+ const isNonDeterministicWriteConcernError = err instanceof error_1.MongoServerError &&
+ err.codeName &&
+ NON_DETERMINISTIC_WRITE_CONCERN_ERRORS.has(err.codeName);
+ return (isMaxTimeMSExpiredError(err) ||
+ (!isNonDeterministicWriteConcernError &&
+ err.code !== error_1.MONGODB_ERROR_CODES.UnsatisfiableWriteConcern &&
+ err.code !== error_1.MONGODB_ERROR_CODES.UnknownReplWriteConcern));
+}
+function maybeClearPinnedConnection(session, options) {
+ // unpin a connection if it has been pinned
+ const conn = session.pinnedConnection;
+ const error = options?.error;
+ if (session.inTransaction() &&
+ error &&
+ error instanceof error_1.MongoError &&
+ error.hasErrorLabel(error_1.MongoErrorLabel.TransientTransactionError)) {
+ return;
+ }
+ const topology = session.client.topology;
+ // NOTE: the spec talks about what to do on a network error only, but the tests seem to
+ // to validate that we don't unpin on _all_ errors?
+ if (conn && topology != null) {
+ const servers = Array.from(topology.s.servers.values());
+ const loadBalancer = servers[0];
+ if (options?.error == null || options?.force) {
+ loadBalancer.pool.checkIn(conn);
+ session.pinnedConnection = undefined;
+ conn.emit(constants_1.UNPINNED, session.transaction.state !== transactions_1.TxnState.NO_TRANSACTION
+ ? metrics_1.ConnectionPoolMetrics.TXN
+ : metrics_1.ConnectionPoolMetrics.CURSOR);
+ if (options?.forceClear) {
+ loadBalancer.pool.clear({ serviceId: conn.serviceId });
+ }
+ }
+ }
+}
+function isMaxTimeMSExpiredError(err) {
+ if (err == null || !(err instanceof error_1.MongoServerError)) {
+ return false;
+ }
+ return (err.code === error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired ||
+ err.writeConcernError?.code === error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired);
+}
+/**
+ * Reflects the existence of a session on the server. Can be reused by the session pool.
+ * WARNING: not meant to be instantiated directly. For internal use only.
+ * @public
+ */
+class ServerSession {
+ /** @internal */
+ constructor(cloned) {
+ if (cloned != null) {
+ const idBytes = bson_1.ByteUtils.allocateUnsafe(16);
+ idBytes.set(cloned.id.id.buffer);
+ this.id = { id: new bson_1.Binary(idBytes, cloned.id.id.sub_type) };
+ this.lastUse = cloned.lastUse;
+ this.txnNumber = cloned.txnNumber;
+ this.isDirty = cloned.isDirty;
+ return;
+ }
+ this.id = { id: new bson_1.Binary((0, utils_1.uuidV4)(), bson_1.Binary.SUBTYPE_UUID) };
+ this.lastUse = (0, utils_1.processTimeMS)();
+ this.txnNumber = 0;
+ this.isDirty = false;
+ }
+ /**
+ * Determines if the server session has timed out.
+ *
+ * @param sessionTimeoutMinutes - The server's "logicalSessionTimeoutMinutes"
+ */
+ hasTimedOut(sessionTimeoutMinutes) {
+ // Take the difference of the lastUse timestamp and now, which will result in a value in
+ // milliseconds, and then convert milliseconds to minutes to compare to `sessionTimeoutMinutes`
+ const idleTimeMinutes = Math.round((((0, utils_1.calculateDurationInMs)(this.lastUse) % 86400000) % 3600000) / 60000);
+ return idleTimeMinutes > sessionTimeoutMinutes - 1;
+ }
+}
+exports.ServerSession = ServerSession;
+/**
+ * Maintains a pool of Server Sessions.
+ * For internal use only
+ * @internal
+ */
+class ServerSessionPool {
+ constructor(client) {
+ if (client == null) {
+ throw new error_1.MongoRuntimeError('ServerSessionPool requires a MongoClient');
+ }
+ this.client = client;
+ this.sessions = new utils_1.List();
+ }
+ /**
+ * Acquire a Server Session from the pool.
+ * Iterates through each session in the pool, removing any stale sessions
+ * along the way. The first non-stale session found is removed from the
+ * pool and returned. If no non-stale session is found, a new ServerSession is created.
+ */
+ acquire() {
+ const sessionTimeoutMinutes = this.client.topology?.logicalSessionTimeoutMinutes ?? 10;
+ let session = null;
+ // Try to obtain from session pool
+ while (this.sessions.length > 0) {
+ const potentialSession = this.sessions.shift();
+ if (potentialSession != null &&
+ (!!this.client.topology?.loadBalanced ||
+ !potentialSession.hasTimedOut(sessionTimeoutMinutes))) {
+ session = potentialSession;
+ break;
+ }
+ }
+ // If nothing valid came from the pool make a new one
+ if (session == null) {
+ session = new ServerSession();
+ }
+ return session;
+ }
+ /**
+ * Release a session to the session pool
+ * Adds the session back to the session pool if the session has not timed out yet.
+ * This method also removes any stale sessions from the pool.
+ *
+ * @param session - The session to release to the pool
+ */
+ release(session) {
+ const sessionTimeoutMinutes = this.client.topology?.logicalSessionTimeoutMinutes ?? 10;
+ if (this.client.topology?.loadBalanced && !sessionTimeoutMinutes) {
+ this.sessions.unshift(session);
+ }
+ if (!sessionTimeoutMinutes) {
+ return;
+ }
+ this.sessions.prune(session => session.hasTimedOut(sessionTimeoutMinutes));
+ if (!session.hasTimedOut(sessionTimeoutMinutes)) {
+ if (session.isDirty) {
+ return;
+ }
+ // otherwise, readd this session to the session pool
+ this.sessions.unshift(session);
+ }
+ }
+}
+exports.ServerSessionPool = ServerSessionPool;
+/**
+ * Optionally decorate a command with sessions specific keys
+ *
+ * @param session - the session tracking transaction state
+ * @param command - the command to decorate
+ * @param options - Optional settings passed to calling operation
+ *
+ * @internal
+ */
+function applySession(session, command, options) {
+ if (session.hasEnded) {
+ return new error_1.MongoExpiredSessionError();
+ }
+ // May acquire serverSession here
+ const serverSession = session.serverSession;
+ if (serverSession == null) {
+ return new error_1.MongoRuntimeError('Unable to acquire server session');
+ }
+ if (options.writeConcern?.w === 0) {
+ if (session && session.explicit) {
+ // Error if user provided an explicit session to an unacknowledged write (SPEC-1019)
+ return new error_1.MongoAPIError('Cannot have explicit session with unacknowledged writes');
+ }
+ return;
+ }
+ // mark the last use of this session, and apply the `lsid`
+ serverSession.lastUse = (0, utils_1.processTimeMS)();
+ command.lsid = serverSession.id;
+ const inTxnOrTxnCommand = session.inTransaction() || (0, transactions_1.isTransactionCommand)(command);
+ const isRetryableWrite = !!options.willRetryWrite;
+ if (isRetryableWrite || inTxnOrTxnCommand) {
+ serverSession.txnNumber += session.txnNumberIncrement;
+ session.txnNumberIncrement = 0;
+ // TODO(NODE-2674): Preserve int64 sent from MongoDB
+ command.txnNumber = bson_1.Long.fromNumber(serverSession.txnNumber);
+ }
+ if (!inTxnOrTxnCommand) {
+ if (session.transaction.state !== transactions_1.TxnState.NO_TRANSACTION) {
+ session.transaction.transition(transactions_1.TxnState.NO_TRANSACTION);
+ }
+ if (session.supports.causalConsistency &&
+ session.operationTime &&
+ (0, utils_1.commandSupportsReadConcern)(command)) {
+ command.readConcern = command.readConcern || {};
+ Object.assign(command.readConcern, { afterClusterTime: session.operationTime });
+ }
+ else if (session.snapshotEnabled) {
+ command.readConcern = command.readConcern || { level: read_concern_1.ReadConcernLevel.snapshot };
+ if (session.snapshotTime != null) {
+ Object.assign(command.readConcern, { atClusterTime: session.snapshotTime });
+ }
+ }
+ return;
+ }
+ // now attempt to apply transaction-specific sessions data
+ // `autocommit` must always be false to differentiate from retryable writes
+ command.autocommit = false;
+ if (session.transaction.state === transactions_1.TxnState.STARTING_TRANSACTION) {
+ command.startTransaction = true;
+ const readConcern = session.transaction.options.readConcern || session?.clientOptions?.readConcern;
+ if (readConcern) {
+ command.readConcern = readConcern;
+ }
+ if (session.supports.causalConsistency && session.operationTime) {
+ command.readConcern = command.readConcern || {};
+ Object.assign(command.readConcern, { afterClusterTime: session.operationTime });
+ }
+ }
+ return;
+}
+function updateSessionFromResponse(session, document) {
+ if (document.$clusterTime) {
+ (0, common_1._advanceClusterTime)(session, document.$clusterTime);
+ }
+ if (document.operationTime && session && session.supports.causalConsistency) {
+ session.advanceOperationTime(document.operationTime);
+ }
+ if (document.recoveryToken && session && session.inTransaction()) {
+ session.transaction._recoveryToken = document.recoveryToken;
+ }
+ if (session?.snapshotEnabled && session.snapshotTime == null) {
+ // find and aggregate commands return atClusterTime on the cursor
+ // distinct includes it in the response body
+ const atClusterTime = document.atClusterTime;
+ if (atClusterTime) {
+ session.snapshotTime = atClusterTime;
+ }
+ }
+ if (session.transaction.state === transactions_1.TxnState.STARTING_TRANSACTION) {
+ if (document.ok === 1) {
+ session.transaction.transition(transactions_1.TxnState.TRANSACTION_IN_PROGRESS);
+ }
+ else {
+ const error = new error_1.MongoServerError(document.toObject());
+ const isRetryableError = error.hasErrorLabel(error_1.MongoErrorLabel.RetryableError);
+ if (!isRetryableError) {
+ session.transaction.transition(transactions_1.TxnState.TRANSACTION_IN_PROGRESS);
+ }
+ }
+ }
+}
+//# sourceMappingURL=sessions.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sessions.js.map b/node_modules/mongodb/lib/sessions.js.map
new file mode 100644
index 00000000..117f8c05
--- /dev/null
+++ b/node_modules/mongodb/lib/sessions.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../src/sessions.ts"],"names":[],"mappings":";;;AAu9BA,gEAuCC;AAsJD,oCA+EC;AAED,8DAkCC;AAvwCD,8CAA6C;AAE7C,iCAAgF;AAEhF,4CAAuD;AAEvD,2CAA+C;AAE/C,mCAgBiB;AAEjB,+CAAkD;AAClD,sEAAkE;AAClE,0DAA+D;AAC/D,iDAAkD;AAClD,uDAAmD;AACnD,0CAAoF;AACpF,uCAA2C;AAC3C,iDAKwB;AACxB,mCAUiB;AACjB,mDAAoG;AAgDpG;;;;;GAKG;AACH,MAAa,aACX,SAAQ,+BAAsC;IA2C9C;;;;;;;OAOG;IACH,YACE,MAAmB,EACnB,WAA8B,EAC9B,OAA6B,EAC7B,aAA2B;QAE3B,KAAK,EAAE,CAAC;QAjBV,gBAAgB;QACT,mB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AK,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,uBAAQ,CAAC,uBAAuB,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,GAAG,IAAI,wBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;YACxD,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAe,CAAC,cAAc,CAAC,CAAC;YAE7E,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACtB,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,uBAAQ,CAAC,uBAAuB,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sort.js b/node_modules/mongodb/lib/sort.js
new file mode 100644
index 00000000..b795fcdc
--- /dev/null
+++ b/node_modules/mongodb/lib/sort.js
@@ -0,0 +1,103 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.formatSort = formatSort;
+const error_1 = require("./error");
+/** @internal */
+function prepareDirection(direction = 1) {
+ const value = `${direction}`.toLowerCase();
+ if (isMeta(direction))
+ return direction;
+ switch (value) {
+ case 'ascending':
+ case 'asc':
+ case '1':
+ return 1;
+ case 'descending':
+ case 'desc':
+ case '-1':
+ return -1;
+ default:
+ throw new error_1.MongoInvalidArgumentError(`Invalid sort direction: ${JSON.stringify(direction)}`);
+ }
+}
+/** @internal */
+function isMeta(t) {
+ return typeof t === 'object' && t != null && '$meta' in t && typeof t.$meta === 'string';
+}
+/** @internal */
+function isPair(t) {
+ if (Array.isArray(t) && t.length === 2) {
+ try {
+ prepareDirection(t[1]);
+ return true;
+ }
+ catch {
+ return false;
+ }
+ }
+ return false;
+}
+function isDeep(t) {
+ return Array.isArray(t) && Array.isArray(t[0]);
+}
+function isMap(t) {
+ return t instanceof Map && t.size > 0;
+}
+function isReadonlyArray(value) {
+ return Array.isArray(value);
+}
+/** @internal */
+function pairToMap(v) {
+ return new Map([[`${v[0]}`, prepareDirection([v[1]])]]);
+}
+/** @internal */
+function deepToMap(t) {
+ const sortEntries = t.map(([k, v]) => [`${k}`, prepareDirection(v)]);
+ return new Map(sortEntries);
+}
+/** @internal */
+function stringsToMap(t) {
+ const sortEntries = t.map(key => [`${key}`, 1]);
+ return new Map(sortEntries);
+}
+/** @internal */
+function objectToMap(t) {
+ const sortEntries = Object.entries(t).map(([k, v]) => [
+ `${k}`,
+ prepareDirection(v)
+ ]);
+ return new Map(sortEntries);
+}
+/** @internal */
+function mapToMap(t) {
+ const sortEntries = Array.from(t).map(([k, v]) => [
+ `${k}`,
+ prepareDirection(v)
+ ]);
+ return new Map(sortEntries);
+}
+/** converts a Sort type into a type that is valid for the server (SortForCmd) */
+function formatSort(sort, direction) {
+ if (sort == null)
+ return undefined;
+ if (typeof sort === 'string')
+ return new Map([[sort, prepareDirection(direction)]]); // 'fieldName'
+ if (typeof sort !== 'object') {
+ throw new error_1.MongoInvalidArgumentError(`Invalid sort format: ${JSON.stringify(sort)} Sort must be a valid object`);
+ }
+ if (!isReadonlyArray(sort)) {
+ if (isMap(sort))
+ return mapToMap(sort); // Map
+ if (Object.keys(sort).length)
+ return objectToMap(sort); // { [fieldName: string]: SortDirection }
+ return undefined;
+ }
+ if (!sort.length)
+ return undefined;
+ if (isDeep(sort))
+ return deepToMap(sort); // [ [fieldName, sortDir], [fieldName, sortDir] ... ]
+ if (isPair(sort))
+ return pairToMap(sort); // [ fieldName, sortDir ]
+ return stringsToMap(sort); // [ fieldName, fieldName ]
+}
+//# sourceMappingURL=sort.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/sort.js.map b/node_modules/mongodb/lib/sort.js.map
new file mode 100644
index 00000000..e1997c96
--- /dev/null
+++ b/node_modules/mongodb/lib/sort.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"sort.js","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":";;AAqHA,gCAuBC;A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AAI,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB;IACnE,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,2BAA2B;AACxD,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/timeout.js b/node_modules/mongodb/lib/timeout.js
new file mode 100644
index 00000000..fbd23125
--- /dev/null
+++ b/node_modules/mongodb/lib/timeout.js
@@ -0,0 +1,296 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.LegacyTimeoutContext = exports.CSOTTimeoutContext = exports.TimeoutContext = exports.Timeout = exports.TimeoutError = void 0;
+const timers_1 = require("timers");
+const error_1 = require("./error");
+const utils_1 = require("./utils");
+/** @internal */
+class TimeoutError extends Error {
+ get name() {
+ return 'TimeoutError';
+ }
+ constructor(message, options) {
+ super(message, options);
+ this.duration = options.duration;
+ }
+ static is(error) {
+ return (error != null && typeof error === 'object' && 'name' in error && error.name === 'TimeoutError');
+ }
+}
+exports.TimeoutError = TimeoutError;
+/**
+ * @internal
+ * This class is an abstraction over timeouts
+ * The Timeout class can only be in the pending or rejected states. It is guaranteed not to resolve
+ * if interacted with exclusively through its public API
+ * */
+class Timeout extends Promise {
+ get remainingTime() {
+ if (this.timedOut)
+ return 0;
+ if (this.duration === 0)
+ return Infinity;
+ return this.start + this.duration - Math.trunc(performance.now());
+ }
+ get timeElapsed() {
+ return Math.trunc(performance.now()) - this.start;
+ }
+ /** Create a new timeout that expires in `duration` ms */
+ constructor(executor = () => null, options) {
+ const duration = options?.duration ?? 0;
+ const unref = !!options?.unref;
+ const rejection = options?.rejection;
+ if (duration < 0) {
+ throw new error_1.MongoInvalidArgumentError('Cannot create a Timeout with a negative duration');
+ }
+ let reject;
+ super((_, promiseReject) => {
+ reject = promiseReject;
+ executor(utils_1.noop, promiseReject);
+ });
+ this.ended = null;
+ this.timedOut = false;
+ this.cleared = false;
+ this.duration = duration;
+ this.start = Math.trunc(performance.now());
+ if (rejection == null && this.duration > 0) {
+ this.id = (0, timers_1.setTimeout)(() => {
+ this.ended = Math.trunc(performance.now());
+ this.timedOut = true;
+ reject(new TimeoutError(`Expired after ${duration}ms`, { duration }));
+ }, this.duration);
+ if (typeof this.id.unref === 'function' && unref) {
+ // Ensure we do not keep the Node.js event loop running
+ this.id.unref();
+ }
+ }
+ else if (rejection != null) {
+ this.ended = Math.trunc(performance.now());
+ this.timedOut = true;
+ reject(rejection);
+ }
+ }
+ /**
+ * Clears the underlying timeout. This method is idempotent
+ */
+ clear() {
+ (0, timers_1.clearTimeout)(this.id);
+ this.id = undefined;
+ this.timedOut = false;
+ this.cleared = true;
+ }
+ throwIfExpired() {
+ if (this.timedOut) {
+ // This method is invoked when someone wants to throw immediately instead of await the result of this promise
+ // Since they won't be handling the rejection from the promise (because we're about to throw here)
+ // attach handling to prevent this from bubbling up to Node.js
+ this.then(undefined, utils_1.squashError);
+ throw new TimeoutError('Timed out', { duration: this.duration });
+ }
+ }
+ static expires(duration, unref) {
+ return new Timeout(undefined, { duration, unref });
+ }
+ static reject(rejection) {
+ return new Timeout(undefined, { duration: 0, unref: true, rejection });
+ }
+}
+exports.Timeout = Timeout;
+function isLegacyTimeoutContextOptions(v) {
+ return (v != null &&
+ typeof v === 'object' &&
+ 'serverSelectionTimeoutMS' in v &&
+ typeof v.serverSelectionTimeoutMS === 'number' &&
+ 'waitQueueTimeoutMS' in v &&
+ typeof v.waitQueueTimeoutMS === 'number');
+}
+function isCSOTTimeoutContextOptions(v) {
+ return (v != null &&
+ typeof v === 'object' &&
+ 'serverSelectionTimeoutMS' in v &&
+ typeof v.serverSelectionTimeoutMS === 'number' &&
+ 'timeoutMS' in v &&
+ typeof v.timeoutMS === 'number');
+}
+/** @internal */
+class TimeoutContext {
+ static create(options) {
+ if (options.session?.timeoutContext != null)
+ return options.session?.timeoutContext;
+ if (isCSOTTimeoutContextOptions(options))
+ return new CSOTTimeoutContext(options);
+ else if (isLegacyTimeoutContextOptions(options))
+ return new LegacyTimeoutContext(options);
+ else
+ throw new error_1.MongoRuntimeError('Unrecognized options');
+ }
+}
+exports.TimeoutContext = TimeoutContext;
+/** @internal */
+class CSOTTimeoutContext extends TimeoutContext {
+ constructor(options) {
+ super();
+ this.minRoundTripTime = 0;
+ this.start = Math.trunc(performance.now());
+ this.timeoutMS = options.timeoutMS;
+ this.serverSelectionTimeoutMS = options.serverSelectionTimeoutMS;
+ this.socketTimeoutMS = options.socketTimeoutMS;
+ this.clearServerSelectionTimeout = false;
+ }
+ get maxTimeMS() {
+ return this.remainingTimeMS - this.minRoundTripTime;
+ }
+ get remainingTimeMS() {
+ const timePassed = Math.trunc(performance.now()) - this.start;
+ return this.timeoutMS <= 0 ? Infinity : this.timeoutMS - timePassed;
+ }
+ csotEnabled() {
+ return true;
+ }
+ get serverSelectionTimeout() {
+ // check for undefined
+ if (typeof this._serverSelectionTimeout !== 'object' || this._serverSelectionTimeout?.cleared) {
+ const { remainingTimeMS, serverSelectionTimeoutMS } = this;
+ if (remainingTimeMS <= 0)
+ return Timeout.reject(new error_1.MongoOperationTimeoutError(`Timed out in server selection after ${this.timeoutMS}ms`));
+ const usingServerSelectionTimeoutMS = serverSelectionTimeoutMS !== 0 &&
+ (0, utils_1.csotMin)(remainingTimeMS, serverSelectionTimeoutMS) === serverSelectionTimeoutMS;
+ if (usingServerSelectionTimeoutMS) {
+ this._serverSelectionTimeout = Timeout.expires(serverSelectionTimeoutMS);
+ }
+ else {
+ if (remainingTimeMS > 0 && Number.isFinite(remainingTimeMS)) {
+ this._serverSelectionTimeout = Timeout.expires(remainingTimeMS);
+ }
+ else {
+ this._serverSelectionTimeout = null;
+ }
+ }
+ }
+ return this._serverSelectionTimeout;
+ }
+ get connectionCheckoutTimeout() {
+ if (typeof this._connectionCheckoutTimeout !== 'object' ||
+ this._connectionCheckoutTimeout?.cleared) {
+ if (typeof this._serverSelectionTimeout === 'object') {
+ // null or Timeout
+ this._connectionCheckoutTimeout = this._serverSelectionTimeout;
+ }
+ else {
+ throw new error_1.MongoRuntimeError('Unreachable. If you are seeing this error, please file a ticket on the NODE driver project on Jira');
+ }
+ }
+ return this._connectionCheckoutTimeout;
+ }
+ get timeoutForSocketWrite() {
+ const { remainingTimeMS } = this;
+ if (!Number.isFinite(remainingTimeMS))
+ return null;
+ if (remainingTimeMS > 0)
+ return Timeout.expires(remainingTimeMS);
+ return Timeout.reject(new error_1.MongoOperationTimeoutError('Timed out before socket write'));
+ }
+ get timeoutForSocketRead() {
+ const { remainingTimeMS } = this;
+ if (!Number.isFinite(remainingTimeMS))
+ return null;
+ if (remainingTimeMS > 0)
+ return Timeout.expires(remainingTimeMS);
+ return Timeout.reject(new error_1.MongoOperationTimeoutError('Timed out before socket read'));
+ }
+ refresh() {
+ this.start = Math.trunc(performance.now());
+ this.minRoundTripTime = 0;
+ this._serverSelectionTimeout?.clear();
+ this._connectionCheckoutTimeout?.clear();
+ }
+ clear() {
+ this._serverSelectionTimeout?.clear();
+ this._connectionCheckoutTimeout?.clear();
+ }
+ /**
+ * @internal
+ * Throws a MongoOperationTimeoutError if the context has expired.
+ * If the context has not expired, returns the `remainingTimeMS`
+ **/
+ getRemainingTimeMSOrThrow(message) {
+ const { remainingTimeMS } = this;
+ if (remainingTimeMS <= 0)
+ throw new error_1.MongoOperationTimeoutError(message ?? `Expired after ${this.timeoutMS}ms`);
+ return remainingTimeMS;
+ }
+ /**
+ * @internal
+ * This method is intended to be used in situations where concurrent operation are on the same deadline, but cannot share a single `TimeoutContext` instance.
+ * Returns a new instance of `CSOTTimeoutContext` constructed with identical options, but setting the `start` property to `this.start`.
+ */
+ clone() {
+ const timeoutContext = new CSOTTimeoutContext({
+ timeoutMS: this.timeoutMS,
+ serverSelectionTimeoutMS: this.serverSelectionTimeoutMS
+ });
+ timeoutContext.start = this.start;
+ return timeoutContext;
+ }
+ refreshed() {
+ return new CSOTTimeoutContext(this);
+ }
+ addMaxTimeMSToCommand(command, options) {
+ if (options.omitMaxTimeMS)
+ return;
+ const maxTimeMS = this.remainingTimeMS - this.minRoundTripTime;
+ if (maxTimeMS > 0 && Number.isFinite(maxTimeMS))
+ command.maxTimeMS = maxTimeMS;
+ }
+ getSocketTimeoutMS() {
+ return 0;
+ }
+}
+exports.CSOTTimeoutContext = CSOTTimeoutContext;
+/** @internal */
+class LegacyTimeoutContext extends TimeoutContext {
+ constructor(options) {
+ super();
+ this.options = options;
+ this.clearServerSelectionTimeout = true;
+ }
+ csotEnabled() {
+ return false;
+ }
+ get serverSelectionTimeout() {
+ if (this.options.serverSelectionTimeoutMS != null && this.options.serverSelectionTimeoutMS > 0)
+ return Timeout.expires(this.options.serverSelectionTimeoutMS);
+ return null;
+ }
+ get connectionCheckoutTimeout() {
+ if (this.options.waitQueueTimeoutMS != null && this.options.waitQueueTimeoutMS > 0)
+ return Timeout.expires(this.options.waitQueueTimeoutMS);
+ return null;
+ }
+ get timeoutForSocketWrite() {
+ return null;
+ }
+ get timeoutForSocketRead() {
+ return null;
+ }
+ refresh() {
+ return;
+ }
+ clear() {
+ return;
+ }
+ get maxTimeMS() {
+ return null;
+ }
+ refreshed() {
+ return new LegacyTimeoutContext(this.options);
+ }
+ addMaxTimeMSToCommand(_command, _options) {
+ // No max timeMS is added to commands in legacy timeout mode.
+ }
+ getSocketTimeoutMS() {
+ return this.options.socketTimeoutMS;
+ }
+}
+exports.LegacyTimeoutContext = LegacyTimeoutContext;
+//# sourceMappingURL=timeout.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/timeout.js.map b/node_modules/mongodb/lib/timeout.js.map
new file mode 100644
index 00000000..314ab7ac
--- /dev/null
+++ b/node_modules/mongodb/lib/timeout.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":";;;AAAA,mCAAkD;AAGlD,mCAAmG;AAEnG,mCAAqD;AAErD,gBAAgB;AAChB,MAAa,YAAa,SAAQ,KAAK;IAErC,IAAa,IAAI;QAC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IAED,IAAI,sBAAsB;QACxB,IAAI,IAAI,CAAC,OAAO,CAAC,wBAAwB,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,wBAAwB,GAAG,CAAC;YAC5F,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,yBAAyB;QAC3B,IAAI,IAAI,CAAC,OAAO,CAAC,kBAAkB,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,kBAAkB,GAAG,CAAC;YAChF,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,qBAAqB;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,oBAAoB;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,OAAO;IACT,CAAC;IAED,KAAK;QACH,OAAO;IACT,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAEQ,SAAS;QAChB,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAEQ,qBAAqB,CAAC,QAAkB,EAAE,QAAqC;QACtF,6DAA6D;IAC/D,CAAC;IAEQ,kBAAkB;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;IACtC,CAAC;CACF;AAzDD,oDAyDC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/transactions.js b/node_modules/mongodb/lib/transactions.js
new file mode 100644
index 00000000..2a79877c
--- /dev/null
+++ b/node_modules/mongodb/lib/transactions.js
@@ -0,0 +1,135 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Transaction = exports.TxnState = void 0;
+exports.isTransactionCommand = isTransactionCommand;
+const error_1 = require("./error");
+const read_concern_1 = require("./read_concern");
+const read_preference_1 = require("./read_preference");
+const write_concern_1 = require("./write_concern");
+/** @internal */
+exports.TxnState = Object.freeze({
+ NO_TRANSACTION: 'NO_TRANSACTION',
+ STARTING_TRANSACTION: 'STARTING_TRANSACTION',
+ TRANSACTION_IN_PROGRESS: 'TRANSACTION_IN_PROGRESS',
+ TRANSACTION_COMMITTED: 'TRANSACTION_COMMITTED',
+ TRANSACTION_COMMITTED_EMPTY: 'TRANSACTION_COMMITTED_EMPTY',
+ TRANSACTION_ABORTED: 'TRANSACTION_ABORTED'
+});
+const stateMachine = {
+ [exports.TxnState.NO_TRANSACTION]: [exports.TxnState.NO_TRANSACTION, exports.TxnState.STARTING_TRANSACTION],
+ [exports.TxnState.STARTING_TRANSACTION]: [
+ exports.TxnState.TRANSACTION_IN_PROGRESS,
+ exports.TxnState.TRANSACTION_COMMITTED,
+ exports.TxnState.TRANSACTION_COMMITTED_EMPTY,
+ exports.TxnState.TRANSACTION_ABORTED
+ ],
+ [exports.TxnState.TRANSACTION_IN_PROGRESS]: [
+ exports.TxnState.TRANSACTION_IN_PROGRESS,
+ exports.TxnState.TRANSACTION_COMMITTED,
+ exports.TxnState.TRANSACTION_ABORTED
+ ],
+ [exports.TxnState.TRANSACTION_COMMITTED]: [
+ exports.TxnState.TRANSACTION_COMMITTED,
+ exports.TxnState.TRANSACTION_COMMITTED_EMPTY,
+ exports.TxnState.STARTING_TRANSACTION,
+ exports.TxnState.NO_TRANSACTION
+ ],
+ [exports.TxnState.TRANSACTION_ABORTED]: [exports.TxnState.STARTING_TRANSACTION, exports.TxnState.NO_TRANSACTION],
+ [exports.TxnState.TRANSACTION_COMMITTED_EMPTY]: [
+ exports.TxnState.TRANSACTION_COMMITTED_EMPTY,
+ exports.TxnState.NO_TRANSACTION
+ ]
+};
+const ACTIVE_STATES = new Set([
+ exports.TxnState.STARTING_TRANSACTION,
+ exports.TxnState.TRANSACTION_IN_PROGRESS
+]);
+const COMMITTED_STATES = new Set([
+ exports.TxnState.TRANSACTION_COMMITTED,
+ exports.TxnState.TRANSACTION_COMMITTED_EMPTY,
+ exports.TxnState.TRANSACTION_ABORTED
+]);
+/**
+ * @internal
+ */
+class Transaction {
+ /** Create a transaction */
+ constructor(options) {
+ options = options ?? {};
+ this.state = exports.TxnState.NO_TRANSACTION;
+ this.options = {};
+ const writeConcern = write_concern_1.WriteConcern.fromOptions(options);
+ if (writeConcern) {
+ if (writeConcern.w === 0) {
+ throw new error_1.MongoTransactionError('Transactions do not support unacknowledged write concern');
+ }
+ this.options.writeConcern = writeConcern;
+ }
+ if (options.readConcern) {
+ this.options.readConcern = read_concern_1.ReadConcern.fromOptions(options);
+ }
+ if (options.readPreference) {
+ this.options.readPreference = read_preference_1.ReadPreference.fromOptions(options);
+ }
+ if (options.maxCommitTimeMS) {
+ this.options.maxTimeMS = options.maxCommitTimeMS;
+ }
+ // TODO: This isn't technically necessary
+ this._pinnedServer = undefined;
+ this._recoveryToken = undefined;
+ }
+ get server() {
+ return this._pinnedServer;
+ }
+ get recoveryToken() {
+ return this._recoveryToken;
+ }
+ get isPinned() {
+ return !!this.server;
+ }
+ /**
+ * @returns Whether the transaction has started
+ */
+ get isStarting() {
+ return this.state === exports.TxnState.STARTING_TRANSACTION;
+ }
+ /**
+ * @returns Whether this session is presently in a transaction
+ */
+ get isActive() {
+ return ACTIVE_STATES.has(this.state);
+ }
+ get isCommitted() {
+ return COMMITTED_STATES.has(this.state);
+ }
+ /**
+ * Transition the transaction in the state machine
+ * @param nextState - The new state to transition to
+ */
+ transition(nextState) {
+ const nextStates = stateMachine[this.state];
+ if (nextStates && nextStates.includes(nextState)) {
+ this.state = nextState;
+ if (this.state === exports.TxnState.NO_TRANSACTION ||
+ this.state === exports.TxnState.STARTING_TRANSACTION ||
+ this.state === exports.TxnState.TRANSACTION_ABORTED) {
+ this.unpinServer();
+ }
+ return;
+ }
+ throw new error_1.MongoRuntimeError(`Attempted illegal state transition from [${this.state}] to [${nextState}]`);
+ }
+ pinServer(server) {
+ if (this.isActive) {
+ this._pinnedServer = server;
+ }
+ }
+ unpinServer() {
+ this._pinnedServer = undefined;
+ }
+}
+exports.Transaction = Transaction;
+function isTransactionCommand(command) {
+ return !!(command.commitTransaction || command.abortTransaction);
+}
+//# sourceMappingURL=transactions.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/transactions.js.map b/node_modules/mongodb/lib/transactions.js.map
new file mode 100644
index 00000000..4e92ed10
--- /dev/null
+++ b/node_modules/mongodb/lib/transactions.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"transactions.js","sourceRoot":"","sources":["../src/transactions.ts"],"names":[],"mappings":";;;AAkLA,oDAEC;AAnLD,mCAAmE;AAEnE,iDAAmE;AACnE,uDAA4E;AAE5E,mDAA+C;AAE/C,gBAAgB;AACH,QAAA,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,cAAc,EAAE,gBAAgB;IAChC,oBAAoB,EAAE,sBAAsB;IAC5C,uBAAuB,EAAE,yBAAyB;IAClD,qBAAqB,EAAE,uBAAuB;IAC9C,2BAA2B,EAAE,6BAA6B;IAC1D,mBAAmB,EAAE,qBAAqB;CAClC,CAAC,CAAC;AAKZ,MAAM,YAAY,GAAwC;IACxD,CAAC,gBAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,gBAAQ,CAAC,cAAc,EAAE,gBAAQ,CAAC,oBAAoB,CAAC;IACnF,CAAC,gBAAQ,CAAC,oBAAoB,CAAC,EAAE;QAC/B,gBAAQ,CAAC,uBAAuB;QAChC,gBAAQ,CAAC,qBAAqB;QAC9B,gBAAQ,CAAC,2BAA2B;QACpC,gBAAQ,CAAC,mBAAmB;KAC7B;IACD,CAAC,gBAAQ,CAAC,uBAAuB,CAAC,EAAE;QAClC,gBAAQ,CAAC,uBAAuB;QAChC,gBAAQ,CAAC,qBAAqB;QAC9B,gBAAQ,CAAC,mBAAmB;KAC7B;IACD,CAAC,gBAAQ,CAAC,qBAAqB,CAAC,EAAE;QAChC,gBA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;gBAC5C,IAAI,CAAC,KAAK,KAAK,gBAAQ,CAAC,mBAAmB,EAC3C,CAAC;gBACD,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,IAAI,yBAAiB,CACzB,4CAA4C,IAAI,CAAC,KAAK,SAAS,SAAS,GAAG,CAC5E,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,WAAW;QACT,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;IACjC,CAAC;CACF;AAnGD,kCAmGC;AAED,SAAgB,oBAAoB,CAAC,OAAiB;IACpD,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnE,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/utils.js b/node_modules/mongodb/lib/utils.js
new file mode 100644
index 00000000..e528d972
--- /dev/null
+++ b/node_modules/mongodb/lib/utils.js
@@ -0,0 +1,1155 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.kDispose = exports.randomBytes = exports.COSMOS_DB_MSG = exports.DOCUMENT_DB_MSG = exports.COSMOS_DB_CHECK = exports.DOCUMENT_DB_CHECK = exports.MONGODB_WARNING_CODE = exports.DEFAULT_PK_FACTORY = exports.HostAddress = exports.BufferPool = exports.List = exports.MongoDBCollectionNamespace = exports.MongoDBNamespace = void 0;
+exports.isUint8Array = isUint8Array;
+exports.hostMatchesWildcards = hostMatchesWildcards;
+exports.normalizeHintField = normalizeHintField;
+exports.isObject = isObject;
+exports.mergeOptions = mergeOptions;
+exports.filterOptions = filterOptions;
+exports.isPromiseLike = isPromiseLike;
+exports.decorateWithCollation = decorateWithCollation;
+exports.decorateWithReadConcern = decorateWithReadConcern;
+exports.getTopology = getTopology;
+exports.ns = ns;
+exports.makeCounter = makeCounter;
+exports.uuidV4 = uuidV4;
+exports.maxWireVersion = maxWireVersion;
+exports.arrayStrictEqual = arrayStrictEqual;
+exports.errorStrictEqual = errorStrictEqual;
+exports.makeStateMachine = makeStateMachine;
+exports.processTimeMS = processTimeMS;
+exports.calculateDurationInMs = calculateDurationInMs;
+exports.hasAtomicOperators = hasAtomicOperators;
+exports.resolveTimeoutOptions = resolveTimeoutOptions;
+exports.resolveOptions = resolveOptions;
+exports.isSuperset = isSuperset;
+exports.isHello = isHello;
+exports.setDifference = setDifference;
+exports.isRecord = isRecord;
+exports.emitWarning = emitWarning;
+exports.emitWarningOnce = emitWarningOnce;
+exports.enumToString = enumToString;
+exports.supportsRetryableWrites = supportsRetryableWrites;
+exports.shuffle = shuffle;
+exports.commandSupportsReadConcern = commandSupportsReadConcern;
+exports.compareObjectId = compareObjectId;
+exports.parseInteger = parseInteger;
+exports.parseUnsignedInteger = parseUnsignedInteger;
+exports.checkParentDomainMatch = checkParentDomainMatch;
+exports.get = get;
+exports.isHostMatch = isHostMatch;
+exports.promiseWithResolvers = promiseWithResolvers;
+exports.squashError = squashError;
+exports.once = once;
+exports.maybeAddIdToDocuments = maybeAddIdToDocuments;
+exports.fileIsAccessible = fileIsAccessible;
+exports.csotMin = csotMin;
+exports.noop = noop;
+exports.decorateDecryptionResult = decorateDecryptionResult;
+exports.addAbortListener = addAbortListener;
+exports.abortable = abortable;
+const fs_1 = require("fs");
+const http = require("http");
+const process = require("process");
+const timers_1 = require("timers");
+const bson_1 = require("./bson");
+const constants_1 = require("./cmap/wire_protocol/constants");
+const constants_2 = require("./constants");
+const error_1 = require("./error");
+const read_concern_1 = require("./read_concern");
+const read_preference_1 = require("./read_preference");
+const common_1 = require("./sdam/common");
+const write_concern_1 = require("./write_concern");
+/**
+ * Returns true if value is a Uint8Array or a Buffer
+ * @param value - any value that may be a Uint8Array
+ */
+function isUint8Array(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ Symbol.toStringTag in value &&
+ value[Symbol.toStringTag] === 'Uint8Array');
+}
+/**
+ * Determines if a connection's address matches a user provided list
+ * of domain wildcards.
+ */
+function hostMatchesWildcards(host, wildcards) {
+ for (const wildcard of wildcards) {
+ // Exact match always wins
+ if (host === wildcard) {
+ return true;
+ }
+ // Wildcard match with leading *.
+ if (wildcard.startsWith('*.')) {
+ const suffix = wildcard.substring(2);
+ // Exact match or strict subdomain match
+ if (host === suffix || host.endsWith(`.${suffix}`)) {
+ return true;
+ }
+ }
+ // Wildcard match with leading */
+ if (wildcard.startsWith('*/')) {
+ const suffix = wildcard.substring(2);
+ // Exact match or strict subpath match
+ if (host === suffix || host.endsWith(`/${suffix}`)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+/**
+ * Ensure Hint field is in a shape we expect:
+ * - object of index names mapping to 1 or -1
+ * - just an index name
+ * @internal
+ */
+function normalizeHintField(hint) {
+ let finalHint = undefined;
+ if (typeof hint === 'string') {
+ finalHint = hint;
+ }
+ else if (Array.isArray(hint)) {
+ finalHint = {};
+ hint.forEach(param => {
+ finalHint[param] = 1;
+ });
+ }
+ else if (hint != null && typeof hint === 'object') {
+ finalHint = {};
+ for (const name in hint) {
+ finalHint[name] = hint[name];
+ }
+ }
+ return finalHint;
+}
+const TO_STRING = (object) => Object.prototype.toString.call(object);
+/**
+ * Checks if arg is an Object:
+ * - **NOTE**: the check is based on the `[Symbol.toStringTag]() === 'Object'`
+ * @internal
+ */
+function isObject(arg) {
+ return '[object Object]' === TO_STRING(arg);
+}
+/** @internal */
+function mergeOptions(target, source) {
+ return { ...target, ...source };
+}
+/** @internal */
+function filterOptions(options, names) {
+ const filterOptions = {};
+ for (const name in options) {
+ if (names.includes(name)) {
+ filterOptions[name] = options[name];
+ }
+ }
+ // Filtered options
+ return filterOptions;
+}
+/**
+ * Applies a write concern to a command based on well defined inheritance rules, optionally
+ * detecting support for the write concern in the first place.
+ * @internal
+ *
+ * @param target - the target command we will be applying the write concern to
+ * @param sources - sources where we can inherit default write concerns from
+ * @param options - optional settings passed into a command for write concern overrides
+ */
+/**
+ * Checks if a given value is a Promise
+ *
+ * @typeParam T - The resolution type of the possible promise
+ * @param value - An object that could be a promise
+ * @returns true if the provided value is a Promise
+ */
+function isPromiseLike(value) {
+ return (value != null &&
+ typeof value === 'object' &&
+ 'then' in value &&
+ typeof value.then === 'function');
+}
+/**
+ * Applies collation to a given command.
+ * @internal
+ *
+ * @param command - the command on which to apply collation
+ * @param target - target of command
+ * @param options - options containing collation settings
+ */
+function decorateWithCollation(command, options) {
+ if (options.collation && typeof options.collation === 'object') {
+ command.collation = options.collation;
+ }
+}
+/**
+ * Applies a read concern to a given command.
+ * @internal
+ *
+ * @param command - the command on which to apply the read concern
+ * @param coll - the parent collection of the operation calling this method
+ */
+function decorateWithReadConcern(command, coll, options) {
+ if (options && options.session && options.session.inTransaction()) {
+ return;
+ }
+ const readConcern = Object.assign({}, command.readConcern || {});
+ if (coll.s.readConcern) {
+ Object.assign(readConcern, coll.s.readConcern);
+ }
+ if (Object.keys(readConcern).length > 0) {
+ Object.assign(command, { readConcern: readConcern });
+ }
+}
+/**
+ * A helper function to get the topology from a given provider. Throws
+ * if the topology cannot be found.
+ * @throws MongoNotConnectedError
+ * @internal
+ */
+function getTopology(provider) {
+ // MongoClient or ClientSession or AbstractCursor
+ if ('topology' in provider && provider.topology) {
+ return provider.topology;
+ }
+ else if ('client' in provider && provider.client.topology) {
+ return provider.client.topology;
+ }
+ throw new error_1.MongoNotConnectedError('MongoClient must be connected to perform this operation');
+}
+/** @internal */
+function ns(ns) {
+ return MongoDBNamespace.fromString(ns);
+}
+/** @public */
+class MongoDBNamespace {
+ /**
+ * Create a namespace object
+ *
+ * @param db - database name
+ * @param collection - collection name
+ */
+ constructor(db, collection) {
+ this.db = db;
+ this.collection = collection === '' ? undefined : collection;
+ }
+ toString() {
+ return this.collection ? `${this.db}.${this.collection}` : this.db;
+ }
+ withCollection(collection) {
+ return new MongoDBCollectionNamespace(this.db, collection);
+ }
+ static fromString(namespace) {
+ if (typeof namespace !== 'string' || namespace === '') {
+ // TODO(NODE-3483): Replace with MongoNamespaceError
+ throw new error_1.MongoRuntimeError(`Cannot parse namespace from "${namespace}"`);
+ }
+ const [db, ...collectionParts] = namespace.split('.');
+ const collection = collectionParts.join('.');
+ return new MongoDBNamespace(db, collection === '' ? undefined : collection);
+ }
+}
+exports.MongoDBNamespace = MongoDBNamespace;
+/**
+ * @public
+ *
+ * A class representing a collection's namespace. This class enforces (through Typescript) that
+ * the `collection` portion of the namespace is defined and should only be
+ * used in scenarios where this can be guaranteed.
+ */
+class MongoDBCollectionNamespace extends MongoDBNamespace {
+ constructor(db, collection) {
+ super(db, collection);
+ this.collection = collection;
+ }
+ static fromString(namespace) {
+ return super.fromString(namespace);
+ }
+}
+exports.MongoDBCollectionNamespace = MongoDBCollectionNamespace;
+/** @internal */
+function* makeCounter(seed = 0) {
+ let count = seed;
+ while (true) {
+ const newCount = count;
+ count += 1;
+ yield newCount;
+ }
+}
+/**
+ * Synchronously Generate a UUIDv4
+ * @internal
+ */
+function uuidV4() {
+ const result = crypto.getRandomValues(new Uint8Array(16));
+ result[6] = (result[6] & 0x0f) | 0x40;
+ result[8] = (result[8] & 0x3f) | 0x80;
+ return result;
+}
+/**
+ * A helper function for determining `maxWireVersion` between legacy and new topology instances
+ * @internal
+ */
+function maxWireVersion(handshakeAware) {
+ if (handshakeAware) {
+ if (handshakeAware.hello) {
+ return handshakeAware.hello.maxWireVersion;
+ }
+ if (handshakeAware.serverApi?.version) {
+ // We return the max supported wire version for serverAPI.
+ return constants_1.MAX_SUPPORTED_WIRE_VERSION;
+ }
+ // This is the fallback case for load balanced mode. If we are building commands the
+ // object being checked will be a connection, and we will have a hello response on
+ // it. For other cases, such as retryable writes, the object will be a server or
+ // topology, and there will be no hello response on those objects, so we return
+ // the max wire version so we support retryability. Once we have a min supported
+ // wire version of 9, then the needsRetryableWriteLabel() check can remove the
+ // usage of passing the wire version into it.
+ if (handshakeAware.loadBalanced) {
+ return constants_1.MAX_SUPPORTED_WIRE_VERSION;
+ }
+ if ('lastHello' in handshakeAware && typeof handshakeAware.lastHello === 'function') {
+ const lastHello = handshakeAware.lastHello();
+ if (lastHello) {
+ return lastHello.maxWireVersion;
+ }
+ }
+ if (handshakeAware.description &&
+ 'maxWireVersion' in handshakeAware.description &&
+ handshakeAware.description.maxWireVersion != null) {
+ return handshakeAware.description.maxWireVersion;
+ }
+ }
+ return 0;
+}
+/** @internal */
+function arrayStrictEqual(arr, arr2) {
+ if (!Array.isArray(arr) || !Array.isArray(arr2)) {
+ return false;
+ }
+ return arr.length === arr2.length && arr.every((elt, idx) => elt === arr2[idx]);
+}
+/** @internal */
+function errorStrictEqual(lhs, rhs) {
+ if (lhs === rhs) {
+ return true;
+ }
+ if (!lhs || !rhs) {
+ return lhs === rhs;
+ }
+ if ((lhs == null && rhs != null) || (lhs != null && rhs == null)) {
+ return false;
+ }
+ if (lhs.constructor.name !== rhs.constructor.name) {
+ return false;
+ }
+ if (lhs.message !== rhs.message) {
+ return false;
+ }
+ return true;
+}
+/** @internal */
+function makeStateMachine(stateTable) {
+ return function stateTransition(target, newState) {
+ const legalStates = stateTable[target.s.state];
+ if (legalStates && legalStates.indexOf(newState) < 0) {
+ throw new error_1.MongoRuntimeError(`illegal state transition from [${target.s.state}] => [${newState}], allowed: [${legalStates}]`);
+ }
+ target.emit('stateChanged', target.s.state, newState);
+ target.s.state = newState;
+ };
+}
+/**
+ * This function returns the number of milliseconds since an arbitrary point in time.
+ * This function should only be used to measure time intervals.
+ * @internal
+ * */
+function processTimeMS() {
+ return Math.floor(performance.now());
+}
+/** @internal */
+function calculateDurationInMs(started) {
+ if (typeof started !== 'number') {
+ return -1;
+ }
+ const elapsed = processTimeMS() - started;
+ return elapsed < 0 ? 0 : elapsed;
+}
+/** @internal */
+function hasAtomicOperators(doc, options) {
+ if (Array.isArray(doc)) {
+ for (const document of doc) {
+ if (hasAtomicOperators(document)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ const keys = Object.keys(doc);
+ // In this case we need to throw if all the atomic operators are undefined.
+ if (options?.ignoreUndefined) {
+ let allUndefined = true;
+ for (const key of keys) {
+ // eslint-disable-next-line no-restricted-syntax
+ if (doc[key] !== undefined) {
+ allUndefined = false;
+ break;
+ }
+ }
+ if (allUndefined) {
+ throw new error_1.MongoInvalidArgumentError('Update operations require that all atomic operators have defined values, but none were provided.');
+ }
+ }
+ return keys.length > 0 && keys[0][0] === '$';
+}
+function resolveTimeoutOptions(client, options) {
+ const { socketTimeoutMS, serverSelectionTimeoutMS, waitQueueTimeoutMS, timeoutMS } = client.s.options;
+ return { socketTimeoutMS, serverSelectionTimeoutMS, waitQueueTimeoutMS, timeoutMS, ...options };
+}
+/**
+ * Merge inherited properties from parent into options, prioritizing values from options,
+ * then values from parent.
+ *
+ * @param parent - An optional owning class of the operation being run. ex. Db/Collection/MongoClient.
+ * @param options - The options passed to the operation method.
+ *
+ * @internal
+ */
+function resolveOptions(parent, options) {
+ const result = Object.assign({}, options, (0, bson_1.resolveBSONOptions)(options, parent));
+ const timeoutMS = options?.timeoutMS ?? parent?.timeoutMS;
+ // Users cannot pass a readConcern/writeConcern to operations in a transaction
+ const session = options?.session;
+ if (!session?.inTransaction()) {
+ const readConcern = read_concern_1.ReadConcern.fromOptions(options) ?? parent?.readConcern;
+ if (readConcern) {
+ result.readConcern = readConcern;
+ }
+ let writeConcern = write_concern_1.WriteConcern.fromOptions(options) ?? parent?.writeConcern;
+ if (writeConcern) {
+ if (timeoutMS != null) {
+ writeConcern = write_concern_1.WriteConcern.fromOptions({
+ writeConcern: {
+ ...writeConcern,
+ wtimeout: undefined,
+ wtimeoutMS: undefined
+ }
+ });
+ }
+ result.writeConcern = writeConcern;
+ }
+ }
+ result.timeoutMS = timeoutMS;
+ const readPreference = read_preference_1.ReadPreference.fromOptions(options) ?? parent?.readPreference;
+ if (readPreference) {
+ result.readPreference = readPreference;
+ }
+ const isConvenientTransaction = session?.explicit && session?.timeoutContext != null;
+ if (isConvenientTransaction && options?.timeoutMS != null) {
+ throw new error_1.MongoInvalidArgumentError('An operation cannot be given a timeoutMS setting when inside a withTransaction call that has a timeoutMS setting');
+ }
+ return result;
+}
+function isSuperset(set, subset) {
+ set = Array.isArray(set) ? new Set(set) : set;
+ subset = Array.isArray(subset) ? new Set(subset) : subset;
+ for (const elem of subset) {
+ if (!set.has(elem)) {
+ return false;
+ }
+ }
+ return true;
+}
+/**
+ * Checks if the document is a Hello request
+ * @internal
+ */
+function isHello(doc) {
+ return doc[constants_2.LEGACY_HELLO_COMMAND] || doc.hello ? true : false;
+}
+/** Returns the items that are uniquely in setA */
+function setDifference(setA, setB) {
+ const difference = new Set(setA);
+ for (const elem of setB) {
+ difference.delete(elem);
+ }
+ return difference;
+}
+const HAS_OWN = (object, prop) => Object.prototype.hasOwnProperty.call(object, prop);
+function isRecord(value, requiredKeys = undefined) {
+ if (!isObject(value)) {
+ return false;
+ }
+ const ctor = value.constructor;
+ if (ctor && ctor.prototype) {
+ if (!isObject(ctor.prototype)) {
+ return false;
+ }
+ // Check to see if some method exists from the Object exists
+ if (!HAS_OWN(ctor.prototype, 'isPrototypeOf')) {
+ return false;
+ }
+ }
+ if (requiredKeys) {
+ const keys = Object.keys(value);
+ return isSuperset(keys, requiredKeys);
+ }
+ return true;
+}
+/**
+ * A sequential list of items in a circularly linked list
+ * @remarks
+ * The head node is special, it is always defined and has a value of null.
+ * It is never "included" in the list, in that, it is not returned by pop/shift or yielded by the iterator.
+ * The circular linkage and always defined head node are to reduce checks for null next/prev references to zero.
+ * New nodes are declared as object literals with keys always in the same order: next, prev, value.
+ * @internal
+ */
+class List {
+ get length() {
+ return this.count;
+ }
+ get [Symbol.toStringTag]() {
+ return 'List';
+ }
+ constructor() {
+ this.count = 0;
+ // this is carefully crafted:
+ // declaring a complete and consistently key ordered
+ // object is beneficial to the runtime optimizations
+ this.head = {
+ next: null,
+ prev: null,
+ value: null
+ };
+ this.head.next = this.head;
+ this.head.prev = this.head;
+ }
+ toArray() {
+ return Array.from(this);
+ }
+ toString() {
+ return `head <=> ${this.toArray().join(' <=> ')} <=> head`;
+ }
+ *[Symbol.iterator]() {
+ for (const node of this.nodes()) {
+ yield node.value;
+ }
+ }
+ *nodes() {
+ let ptr = this.head.next;
+ while (ptr !== this.head) {
+ // Save next before yielding so that we make removing within iteration safe
+ const { next } = ptr;
+ yield ptr;
+ ptr = next;
+ }
+ }
+ /** Insert at end of list */
+ push(value) {
+ this.count += 1;
+ const newNode = {
+ next: this.head,
+ prev: this.head.prev,
+ value
+ };
+ this.head.prev.next = newNode;
+ this.head.prev = newNode;
+ }
+ /** Inserts every item inside an iterable instead of the iterable itself */
+ pushMany(iterable) {
+ for (const value of iterable) {
+ this.push(value);
+ }
+ }
+ /** Insert at front of list */
+ unshift(value) {
+ this.count += 1;
+ const newNode = {
+ next: this.head.next,
+ prev: this.head,
+ value
+ };
+ this.head.next.prev = newNode;
+ this.head.next = newNode;
+ }
+ remove(node) {
+ if (node === this.head || this.length === 0) {
+ return null;
+ }
+ this.count -= 1;
+ const prevNode = node.prev;
+ const nextNode = node.next;
+ prevNode.next = nextNode;
+ nextNode.prev = prevNode;
+ return node.value;
+ }
+ /** Removes the first node at the front of the list */
+ shift() {
+ return this.remove(this.head.next);
+ }
+ /** Removes the last node at the end of the list */
+ pop() {
+ return this.remove(this.head.prev);
+ }
+ /** Iterates through the list and removes nodes where filter returns true */
+ prune(filter) {
+ for (const node of this.nodes()) {
+ if (filter(node.value)) {
+ this.remove(node);
+ }
+ }
+ }
+ clear() {
+ this.count = 0;
+ this.head.next = this.head;
+ this.head.prev = this.head;
+ }
+ /** Returns the first item in the list, does not remove */
+ first() {
+ // If the list is empty, value will be the head's null
+ return this.head.next.value;
+ }
+ /** Returns the last item in the list, does not remove */
+ last() {
+ // If the list is empty, value will be the head's null
+ return this.head.prev.value;
+ }
+}
+exports.List = List;
+/**
+ * A pool of Buffers which allow you to read them as if they were one
+ * @internal
+ */
+class BufferPool {
+ constructor() {
+ this.buffers = new List();
+ this.totalByteLength = 0;
+ }
+ get length() {
+ return this.totalByteLength;
+ }
+ /** Adds a buffer to the internal buffer pool list */
+ append(buffer) {
+ this.buffers.push(buffer);
+ this.totalByteLength += buffer.length;
+ }
+ /**
+ * If BufferPool contains 4 bytes or more construct an int32 from the leading bytes,
+ * otherwise return null. Size can be negative, caller should error check.
+ */
+ getInt32() {
+ if (this.totalByteLength < 4) {
+ return null;
+ }
+ const firstBuffer = this.buffers.first();
+ if (firstBuffer != null && firstBuffer.byteLength >= 4) {
+ return bson_1.NumberUtils.getInt32LE(firstBuffer, 0);
+ }
+ // Unlikely case: an int32 is split across buffers.
+ // Use read and put the returned buffer back on top
+ const top4Bytes = this.read(4);
+ const value = bson_1.NumberUtils.getInt32LE(top4Bytes, 0);
+ // Put it back.
+ this.totalByteLength += 4;
+ this.buffers.unshift(top4Bytes);
+ return value;
+ }
+ /** Reads the requested number of bytes, optionally consuming them */
+ read(size) {
+ if (typeof size !== 'number' || size < 0) {
+ throw new error_1.MongoInvalidArgumentError('Argument "size" must be a non-negative number');
+ }
+ // oversized request returns empty buffer
+ if (size > this.totalByteLength) {
+ return bson_1.ByteUtils.allocate(0);
+ }
+ // We know we have enough, we just don't know how it is spread across chunks
+ // TODO(NODE-4732): alloc API should change based on raw option
+ const result = bson_1.ByteUtils.allocateUnsafe(size);
+ for (let bytesRead = 0; bytesRead < size;) {
+ const buffer = this.buffers.shift();
+ if (buffer == null) {
+ break;
+ }
+ const bytesRemaining = size - bytesRead;
+ const bytesReadable = Math.min(bytesRemaining, buffer.byteLength);
+ const bytes = buffer.subarray(0, bytesReadable);
+ result.set(bytes, bytesRead);
+ bytesRead += bytesReadable;
+ this.totalByteLength -= bytesReadable;
+ if (bytesReadable < buffer.byteLength) {
+ this.buffers.unshift(buffer.subarray(bytesReadable));
+ }
+ }
+ return result;
+ }
+}
+exports.BufferPool = BufferPool;
+/** @public */
+class HostAddress {
+ constructor(hostString) {
+ this.host = undefined;
+ this.port = undefined;
+ this.socketPath = undefined;
+ this.isIPv6 = false;
+ const escapedHost = hostString.split(' ').join('%20'); // escape spaces, for socket path hosts
+ if (escapedHost.endsWith('.sock')) {
+ // heuristically determine if we're working with a domain socket
+ this.socketPath = decodeURIComponent(escapedHost);
+ return;
+ }
+ const urlString = `iLoveJS://${escapedHost}`;
+ let url;
+ try {
+ url = new URL(urlString);
+ }
+ catch (urlError) {
+ const runtimeError = new error_1.MongoRuntimeError(`Unable to parse ${escapedHost} with URL`);
+ runtimeError.cause = urlError;
+ throw runtimeError;
+ }
+ const hostname = url.hostname;
+ const port = url.port;
+ let normalized = decodeURIComponent(hostname).toLowerCase();
+ if (normalized.startsWith('[') && normalized.endsWith(']')) {
+ this.isIPv6 = true;
+ normalized = normalized.substring(1, hostname.length - 1);
+ }
+ this.host = normalized.toLowerCase();
+ if (typeof port === 'number') {
+ this.port = port;
+ }
+ else if (typeof port === 'string' && port !== '') {
+ this.port = Number.parseInt(port, 10);
+ }
+ else {
+ this.port = 27017;
+ }
+ if (this.port === 0) {
+ throw new error_1.MongoParseError('Invalid port (zero) with hostname');
+ }
+ Object.freeze(this);
+ }
+ [Symbol.for('nodejs.util.inspect.custom')]() {
+ return this.inspect();
+ }
+ inspect() {
+ return `new HostAddress('${this.toString()}')`;
+ }
+ toString() {
+ if (typeof this.host === 'string') {
+ if (this.isIPv6) {
+ return `[${this.host}]:${this.port}`;
+ }
+ return `${this.host}:${this.port}`;
+ }
+ return `${this.socketPath}`;
+ }
+ static fromString(s) {
+ return new HostAddress(s);
+ }
+ static fromHostPort(host, port) {
+ if (host.includes(':')) {
+ host = `[${host}]`; // IPv6 address
+ }
+ return HostAddress.fromString(`${host}:${port}`);
+ }
+ static fromSrvRecord({ name, port }) {
+ return HostAddress.fromHostPort(name, port);
+ }
+ toHostPort() {
+ if (this.socketPath) {
+ return { host: this.socketPath, port: 0 };
+ }
+ const host = this.host ?? '';
+ const port = this.port ?? 0;
+ return { host, port };
+ }
+}
+exports.HostAddress = HostAddress;
+exports.DEFAULT_PK_FACTORY = {
+ // We prefer not to rely on ObjectId having a createPk method
+ createPk() {
+ return new bson_1.ObjectId();
+ }
+};
+/**
+ * When the driver used emitWarning the code will be equal to this.
+ * @public
+ *
+ * @example
+ * ```ts
+ * process.on('warning', (warning) => {
+ * if (warning.code === MONGODB_WARNING_CODE) console.error('Ah an important warning! :)')
+ * })
+ * ```
+ */
+exports.MONGODB_WARNING_CODE = 'MONGODB DRIVER';
+/** @internal */
+function emitWarning(message) {
+ return process.emitWarning(message, { code: exports.MONGODB_WARNING_CODE });
+}
+const emittedWarnings = new Set();
+/**
+ * Will emit a warning once for the duration of the application.
+ * Uses the message to identify if it has already been emitted
+ * so using string interpolation can cause multiple emits
+ * @internal
+ */
+function emitWarningOnce(message) {
+ if (!emittedWarnings.has(message)) {
+ emittedWarnings.add(message);
+ return emitWarning(message);
+ }
+}
+/**
+ * Takes a JS object and joins the values into a string separated by ', '
+ */
+function enumToString(en) {
+ return Object.values(en).join(', ');
+}
+/**
+ * Determine if a server supports retryable writes.
+ *
+ * @internal
+ */
+function supportsRetryableWrites(server) {
+ if (!server) {
+ return false;
+ }
+ if (server.loadBalanced) {
+ // Loadbalanced topologies will always support retry writes
+ return true;
+ }
+ if (server.description.logicalSessionTimeoutMinutes != null) {
+ // that supports sessions
+ if (server.description.type !== common_1.ServerType.Standalone) {
+ // and that is not a standalone
+ return true;
+ }
+ }
+ return false;
+}
+/**
+ * Fisher–Yates Shuffle
+ *
+ * Reference: https://bost.ocks.org/mike/shuffle/
+ * @param sequence - items to be shuffled
+ * @param limit - Defaults to `0`. If nonzero shuffle will slice the randomized array e.g, `.slice(0, limit)` otherwise will return the entire randomized array.
+ */
+function shuffle(sequence, limit = 0) {
+ const items = Array.from(sequence); // shallow copy in order to never shuffle the input
+ if (limit > items.length) {
+ throw new error_1.MongoRuntimeError('Limit must be less than the number of items');
+ }
+ let remainingItemsToShuffle = items.length;
+ const lowerBound = limit % items.length === 0 ? 1 : items.length - limit;
+ while (remainingItemsToShuffle > lowerBound) {
+ // Pick a remaining element
+ const randomIndex = Math.floor(Math.random() * remainingItemsToShuffle);
+ remainingItemsToShuffle -= 1;
+ // And swap it with the current element
+ const swapHold = items[remainingItemsToShuffle];
+ items[remainingItemsToShuffle] = items[randomIndex];
+ items[randomIndex] = swapHold;
+ }
+ return limit % items.length === 0 ? items : items.slice(lowerBound);
+}
+/**
+ * TODO(NODE-4936): read concern eligibility for commands should be codified in command construction
+ * @internal
+ * @see https://github.com/mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.md#read-concern
+ */
+function commandSupportsReadConcern(command) {
+ if (command.aggregate || command.count || command.distinct || command.find || command.geoNear) {
+ return true;
+ }
+ return false;
+}
+/**
+ * Compare objectIds. `null` is always less
+ * - `+1 = oid1 is greater than oid2`
+ * - `-1 = oid1 is less than oid2`
+ * - `+0 = oid1 is equal oid2`
+ */
+function compareObjectId(oid1, oid2) {
+ if (oid1 == null && oid2 == null) {
+ return 0;
+ }
+ if (oid1 == null) {
+ return -1;
+ }
+ if (oid2 == null) {
+ return 1;
+ }
+ return bson_1.ByteUtils.compare(oid1.id, oid2.id);
+}
+function parseInteger(value) {
+ if (typeof value === 'number')
+ return Math.trunc(value);
+ const parsedValue = Number.parseInt(String(value), 10);
+ return Number.isNaN(parsedValue) ? null : parsedValue;
+}
+function parseUnsignedInteger(value) {
+ const parsedInt = parseInteger(value);
+ return parsedInt != null && parsedInt >= 0 ? parsedInt : null;
+}
+/**
+ * This function throws a MongoAPIError in the event that either of the following is true:
+ * * If the provided address domain does not match the provided parent domain
+ * * If the parent domain contains less than three `.` separated parts and the provided address does not contain at least one more domain level than its parent
+ *
+ * If a DNS server were to become compromised SRV records would still need to
+ * advertise addresses that are under the same domain as the srvHost.
+ *
+ * @param address - The address to check against a domain
+ * @param srvHost - The domain to check the provided address against
+ * @returns void
+ */
+function checkParentDomainMatch(address, srvHost) {
+ // Remove trailing dot if exists on either the resolved address or the srv hostname
+ const normalizedAddress = address.endsWith('.') ? address.slice(0, address.length - 1) : address;
+ const normalizedSrvHost = srvHost.endsWith('.') ? srvHost.slice(0, srvHost.length - 1) : srvHost;
+ const allCharacterBeforeFirstDot = /^.*?\./;
+ const srvIsLessThanThreeParts = normalizedSrvHost.split('.').length < 3;
+ // Remove all characters before first dot
+ // Add leading dot back to string so
+ // an srvHostDomain = '.trusted.site'
+ // will not satisfy an addressDomain that endsWith '.fake-trusted.site'
+ const addressDomain = `.${normalizedAddress.replace(allCharacterBeforeFirstDot, '')}`;
+ let srvHostDomain = srvIsLessThanThreeParts
+ ? normalizedSrvHost
+ : `.${normalizedSrvHost.replace(allCharacterBeforeFirstDot, '')}`;
+ if (!srvHostDomain.startsWith('.')) {
+ srvHostDomain = '.' + srvHostDomain;
+ }
+ if (srvIsLessThanThreeParts &&
+ normalizedAddress.split('.').length <= normalizedSrvHost.split('.').length) {
+ throw new error_1.MongoAPIError('Server record does not have at least one more domain level than parent URI');
+ }
+ if (!addressDomain.endsWith(srvHostDomain)) {
+ throw new error_1.MongoAPIError('Server record does not share hostname with parent URI');
+ }
+}
+/**
+ * Perform a get request that returns status and body.
+ * @internal
+ */
+function get(url, options = {}) {
+ return new Promise((resolve, reject) => {
+ /* eslint-disable prefer-const */
+ let timeoutId;
+ const request = http
+ .get(url, options, response => {
+ response.setEncoding('utf8');
+ let body = '';
+ response.on('data', chunk => (body += chunk));
+ response.on('end', () => {
+ (0, timers_1.clearTimeout)(timeoutId);
+ resolve({ status: response.statusCode, body });
+ });
+ })
+ .on('error', error => {
+ (0, timers_1.clearTimeout)(timeoutId);
+ reject(error);
+ })
+ .end();
+ timeoutId = (0, timers_1.setTimeout)(() => {
+ request.destroy(new error_1.MongoNetworkTimeoutError(`request timed out after 10 seconds`));
+ }, 10000);
+ });
+}
+/** @internal */
+exports.DOCUMENT_DB_CHECK = /(\.docdb\.amazonaws\.com$)|(\.docdb-elastic\.amazonaws\.com$)/;
+/** @internal */
+exports.COSMOS_DB_CHECK = /\.cosmos\.azure\.com$/;
+/** @internal */
+exports.DOCUMENT_DB_MSG = 'You appear to be connected to a DocumentDB cluster. For more information regarding feature compatibility and support please visit https://www.mongodb.com/supportability/documentdb';
+/** @internal */
+exports.COSMOS_DB_MSG = 'You appear to be connected to a CosmosDB cluster. For more information regarding feature compatibility and support please visit https://www.mongodb.com/supportability/cosmosdb';
+/** @internal */
+function isHostMatch(match, host) {
+ return host && match.test(host.toLowerCase()) ? true : false;
+}
+function promiseWithResolvers() {
+ let resolve;
+ let reject;
+ const promise = new Promise(function withResolversExecutor(promiseResolve, promiseReject) {
+ resolve = promiseResolve;
+ reject = promiseReject;
+ });
+ return { promise, resolve, reject };
+}
+/**
+ * A noop function intended for use in preventing unhandled rejections.
+ *
+ * @example
+ * ```js
+ * const promise = myAsyncTask();
+ * // eslint-disable-next-line github/no-then
+ * promise.then(undefined, squashError);
+ * ```
+ */
+function squashError(_error) {
+ return;
+}
+const randomBytes = (size) => {
+ return Promise.resolve(crypto.getRandomValues(new Uint8Array(size)));
+};
+exports.randomBytes = randomBytes;
+/**
+ * Replicates the events.once helper.
+ *
+ * Removes unused signal logic and It **only** supports 0 or 1 argument events.
+ *
+ * @param ee - An event emitter that may emit `ev`
+ * @param name - An event name to wait for
+ */
+async function once(ee, name, options) {
+ options?.signal?.throwIfAborted();
+ const { promise, resolve, reject } = promiseWithResolvers();
+ const onEvent = (data) => resolve(data);
+ const onError = (error) => reject(error);
+ const abortListener = addAbortListener(options?.signal, function () {
+ reject(this.reason);
+ });
+ ee.once(name, onEvent).once('error', onError);
+ try {
+ return await promise;
+ }
+ finally {
+ ee.off(name, onEvent);
+ ee.off('error', onError);
+ abortListener?.[exports.kDispose]();
+ }
+}
+function maybeAddIdToDocuments(collection, document, options) {
+ const forceServerObjectId = options.forceServerObjectId ?? collection.db.options?.forceServerObjectId ?? false;
+ // no need to modify the docs if server sets the ObjectId
+ if (forceServerObjectId) {
+ return document;
+ }
+ if (document._id == null) {
+ document._id = collection.s.pkFactory.createPk();
+ }
+ return document;
+}
+async function fileIsAccessible(fileName, mode) {
+ try {
+ await fs_1.promises.access(fileName, mode);
+ return true;
+ }
+ catch {
+ return false;
+ }
+}
+function csotMin(duration1, duration2) {
+ if (duration1 === 0)
+ return duration2;
+ if (duration2 === 0)
+ return duration1;
+ return Math.min(duration1, duration2);
+}
+function noop() {
+ return;
+}
+/**
+ * Recurse through the (identically-shaped) `decrypted` and `original`
+ * objects and attach a `decryptedKeys` property on each sub-object that
+ * contained encrypted fields. Because we only call this on BSON responses,
+ * we do not need to worry about circular references.
+ *
+ * @internal
+ */
+function decorateDecryptionResult(decrypted, original, isTopLevelDecorateCall = true) {
+ if (isTopLevelDecorateCall) {
+ // The original value could have been either a JS object or a BSON buffer
+ if (bson_1.ByteUtils.isUint8Array(original)) {
+ original = (0, bson_1.deserialize)(original);
+ }
+ if (bson_1.ByteUtils.isUint8Array(decrypted)) {
+ throw new error_1.MongoRuntimeError('Expected result of decryption to be deserialized BSON object');
+ }
+ }
+ if (!decrypted || typeof decrypted !== 'object')
+ return;
+ for (const k of Object.keys(decrypted)) {
+ const originalValue = original[k];
+ // An object was decrypted by libmongocrypt if and only if it was
+ // a BSON Binary object with subtype 6.
+ if (originalValue && originalValue._bsontype === 'Binary' && originalValue.sub_type === 6) {
+ if (!decrypted[constants_2.kDecoratedKeys]) {
+ Object.defineProperty(decrypted, constants_2.kDecoratedKeys, {
+ value: [],
+ configurable: true,
+ enumerable: false,
+ writable: false
+ });
+ }
+ // this is defined in the preceding if-statement
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ decrypted[constants_2.kDecoratedKeys].push(k);
+ // Do not recurse into this decrypted value. It could be a sub-document/array,
+ // in which case there is no original value associated with its subfields.
+ continue;
+ }
+ decorateDecryptionResult(decrypted[k], originalValue, false);
+ }
+}
+/** @internal */
+exports.kDispose = Symbol.dispose ?? Symbol('dispose');
+/**
+ * A utility that helps with writing listener code idiomatically
+ *
+ * @example
+ * ```js
+ * using listener = addAbortListener(signal, function () {
+ * console.log('aborted', this.reason);
+ * });
+ * ```
+ *
+ * @param signal - if exists adds an abort listener
+ * @param listener - the listener to be added to signal
+ * @returns A disposable that will remove the abort listener
+ */
+function addAbortListener(signal, listener) {
+ if (signal == null)
+ return;
+ signal.addEventListener('abort', listener, { once: true });
+ return { [exports.kDispose]: () => signal.removeEventListener('abort', listener) };
+}
+/**
+ * Takes a promise and races it with a promise wrapping the abort event of the optionally provided signal.
+ * The given promise is _always_ ordered before the signal's abort promise.
+ * When given an already rejected promise and an already aborted signal, the promise's rejection takes precedence.
+ *
+ * Any asynchronous processing in `promise` will continue even after the abort signal has fired,
+ * but control will be returned to the caller
+ *
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/race
+ *
+ * @param promise - A promise to discard if the signal aborts
+ * @param options - An options object carrying an optional signal
+ */
+async function abortable(promise, { signal }) {
+ if (signal == null) {
+ return await promise;
+ }
+ const { promise: aborted, reject } = promiseWithResolvers();
+ const abortListener = signal.aborted
+ ? reject(signal.reason)
+ : addAbortListener(signal, function () {
+ reject(this.reason);
+ });
+ try {
+ return await Promise.race([promise, aborted]);
+ }
+ finally {
+ abortListener?.[exports.kDispose]();
+ }
+}
+//# sourceMappingURL=utils.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/utils.js.map b/node_modules/mongodb/lib/utils.js.map
new file mode 100644
index 00000000..66f2f62c
--- /dev/null
+++ b/node_modules/mongodb/lib/utils.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAwDA,oCAOC;AAMD,oDAyBC;AAQD,gDAmBC;AASD,4BAEC;AAGD,oCAEC;AAGD,sCAWC;AAmBD,sCAOC;AAUD,sDAIC;AASD,0DAgBC;AAmBD,kCASC;AAGD,gBAEC;AA0DD,kCAOC;AAMD,wBAKC;AAMD,wCAsCC;AAGD,4CA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AAM,EAA4B;IAEpC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,MAAM,OAAO,CAAC;IACvB,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,oBAAoB,EAAS,CAAC;IAEnE,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO;QAClC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACvB,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE;YACvB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;IAEP,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,CAAC;YAAS,CAAC;QACT,aAAa,EAAE,CAAC,gBAAQ,CAAC,EAAE,CAAC;IAC9B,CAAC;AACH,CAAC"}
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/write_concern.js b/node_modules/mongodb/lib/write_concern.js
new file mode 100644
index 00000000..9499c4e0
--- /dev/null
+++ b/node_modules/mongodb/lib/write_concern.js
@@ -0,0 +1,100 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.WriteConcern = exports.WRITE_CONCERN_KEYS = void 0;
+exports.throwIfWriteConcernError = throwIfWriteConcernError;
+const responses_1 = require("./cmap/wire_protocol/responses");
+const error_1 = require("./error");
+exports.WRITE_CONCERN_KEYS = ['w', 'wtimeout', 'j', 'journal', 'fsync'];
+/**
+ * A MongoDB WriteConcern, which describes the level of acknowledgement
+ * requested from MongoDB for write operations.
+ * @public
+ *
+ * @see https://www.mongodb.com/docs/manual/reference/write-concern/
+ */
+class WriteConcern {
+ /**
+ * Constructs a WriteConcern from the write concern properties.
+ * @param w - request acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags.
+ * @param wtimeoutMS - specify a time limit to prevent write operations from blocking indefinitely
+ * @param journal - request acknowledgment that the write operation has been written to the on-disk journal
+ * @param fsync - equivalent to the j option. Is deprecated and will be removed in the next major version.
+ */
+ constructor(w, wtimeoutMS, journal, fsync) {
+ if (w != null) {
+ if (!Number.isNaN(Number(w))) {
+ this.w = Number(w);
+ }
+ else {
+ this.w = w;
+ }
+ }
+ if (wtimeoutMS != null) {
+ this.wtimeoutMS = this.wtimeout = wtimeoutMS;
+ }
+ if (journal != null) {
+ this.journal = this.j = journal;
+ }
+ if (fsync != null) {
+ this.journal = this.j = fsync ? true : false;
+ }
+ }
+ /**
+ * Apply a write concern to a command document. Will modify and return the command.
+ */
+ static apply(command, writeConcern) {
+ const wc = {};
+ // The write concern document sent to the server has w/wtimeout/j fields.
+ if (writeConcern.w != null)
+ wc.w = writeConcern.w;
+ if (writeConcern.wtimeoutMS != null)
+ wc.wtimeout = writeConcern.wtimeoutMS;
+ if (writeConcern.journal != null)
+ wc.j = writeConcern.j;
+ command.writeConcern = wc;
+ return command;
+ }
+ /** Construct a WriteConcern given an options object. */
+ static fromOptions(options, inherit) {
+ if (options == null)
+ return undefined;
+ inherit = inherit ?? {};
+ let opts;
+ if (typeof options === 'string' || typeof options === 'number') {
+ opts = { w: options };
+ }
+ else if (options instanceof WriteConcern) {
+ opts = options;
+ }
+ else {
+ opts = options.writeConcern;
+ }
+ const parentOpts = inherit instanceof WriteConcern ? inherit : inherit.writeConcern;
+ const mergedOpts = { ...parentOpts, ...opts };
+ const { w = undefined, wtimeout = undefined, j = undefined, fsync = undefined, journal = undefined, wtimeoutMS = undefined } = mergedOpts;
+ if (w != null ||
+ wtimeout != null ||
+ wtimeoutMS != null ||
+ j != null ||
+ journal != null ||
+ fsync != null) {
+ return new WriteConcern(w, wtimeout ?? wtimeoutMS, j ?? journal, fsync);
+ }
+ return undefined;
+ }
+}
+exports.WriteConcern = WriteConcern;
+/** Called with either a plain object or MongoDBResponse */
+function throwIfWriteConcernError(response) {
+ if (typeof response === 'object' && response != null) {
+ const writeConcernError = responses_1.MongoDBResponse.is(response) && response.has('writeConcernError')
+ ? response.toObject()
+ : !responses_1.MongoDBResponse.is(response) && 'writeConcernError' in response
+ ? response
+ : null;
+ if (writeConcernError != null) {
+ throw new error_1.MongoWriteConcernError(writeConcernError);
+ }
+ }
+}
+//# sourceMappingURL=write_concern.js.map
\ No newline at end of file
diff --git a/node_modules/mongodb/lib/write_concern.js.map b/node_modules/mongodb/lib/write_concern.js.map
new file mode 100644
index 00000000..4666cec3
--- /dev/null
+++ b/node_modules/mongodb/lib/write_concern.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"write_concern.js","sourceRoot":"","sources":["../src/write_concern.ts"],"names":[],"mappings":";;;AAyKA,4DAaC;AArLD,8DAAiE;AACjE,mCAAiD;AAuCpC,QAAA,kBAAkB,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAY7E;;;;;;GAMG;AACH,MAAa,YAAY;IA4BvB;;;;;;OAMG;IACH,YAAY,CAAK,EAAE,UAAmB,EAAE,OAAiB,EAAE,KAAmB;QAC5E,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7B,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACb,CAAC;QACH,CAAC;QACD,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC;QAC/C,CAAC;QACD,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC;QAClC,CAAC;QACD,IAAI,KAAK,IAAI,IAAI,EAAE,CAA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
--- /dev/null
+++ b/node_modules/mongodb/mongodb.d.ts
@@ -0,0 +1,9061 @@
+import type { DeserializeOptions } from 'bson';
+import type { ObjectIdLike } from 'bson';
+import type { SerializeOptions } from 'bson';
+import { Binary } from 'bson';
+import { BSON } from 'bson';
+import { BSONRegExp } from 'bson';
+import { BSONSymbol } from 'bson';
+import { BSONType } from 'bson';
+import { Code } from 'bson';
+import { DBRef } from 'bson';
+import { Decimal128 } from 'bson';
+import { deserialize } from 'bson';
+import { Document } from 'bson';
+import { Double } from 'bson';
+import { Int32 } from 'bson';
+import { Long } from 'bson';
+import { MaxKey } from 'bson';
+import { MinKey } from 'bson';
+import { ObjectId } from 'bson';
+import { serialize } from 'bson';
+import { Timestamp } from 'bson';
+import { UUID } from 'bson';
+import type { SrvRecord } from 'dns';
+import { EventEmitter } from 'events';
+import type { Socket } from 'net';
+import type { TcpNetConnectOpts } from 'net';
+import type * as os from 'os';
+import { Readable } from 'stream';
+import { Writable } from 'stream';
+import type { ConnectionOptions as ConnectionOptions_2 } from 'tls';
+import type { TLSSocket } from 'tls';
+import type { TLSSocketOptions } from 'tls';
+
+/** @public */
+export declare type Abortable = {
+ /**
+ * @experimental
+ * When provided, the corresponding `AbortController` can be used to abort an asynchronous action.
+ *
+ * The `signal.reason` value is used as the error thrown.
+ *
+ * @remarks
+ * **NOTE:** If an abort signal aborts an operation while the driver is writing to the underlying
+ * socket or reading the response from the server, the socket will be closed.
+ * If signals are aborted at a high rate during socket read/writes this can lead to a high rate of connection reestablishment.
+ *
+ * We plan to mitigate this in a future release, please follow NODE-6062 (`timeoutMS` expiration suffers the same limitation).
+ *
+ * AbortSignals are likely a best fit for human interactive interruption (ex. ctrl-C) where the frequency
+ * of cancellation is reasonably low. If a signal is programmatically aborted for 100s of operations you can empty
+ * the driver's connection pool.
+ *
+ * @example
+ * ```js
+ * const controller = new AbortController();
+ * const { signal } = controller;
+ * process.on('SIGINT', () => controller.abort(new Error('^C pressed')));
+ *
+ * try {
+ * const res = await fetch('...', { signal });
+ * await collection.findOne(await res.json(), { signal });
+ * catch (error) {
+ * if (error === signal.reason) {
+ * // signal abort error handling
+ * }
+ * }
+ * ```
+ */
+ signal?: AbortSignal | undefined;
+};
+
+/** @public */
+export declare abstract class AbstractCursor extends TypedEventEmitter implements AsyncDisposable {
+ /* Excluded from this release type: cursorId */
+ /* Excluded from this release type: cursorSession */
+ /* Excluded from this release type: selectedServer */
+ /* Excluded from this release type: cursorNamespace */
+ /* Excluded from this release type: documents */
+ /* Excluded from this release type: cursorClient */
+ /* Excluded from this release type: transform */
+ /* Excluded from this release type: initialized */
+ /* Excluded from this release type: isClosed */
+ /* Excluded from this release type: isKilled */
+ /* Excluded from this release type: cursorOptions */
+ /* Excluded from this release type: timeoutContext */
+ /** @event */
+ static readonly CLOSE: "close";
+ /* Excluded from this release type: deserializationOptions */
+ protected signal: AbortSignal | undefined;
+ private abortListener;
+ /* Excluded from this release type: __constructor */
+ /**
+ * The cursor has no id until it receives a response from the initial cursor creating command.
+ *
+ * It is non-zero for as long as the database has an open cursor.
+ *
+ * The initiating command may receive a zero id if the entire result is in the `firstBatch`.
+ */
+ get id(): Long | undefined;
+ /* Excluded from this release type: isDead */
+ /* Excluded from this release type: client */
+ /* Excluded from this release type: server */
+ get namespace(): MongoDBNamespace;
+ get readPreference(): ReadPreference;
+ get readConcern(): ReadConcern | undefined;
+ /* Excluded from this release type: session */
+ /* Excluded from this release type: session */
+ /**
+ * The cursor is closed and all remaining locally buffered documents have been iterated.
+ */
+ get closed(): boolean;
+ /**
+ * A `killCursors` command was attempted on this cursor.
+ * This is performed if the cursor id is non zero.
+ */
+ get killed(): boolean;
+ get loadBalanced(): boolean;
+ /**
+ * @experimental
+ * An alias for {@link AbstractCursor.close|AbstractCursor.close()}.
+ */
+ [Symbol.asyncDispose](): Promise;
+ /** Adds cursor to client's tracking so it will be closed by MongoClient.close() */
+ private trackCursor;
+ /** Returns current buffered documents length */
+ bufferedCount(): number;
+ /** Returns current buffered documents */
+ readBufferedDocuments(number?: number): NonNullable[];
+ [Symbol.asyncIterator](): AsyncGenerator;
+ stream(): Readable & AsyncIterable;
+ hasNext(): Promise;
+ /** Get the next available document from the cursor, returns null if no more documents are available. */
+ next(): Promise;
+ /**
+ * Try to get the next available document from the cursor or `null` if an empty batch is returned
+ */
+ tryNext(): Promise;
+ /**
+ * Iterates over all the documents for this cursor using the iterator, callback pattern.
+ *
+ * If the iterator returns `false`, iteration will stop.
+ *
+ * @param iterator - The iteration callback.
+ * @deprecated - Will be removed in a future release. Use for await...of instead.
+ */
+ forEach(iterator: (doc: TSchema) => boolean | void): Promise;
+ /**
+ * Frees any client-side resources used by the cursor.
+ */
+ close(options?: {
+ timeoutMS?: number;
+ }): Promise;
+ /**
+ * Returns an array of documents. The caller is responsible for making sure that there
+ * is enough memory to store the results. Note that the array only contains partial
+ * results when this cursor had been previously accessed. In that case,
+ * cursor.rewind() can be used to reset the cursor.
+ */
+ toArray(): Promise;
+ /**
+ * Add a cursor flag to the cursor
+ *
+ * @param flag - The flag to set, must be one of following ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'partial' -.
+ * @param value - The flag boolean value.
+ */
+ addCursorFlag(flag: CursorFlag, value: boolean): this;
+ /**
+ * Map all documents using the provided function
+ * If there is a transform set on the cursor, that will be called first and the result passed to
+ * this function's transform.
+ *
+ * @remarks
+ *
+ * **Note** Cursors use `null` internally to indicate that there are no more documents in the cursor. Providing a mapping
+ * function that maps values to `null` will result in the cursor closing itself before it has finished iterating
+ * all documents. This will **not** result in a memory leak, just surprising behavior. For example:
+ *
+ * ```typescript
+ * const cursor = collection.find({});
+ * cursor.map(() => null);
+ *
+ * const documents = await cursor.toArray();
+ * // documents is always [], regardless of how many documents are in the collection.
+ * ```
+ *
+ * Other falsey values are allowed:
+ *
+ * ```typescript
+ * const cursor = collection.find({});
+ * cursor.map(() => '');
+ *
+ * const documents = await cursor.toArray();
+ * // documents is now an array of empty strings
+ * ```
+ *
+ * **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
+ * it **does not** return a new instance of a cursor. This means when calling map,
+ * you should always assign the result to a new variable in order to get a correctly typed cursor variable.
+ * Take note of the following example:
+ *
+ * @example
+ * ```typescript
+ * const cursor: FindCursor = coll.find();
+ * const mappedCursor: FindCursor = cursor.map(doc => Object.keys(doc).length);
+ * const keyCounts: number[] = await mappedCursor.toArray(); // cursor.toArray() still returns Document[]
+ * ```
+ * @param transform - The mapping transformation method.
+ */
+ map(transform: (doc: TSchema) => T): AbstractCursor;
+ /**
+ * Set the ReadPreference for the cursor.
+ *
+ * @param readPreference - The new read preference for the cursor.
+ */
+ withReadPreference(readPreference: ReadPreferenceLike): this;
+ /**
+ * Set the ReadPreference for the cursor.
+ *
+ * @param readPreference - The new read preference for the cursor.
+ */
+ withReadConcern(readConcern: ReadConcernLike): this;
+ /**
+ * Set a maxTimeMS on the cursor query, allowing for hard timeout limits on queries (Only supported on MongoDB 2.6 or higher)
+ *
+ * @param value - Number of milliseconds to wait before aborting the query.
+ */
+ maxTimeMS(value: number): this;
+ /**
+ * Set the batch size for the cursor.
+ *
+ * @param value - The number of documents to return per batch. See {@link https://www.mongodb.com/docs/manual/reference/command/find/|find command documentation}.
+ */
+ batchSize(value: number): this;
+ /**
+ * Rewind this cursor to its uninitialized state. Any options that are present on the cursor will
+ * remain in effect. Iterating this cursor will cause new queries to be sent to the server, even
+ * if the resultant data has already been retrieved by this cursor.
+ */
+ rewind(): void;
+ /**
+ * Returns a new uninitialized copy of this cursor, with options matching those that have been set on the current instance
+ */
+ abstract clone(): AbstractCursor;
+ /* Excluded from this release type: _initialize */
+ /* Excluded from this release type: getMore */
+ /* Excluded from this release type: cursorInit */
+ /* Excluded from this release type: fetchBatch */
+ /* Excluded from this release type: cleanup */
+ /* Excluded from this release type: hasEmittedClose */
+ /* Excluded from this release type: emitClose */
+ /* Excluded from this release type: transformDocument */
+ /* Excluded from this release type: throwIfInitialized */
+}
+
+/** @public */
+export declare type AbstractCursorEvents = {
+ [AbstractCursor.CLOSE](): void;
+};
+
+/** @public */
+export declare interface AbstractCursorOptions extends BSONSerializeOptions {
+ session?: ClientSession;
+ readPreference?: ReadPreferenceLike;
+ readConcern?: ReadConcernLike;
+ /**
+ * Specifies the number of documents to return in each response from MongoDB
+ */
+ batchSize?: number;
+ /**
+ * When applicable `maxTimeMS` controls the amount of time the initial command
+ * that constructs a cursor should take. (ex. find, aggregate, listCollections)
+ */
+ maxTimeMS?: number;
+ /**
+ * When applicable `maxAwaitTimeMS` controls the amount of time subsequent getMores
+ * that a cursor uses to fetch more data should take. (ex. cursor.next())
+ */
+ maxAwaitTimeMS?: number;
+ /**
+ * Comment to apply to the operation.
+ *
+ * In server versions pre-4.4, 'comment' must be string. A server
+ * error will be thrown if any other type is provided.
+ *
+ * In server versions 4.4 and above, 'comment' can be any valid BSON type.
+ */
+ comment?: unknown;
+ /**
+ * By default, MongoDB will automatically close a cursor when the
+ * client has exhausted all results in the cursor. However, for [capped collections](https://www.mongodb.com/docs/manual/core/capped-collections)
+ * you may use a Tailable Cursor that remains open after the client exhausts
+ * the results in the initial cursor.
+ */
+ tailable?: boolean;
+ /**
+ * If awaitData is set to true, when the cursor reaches the end of the capped collection,
+ * MongoDB blocks the query thread for a period of time waiting for new data to arrive.
+ * When new data is inserted into the capped collection, the blocked thread is signaled
+ * to wake up and return the next batch to the client.
+ */
+ awaitData?: boolean;
+ noCursorTimeout?: boolean;
+ /** Specifies the time an operation will run until it throws a timeout error. See {@link AbstractCursorOptions.timeoutMode} for more details on how this option applies to cursors. */
+ timeoutMS?: number;
+ /**
+ * @public
+ * @experimental
+ * Specifies how `timeoutMS` is applied to the cursor. Can be either `'cursorLifeTime'` or `'iteration'`
+ * When set to `'iteration'`, the deadline specified by `timeoutMS` applies to each call of
+ * `cursor.next()`.
+ * When set to `'cursorLifetime'`, the deadline applies to the life of the entire cursor.
+ *
+ * Depending on the type of cursor being used, this option has different default values.
+ * For non-tailable cursors, this value defaults to `'cursorLifetime'`
+ * For tailable cursors, this value defaults to `'iteration'` since tailable cursors, by
+ * definition can have an arbitrarily long lifetime.
+ *
+ * @example
+ * ```ts
+ * const cursor = collection.find({}, {timeoutMS: 100, timeoutMode: 'iteration'});
+ * for await (const doc of cursor) {
+ * // process doc
+ * // This will throw a timeout error if any of the iterator's `next()` calls takes more than 100ms, but
+ * // will continue to iterate successfully otherwise, regardless of the number of batches.
+ * }
+ * ```
+ *
+ * @example
+ * ```ts
+ * const cursor = collection.find({}, { timeoutMS: 1000, timeoutMode: 'cursorLifetime' });
+ * const docs = await cursor.toArray(); // This entire line will throw a timeout error if all batches are not fetched and returned within 1000ms.
+ * ```
+ */
+ timeoutMode?: CursorTimeoutMode;
+ /* Excluded from this release type: timeoutContext */
+}
+
+/* Excluded from this release type: AbstractOperation */
+
+/** @public */
+export declare type AcceptedFields = {
+ readonly [key in KeysOfAType]?: AssignableType;
+};
+
+/** @public */
+export declare type AddToSetOperators = {
+ $each?: Array>;
+};
+
+/**
+ * The **Admin** class is an internal class that allows convenient access to
+ * the admin functionality and commands for MongoDB.
+ *
+ * **ADMIN Cannot directly be instantiated**
+ * @public
+ *
+ * @example
+ * ```ts
+ * import { MongoClient } from 'mongodb';
+ *
+ * const client = new MongoClient('mongodb://localhost:27017');
+ * const admin = client.db().admin();
+ * const dbInfo = await admin.listDatabases();
+ * for (const db of dbInfo.databases) {
+ * console.log(db.name);
+ * }
+ * ```
+ */
+export declare class Admin {
+ /* Excluded from this release type: s */
+ /* Excluded from this release type: __constructor */
+ /**
+ * Execute a command
+ *
+ * The driver will ensure the following fields are attached to the command sent to the server:
+ * - `lsid` - sourced from an implicit session or options.session
+ * - `$readPreference` - defaults to primary or can be configured by options.readPreference
+ * - `$db` - sourced from the name of this database
+ *
+ * If the client has a serverApi setting:
+ * - `apiVersion`
+ * - `apiStrict`
+ * - `apiDeprecationErrors`
+ *
+ * When in a transaction:
+ * - `readConcern` - sourced from readConcern set on the TransactionOptions
+ * - `writeConcern` - sourced from writeConcern set on the TransactionOptions
+ *
+ * Attaching any of the above fields to the command will have no effect as the driver will overwrite the value.
+ *
+ * @param command - The command to execute
+ * @param options - Optional settings for the command
+ */
+ command(command: Document, options?: RunCommandOptions): Promise;
+ /**
+ * Retrieve the server build information
+ *
+ * @param options - Optional settings for the command
+ */
+ buildInfo(options?: CommandOperationOptions): Promise;
+ /**
+ * Retrieve the server build information
+ *
+ * @param options - Optional settings for the command
+ */
+ serverInfo(options?: CommandOperationOptions): Promise;
+ /**
+ * Retrieve this db's server status.
+ *
+ * @param options - Optional settings for the command
+ */
+ serverStatus(options?: CommandOperationOptions): Promise;
+ /**
+ * Ping the MongoDB server and retrieve results
+ *
+ * @param options - Optional settings for the command
+ */
+ ping(options?: CommandOperationOptions): Promise;
+ /**
+ * Remove a user from a database
+ *
+ * @param username - The username to remove
+ * @param options - Optional settings for the command
+ */
+ removeUser(username: string, options?: RemoveUserOptions): Promise;
+ /**
+ * Validate an existing collection
+ *
+ * @param collectionName - The name of the collection to validate.
+ * @param options - Optional settings for the command
+ */
+ validateCollection(collectionName: string, options?: ValidateCollectionOptions): Promise;
+ /**
+ * List the available databases
+ *
+ * @param options - Optional settings for the command
+ */
+ listDatabases(options?: ListDatabasesOptions): Promise;
+ /**
+ * Get ReplicaSet status
+ *
+ * @param options - Optional settings for the command
+ */
+ replSetGetStatus(options?: CommandOperationOptions): Promise;
+}
+
+/* Excluded from this release type: AdminPrivate */
+
+/* Excluded from this release type: AggregateOperation */
+
+/** @public */
+export declare interface AggregateOptions extends Omit {
+ /** allowDiskUse lets the server know if it can use disk to store temporary results for the aggregation (requires mongodb 2.6 \>). */
+ allowDiskUse?: boolean;
+ /** The number of documents to return per batch. See [aggregation documentation](https://www.mongodb.com/docs/manual/reference/command/aggregate). */
+ batchSize?: number;
+ /** Allow driver to bypass schema validation. */
+ bypassDocumentValidation?: boolean;
+ /** Return the query as cursor, on 2.6 \> it returns as a real cursor on pre 2.6 it returns as an emulated cursor. */
+ cursor?: Document;
+ /**
+ * Specifies a cumulative time limit in milliseconds for processing operations on the cursor. MongoDB interrupts the operation at the earliest following interrupt point.
+ */
+ maxTimeMS?: number;
+ /** The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. */
+ maxAwaitTimeMS?: number;
+ /** Specify collation. */
+ collation?: CollationOptions;
+ /** Add an index selection hint to an aggregation command */
+ hint?: Hint;
+ /** Map of parameter names and values that can be accessed using $$var (requires MongoDB 5.0). */
+ let?: Document;
+ out?: string;
+ /**
+ * Specifies the verbosity mode for the explain output.
+ * @deprecated This API is deprecated in favor of `collection.aggregate().explain()`
+ * or `db.aggregate().explain()`.
+ */
+ explain?: ExplainOptions['explain'];
+ /* Excluded from this release type: timeoutMode */
+}
+
+/**
+ * The **AggregationCursor** class is an internal class that embodies an aggregation cursor on MongoDB
+ * allowing for iteration over the results returned from the underlying query. It supports
+ * one by one document iteration, conversion to an array or can be iterated as a Node 4.X
+ * or higher stream
+ * @public
+ */
+export declare class AggregationCursor extends ExplainableCursor {
+ readonly pipeline: Document[];
+ /* Excluded from this release type: aggregateOptions */
+ /* Excluded from this release type: __constructor */
+ clone(): AggregationCursor;
+ map(transform: (doc: TSchema) => T): AggregationCursor;
+ /* Excluded from this release type: _initialize */
+ /** Execute the explain for the cursor */
+ explain(): Promise;
+ explain(verbosity: ExplainVerbosityLike | ExplainCommandOptions): Promise;
+ explain(options: {
+ timeoutMS?: number;
+ }): Promise;
+ explain(verbosity: ExplainVerbosityLike | ExplainCommandOptions, options: {
+ timeoutMS?: number;
+ }): Promise;
+ /** Add a stage to the aggregation pipeline
+ * @example
+ * ```
+ * const documents = await users.aggregate().addStage({ $match: { name: /Mike/ } }).toArray();
+ * ```
+ * @example
+ * ```
+ * const documents = await users.aggregate()
+ * .addStage<{ name: string }>({ $project: { name: true } })
+ * .toArray(); // type of documents is { name: string }[]
+ * ```
+ */
+ addStage(stage: Document): this;
+ addStage(stage: Document): AggregationCursor;
+ /** Add a group stage to the aggregation pipeline */
+ group($group: Document): AggregationCursor;
+ /** Add a limit stage to the aggregation pipeline */
+ limit($limit: number): this;
+ /** Add a match stage to the aggregation pipeline */
+ match($match: Document): this;
+ /** Add an out stage to the aggregation pipeline */
+ out($out: {
+ db: string;
+ coll: string;
+ } | string): this;
+ /**
+ * Add a project stage to the aggregation pipeline
+ *
+ * @remarks
+ * In order to strictly type this function you must provide an interface
+ * that represents the effect of your projection on the result documents.
+ *
+ * By default chaining a projection to your cursor changes the returned type to the generic {@link Document} type.
+ * You should specify a parameterized type to have assertions on your final results.
+ *
+ * @example
+ * ```typescript
+ * // Best way
+ * const docs: AggregationCursor<{ a: number }> = cursor.project<{ a: number }>({ _id: 0, a: true });
+ * // Flexible way
+ * const docs: AggregationCursor = cursor.project({ _id: 0, a: true });
+ * ```
+ *
+ * @remarks
+ * In order to strictly type this function you must provide an interface
+ * that represents the effect of your projection on the result documents.
+ *
+ * **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor,
+ * it **does not** return a new instance of a cursor. This means when calling project,
+ * you should always assign the result to a new variable in order to get a correctly typed cursor variable.
+ * Take note of the following example:
+ *
+ * @example
+ * ```typescript
+ * const cursor: AggregationCursor<{ a: number; b: string }> = coll.aggregate([]);
+ * const projectCursor = cursor.project<{ a: number }>({ _id: 0, a: true });
+ * const aPropOnlyArray: {a: number}[] = await projectCursor.toArray();
+ *
+ * // or always use chaining and save the final cursor
+ *
+ * const cursor = coll.aggregate().project<{ a: string }>({
+ * _id: 0,
+ * a: { $convert: { input: '$a', to: 'string' }
+ * }});
+ * ```
+ */
+ project($project: Document): AggregationCursor;
+ /** Add a lookup stage to the aggregation pipeline */
+ lookup($lookup: Document): this;
+ /** Add a redact stage to the aggregation pipeline */
+ redact($redact: Document): this;
+ /** Add a skip stage to the aggregation pipeline */
+ skip($skip: number): this;
+ /** Add a sort stage to the aggregation pipeline */
+ sort($sort: Sort): this;
+ /** Add a unwind stage to the aggregation pipeline */
+ unwind($unwind: Document | string): this;
+ /** Add a geoNear stage to the aggregation pipeline */
+ geoNear($geoNear: Document): this;
+}
+
+/** @public */
+export declare interface AggregationCursorOptions extends AbstractCursorOptions, AggregateOptions {
+}
+
+/**
+ * It is possible to search using alternative types in mongodb e.g.
+ * string types can be searched using a regex in mongo
+ * array types can be searched using their element type
+ * @public
+ */
+export declare type AlternativeType = T extends ReadonlyArray ? T | RegExpOrString : RegExpOrString;
+
+/** @public */
+export declare type AnyBulkWriteOperation = {
+ insertOne: InsertOneModel;
+} | {
+ replaceOne: ReplaceOneModel;
+} | {
+ updateOne: UpdateOneModel;
+} | {
+ updateMany: UpdateManyModel;
+} | {
+ deleteOne: DeleteOneModel;
+} | {
+ deleteMany: DeleteManyModel;
+};
+
+/**
+ * Used to represent any of the client bulk write models that can be passed as an array
+ * to MongoClient#bulkWrite.
+ * @public
+ */
+export declare type AnyClientBulkWriteModel = ClientInsertOneModel | ClientReplaceOneModel | ClientUpdateOneModel | ClientUpdateManyModel | ClientDeleteOneModel | ClientDeleteManyModel;
+
+/** @public */
+export declare type AnyError = MongoError | Error;
+
+/** @public */
+export declare type ArrayElement = Type extends ReadonlyArray ? Item : never;
+
+/** @public */
+export declare type ArrayOperator = {
+ $each?: Array>;
+ $slice?: number;
+ $position?: number;
+ $sort?: Sort;
+};
+
+/** @public */
+export declare interface Auth {
+ /** The username for auth */
+ username?: string;
+ /** The password for auth */
+ password?: string;
+}
+
+/* Excluded from this release type: AuthContext */
+
+/** @public */
+export declare const AuthMechanism: Readonly<{
+ readonly MONGODB_AWS: "MONGODB-AWS";
+ readonly MONGODB_DEFAULT: "DEFAULT";
+ readonly MONGODB_GSSAPI: "GSSAPI";
+ readonly MONGODB_PLAIN: "PLAIN";
+ readonly MONGODB_SCRAM_SHA1: "SCRAM-SHA-1";
+ readonly MONGODB_SCRAM_SHA256: "SCRAM-SHA-256";
+ readonly MONGODB_X509: "MONGODB-X509";
+ readonly MONGODB_OIDC: "MONGODB-OIDC";
+}>;
+
+/** @public */
+export declare type AuthMechanism = (typeof AuthMechanism)[keyof typeof AuthMechanism];
+
+/** @public */
+export declare interface AuthMechanismProperties extends Document {
+ SERVICE_HOST?: string;
+ SERVICE_NAME?: string;
+ SERVICE_REALM?: string;
+ CANONICALIZE_HOST_NAME?: GSSAPICanonicalizationValue;
+ /* Excluded from this release type: AWS_SESSION_TOKEN */
+ /** A user provided OIDC machine callback function. */
+ OIDC_CALLBACK?: OIDCCallbackFunction;
+ /** A user provided OIDC human interacted callback function. */
+ OIDC_HUMAN_CALLBACK?: OIDCCallbackFunction;
+ /** The OIDC environment. Note that 'test' is for internal use only. */
+ ENVIRONMENT?: 'test' | 'azure' | 'gcp' | 'k8s';
+ /** Allowed hosts that OIDC auth can connect to. */
+ ALLOWED_HOSTS?: string[];
+ /** The resource token for OIDC auth in Azure and GCP. */
+ TOKEN_RESOURCE?: string;
+ /**
+ * A custom AWS credential provider to use. An example using the AWS SDK default provider chain:
+ *
+ * ```ts
+ * const client = new MongoClient(process.env.MONGODB_URI, {
+ * authMechanismProperties: {
+ * AWS_CREDENTIAL_PROVIDER: fromNodeProviderChain()
+ * }
+ * });
+ * ```
+ *
+ * Using a custom function that returns AWS credentials:
+ *
+ * ```ts
+ * const client = new MongoClient(process.env.MONGODB_URI, {
+ * authMechanismProperties: {
+ * AWS_CREDENTIAL_PROVIDER: async () => {
+ * return {
+ * accessKeyId: process.env.ACCESS_KEY_ID,
+ * secretAccessKey: process.env.SECRET_ACCESS_KEY
+ * }
+ * }
+ * }
+ * });
+ * ```
+ */
+ AWS_CREDENTIAL_PROVIDER?: AWSCredentialProvider;
+}
+
+/* Excluded from this release type: AuthProvider */
+
+/* Excluded from this release type: AutoEncrypter */
+
+/**
+ * @public
+ *
+ * Extra options related to the mongocryptd process
+ * \* _Available in MongoDB 6.0 or higher._
+ */
+export declare type AutoEncryptionExtraOptions = NonNullable;
+
+/** @public */
+export declare const AutoEncryptionLoggerLevel: Readonly<{
+ readonly FatalError: 0;
+ readonly Error: 1;
+ readonly Warning: 2;
+ readonly Info: 3;
+ readonly Trace: 4;
+}>;
+
+/**
+ * @public
+ * The level of severity of the log message
+ *
+ * | Value | Level |
+ * |-------|-------|
+ * | 0 | Fatal Error |
+ * | 1 | Error |
+ * | 2 | Warning |
+ * | 3 | Info |
+ * | 4 | Trace |
+ */
+export declare type AutoEncryptionLoggerLevel = (typeof AutoEncryptionLoggerLevel)[keyof typeof AutoEncryptionLoggerLevel];
+
+/** @public */
+export declare interface AutoEncryptionOptions {
+ /* Excluded from this release type: metadataClient */
+ /** A `MongoClient` used to fetch keys from a key vault */
+ keyVaultClient?: MongoClient;
+ /** The namespace where keys are stored in the key vault */
+ keyVaultNamespace?: string;
+ /** Configuration options that are used by specific KMS providers during key generation, encryption, and decryption. */
+ kmsProviders?: KMSProviders;
+ /** Configuration options for custom credential providers. */
+ credentialProviders?: CredentialProviders;
+ /**
+ * A map of namespaces to a local JSON schema for encryption
+ *
+ * **NOTE**: Supplying options.schemaMap provides more security than relying on JSON Schemas obtained from the server.
+ * It protects against a malicious server advertising a false JSON Schema, which could trick the client into sending decrypted data that should be encrypted.
+ * Schemas supplied in the schemaMap only apply to configuring automatic encryption for Client-Side Field Level Encryption.
+ * Other validation rules in the JSON schema will not be enforced by the driver and will result in an error.
+ */
+ schemaMap?: Document;
+ /** Supply a schema for the encrypted fields in the document */
+ encryptedFieldsMap?: Document;
+ /** Allows the user to bypass auto encryption, maintaining implicit decryption */
+ bypassAutoEncryption?: boolean;
+ /** Allows users to bypass query analysis */
+ bypassQueryAnalysis?: boolean;
+ /**
+ * Sets the expiration time for the DEK in the cache in milliseconds. Defaults to 60000. 0 means no timeout.
+ */
+ keyExpirationMS?: number;
+ options?: {
+ /** An optional hook to catch logging messages from the underlying encryption engine */
+ logger?: (level: AutoEncryptionLoggerLevel, message: string) => void;
+ };
+ extraOptions?: {
+ /**
+ * A local process the driver communicates with to determine how to encrypt values in a command.
+ * Defaults to "mongodb://%2Fvar%2Fmongocryptd.sock" if domain sockets are available or "mongodb://localhost:27020" otherwise
+ */
+ mongocryptdURI?: string;
+ /** If true, autoEncryption will not attempt to spawn a mongocryptd before connecting */
+ mongocryptdBypassSpawn?: boolean;
+ /** The path to the mongocryptd executable on the system */
+ mongocryptdSpawnPath?: `${string}mongocryptd${'.exe' | ''}`;
+ /** Command line arguments to use when auto-spawning a mongocryptd */
+ mongocryptdSpawnArgs?: string[];
+ /**
+ * Full path to a MongoDB Crypt shared library to be used (instead of mongocryptd).
+ *
+ * This needs to be the path to the file itself, not a directory.
+ * It can be an absolute or relative path. If the path is relative and
+ * its first component is `$ORIGIN`, it will be replaced by the directory
+ * containing the mongodb-client-encryption native addon file. Otherwise,
+ * the path will be interpreted relative to the current working directory.
+ *
+ * Currently, loading different MongoDB Crypt shared library files from different
+ * MongoClients in the same process is not supported.
+ *
+ * If this option is provided and no MongoDB Crypt shared library could be loaded
+ * from the specified location, creating the MongoClient will fail.
+ *
+ * If this option is not provided and `cryptSharedLibRequired` is not specified,
+ * the AutoEncrypter will attempt to spawn and/or use mongocryptd according
+ * to the mongocryptd-specific `extraOptions` options.
+ *
+ * Specifying a path prevents mongocryptd from being used as a fallback.
+ *
+ * Requires the MongoDB Crypt shared library, available in MongoDB 6.0 or higher.
+ */
+ cryptSharedLibPath?: `${string}mongo_crypt_v${number}.${'so' | 'dll' | 'dylib'}`;
+ /**
+ * If specified, never use mongocryptd and instead fail when the MongoDB Crypt
+ * shared library could not be loaded.
+ *
+ * This is always true when `cryptSharedLibPath` is specified.
+ *
+ * Requires the MongoDB Crypt shared library, available in MongoDB 6.0 or higher.
+ */
+ cryptSharedLibRequired?: boolean;
+ /* Excluded from this release type: cryptSharedLibSearchPaths */
+ };
+ proxyOptions?: ProxyOptions;
+ /** The TLS options to use connecting to the KMS provider */
+ tlsOptions?: CSFLEKMSTlsOptions;
+}
+
+/** @public **/
+export declare type AWSCredentialProvider = () => Promise;
+
+/**
+ * @public
+ * Copy of the AwsCredentialIdentityProvider interface from [`smithy/types`](https://socket.dev/npm/package/\@smithy/types/files/1.1.1/dist-types/identity/awsCredentialIdentity.d.ts),
+ * the return type of the aws-sdk's `fromNodeProviderChain().provider()`.
+ */
+export declare interface AWSCredentials {
+ accessKeyId: string;
+ secretAccessKey: string;
+ sessionToken?: string;
+ expiration?: Date;
+}
+
+/**
+ * @public
+ * Configuration options for making an AWS encryption key
+ */
+export declare interface AWSEncryptionKeyOptions {
+ /**
+ * The AWS region of the KMS
+ */
+ region: string;
+ /**
+ * The Amazon Resource Name (ARN) to the AWS customer master key (CMK)
+ */
+ key: string;
+ /**
+ * An alternate host to send KMS requests to. May include port number.
+ */
+ endpoint?: string | undefined;
+}
+
+/** @public */
+export declare interface AWSKMSProviderConfiguration {
+ /**
+ * The access key used for the AWS KMS provider
+ */
+ accessKeyId: string;
+ /**
+ * The secret access key used for the AWS KMS provider
+ */
+ secretAccessKey: string;
+ /**
+ * An optional AWS session token that will be used as the
+ * X-Amz-Security-Token header for AWS requests.
+ */
+ sessionToken?: string;
+}
+
+/**
+ * @public
+ * Configuration options for making an Azure encryption key
+ */
+export declare interface AzureEncryptionKeyOptions {
+ /**
+ * Key name
+ */
+ keyName: string;
+ /**
+ * Key vault URL, typically `.vault.azure.net`
+ */
+ keyVaultEndpoint: string;
+ /**
+ * Key version
+ */
+ keyVersion?: string | undefined;
+}
+
+/** @public */
+export declare type AzureKMSProviderConfiguration = {
+ /**
+ * The tenant ID identifies the organization for the account
+ */
+ tenantId: string;
+ /**
+ * The client ID to authenticate a registered application
+ */
+ clientId: string;
+ /**
+ * The client secret to authenticate a registered application
+ */
+ clientSecret: string;
+ /**
+ * If present, a host with optional port. E.g. "example.com" or "example.com:443".
+ * This is optional, and only needed if customer is using a non-commercial Azure instance
+ * (e.g. a government or China account, which use different URLs).
+ * Defaults to "login.microsoftonline.com"
+ */
+ identityPlatformEndpoint?: string | undefined;
+} | {
+ /**
+ * If present, an access token to authenticate with Azure.
+ */
+ accessToken: string;
+};
+
+/**
+ * Keeps the state of a unordered batch so we can rewrite the results
+ * correctly after command execution
+ *
+ * @public
+ */
+export declare class Batch {
+ originalZeroIndex: number;
+ currentIndex: number;
+ originalIndexes: number[];
+ batchType: BatchType;
+ operations: T[];
+ size: number;
+ sizeBytes: number;
+ constructor(batchType: BatchType, originalZeroIndex: number);
+}
+
+/** @public */
+export declare const BatchType: Readonly<{
+ readonly INSERT: 1;
+ readonly UPDATE: 2;
+ readonly DELETE: 3;
+}>;
+
+/** @public */
+export declare type BatchType = (typeof BatchType)[keyof typeof BatchType];
+
+export { Binary }
+
+/** @public */
+export declare type BitwiseFilter = number /** numeric bit mask */ | Binary /** BinData bit mask */ | ReadonlyArray;
+
+export { BSON }
+
+/* Excluded from this release type: BSONElement */
+export { BSONRegExp }
+
+/**
+ * BSON Serialization options.
+ * @public
+ */
+export declare interface BSONSerializeOptions extends Omit, Omit {
+ /**
+ * Enabling the raw option will return a [Node.js Buffer](https://nodejs.org/api/buffer.html)
+ * which is allocated using [allocUnsafe API](https://nodejs.org/api/buffer.html#static-method-bufferallocunsafesize).
+ * See this section from the [Node.js Docs here](https://nodejs.org/api/buffer.html#what-makes-bufferallocunsafe-and-bufferallocunsafeslow-unsafe)
+ * for more detail about what "unsafe" refers to in this context.
+ * If you need to maintain your own editable clone of the bytes returned for an extended life time of the process, it is recommended you allocate
+ * your own buffer and clone the contents:
+ *
+ * @example
+ * ```ts
+ * const raw = await collection.findOne({}, { raw: true });
+ * const myBuffer = Buffer.alloc(raw.byteLength);
+ * myBuffer.set(raw, 0);
+ * // Only save and use `myBuffer` beyond this point
+ * ```
+ *
+ * @remarks
+ * Please note there is a known limitation where this option cannot be used at the MongoClient level (see [NODE-3946](https://jira.mongodb.org/browse/NODE-3946)).
+ * It does correctly work at `Db`, `Collection`, and per operation the same as other BSON options work.
+ */
+ raw?: boolean;
+ /** Enable utf8 validation when deserializing BSON documents. Defaults to true. */
+ enableUtf8Validation?: boolean;
+}
+
+export { BSONSymbol }
+
+export { BSONType }
+
+/** @public */
+export declare type BSONTypeAlias = keyof typeof BSONType;
+
+/* Excluded from this release type: BufferPool */
+
+/** @public */
+export declare abstract class BulkOperationBase {
+ isOrdered: boolean;
+ /* Excluded from this release type: s */
+ operationId?: number;
+ private collection;
+ /* Excluded from this release type: retryWrites */
+ /* Excluded from this release type: __constructor */
+ /**
+ * Add a single insert document to the bulk operation
+ *
+ * @example
+ * ```ts
+ * const bulkOp = collection.initializeOrderedBulkOp();
+ *
+ * // Adds three inserts to the bulkOp.
+ * bulkOp
+ * .insert({ a: 1 })
+ * .insert({ b: 2 })
+ * .insert({ c: 3 });
+ * await bulkOp.execute();
+ * ```
+ */
+ insert(document: Document): BulkOperationBase;
+ /**
+ * Builds a find operation for an update/updateOne/delete/deleteOne/replaceOne.
+ * Returns a builder object used to complete the definition of the operation.
+ *
+ * @example
+ * ```ts
+ * const bulkOp = collection.initializeOrderedBulkOp();
+ *
+ * // Add an updateOne to the bulkOp
+ * bulkOp.find({ a: 1 }).updateOne({ $set: { b: 2 } });
+ *
+ * // Add an updateMany to the bulkOp
+ * bulkOp.find({ c: 3 }).update({ $set: { d: 4 } });
+ *
+ * // Add an upsert
+ * bulkOp.find({ e: 5 }).upsert().updateOne({ $set: { f: 6 } });
+ *
+ * // Add a deletion
+ * bulkOp.find({ g: 7 }).deleteOne();
+ *
+ * // Add a multi deletion
+ * bulkOp.find({ h: 8 }).delete();
+ *
+ * // Add a replaceOne
+ * bulkOp.find({ i: 9 }).replaceOne({writeConcern: { j: 10 }});
+ *
+ * // Update using a pipeline (requires Mongodb 4.2 or higher)
+ * bulk.find({ k: 11, y: { $exists: true }, z: { $exists: true } }).updateOne([
+ * { $set: { total: { $sum: [ '$y', '$z' ] } } }
+ * ]);
+ *
+ * // All of the ops will now be executed
+ * await bulkOp.execute();
+ * ```
+ */
+ find(selector: Document): FindOperators;
+ /** Specifies a raw operation to perform in the bulk write. */
+ raw(op: AnyBulkWriteOperation): this;
+ get length(): number;
+ get bsonOptions(): BSONSerializeOptions;
+ get writeConcern(): WriteConcern | undefined;
+ get batches(): Batch[];
+ execute(options?: BulkWriteOptions): Promise;
+ /* Excluded from this release type: handleWriteError */
+ abstract addToOperationsList(batchType: BatchType, document: Document | UpdateStatement | DeleteStatement): this;
+ private shouldForceServerObjectId;
+}
+
+/* Excluded from this release type: BulkOperationPrivate */
+
+/* Excluded from this release type: BulkResult */
+
+/** @public */
+export declare interface BulkWriteOperationError {
+ index: number;
+ code: number;
+ errmsg: string;
+ errInfo: Document;
+ op: Document | UpdateStatement | DeleteStatement;
+}
+
+/** @public */
+export declare interface BulkWriteOptions extends CommandOperationOptions {
+ /**
+ * Allow driver to bypass schema validation.
+ * @defaultValue `false` - documents will be validated by default
+ **/
+ bypassDocumentValidation?: boolean;
+ /**
+ * If true, when an insert fails, don't execute the remaining writes.
+ * If false, continue with remaining inserts when one fails.
+ * @defaultValue `true` - inserts are ordered by default
+ */
+ ordered?: boolean;
+ /**
+ * Force server to assign _id values instead of driver.
+ * @defaultValue `false` - the driver generates `_id` fields by default
+ **/
+ forceServerObjectId?: boolean;
+ /** Map of parameter names and values that can be accessed using $$var (requires MongoDB 5.0). */
+ let?: Document;
+ /* Excluded from this release type: timeoutContext */
+}
+
+/**
+ * @public
+ * The result of a bulk write.
+ */
+export declare class BulkWriteResult {
+ private readonly result;
+ /** Number of documents inserted. */
+ readonly insertedCount: number;
+ /** Number of documents matched for update. */
+ readonly matchedCount: number;
+ /** Number of documents modified. */
+ readonly modifiedCount: number;
+ /** Number of documents deleted. */
+ readonly deletedCount: number;
+ /** Number of documents upserted. */
+ readonly upsertedCount: number;
+ /** Upserted document generated Id's, hash key is the index of the originating operation */
+ readonly upsertedIds: {
+ [key: number]: any;
+ };
+ /** Inserted document generated Id's, hash key is the index of the originating operation */
+ readonly insertedIds: {
+ [key: number]: any;
+ };
+ private static generateIdMap;
+ /* Excluded from this release type: __constructor */
+ /** Evaluates to true if the bulk operation correctly executes */
+ get ok(): number;
+ /* Excluded from this release type: getSuccessfullyInsertedIds */
+ /** Returns the upserted id at the given index */
+ getUpsertedIdAt(index: number): Document | undefined;
+ /** Returns raw internal result */
+ getRawResponse(): Document;
+ /** Returns true if the bulk operation contains a write error */
+ hasWriteErrors(): boolean;
+ /** Returns the number of write errors from the bulk operation */
+ getWriteErrorCount(): number;
+ /** Returns a specific write error object */
+ getWriteErrorAt(index: number): WriteError | undefined;
+ /** Retrieve all write errors */
+ getWriteErrors(): WriteError[];
+ /** Retrieve the write concern error if one exists */
+ getWriteConcernError(): WriteConcernError | undefined;
+ toString(): string;
+ isOk(): boolean;
+}
+
+/**
+ * MongoDB Driver style callback
+ * @public
+ */
+export declare type Callback = (error?: AnyError, result?: T) => void;
+
+/* Excluded from this release type: CancellationToken */
+
+/**
+ * Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
+ * @public
+ */
+export declare class ChangeStream> extends TypedEventEmitter> implements AsyncDisposable {
+ /**
+ * @experimental
+ * An alias for {@link ChangeStream.close|ChangeStream.close()}.
+ */
+ [Symbol.asyncDispose](): Promise;
+ pipeline: Document[];
+ /**
+ * @remarks WriteConcern can still be present on the options because
+ * we inherit options from the client/db/collection. The
+ * key must be present on the options in order to delete it.
+ * This allows typescript to delete the key but will
+ * not allow a writeConcern to be assigned as a property on options.
+ */
+ options: ChangeStreamOptions & {
+ writeConcern?: never;
+ };
+ parent: MongoClient | Db | Collection;
+ namespace: MongoDBNamespace;
+ type: symbol;
+ /* Excluded from this release type: cursor */
+ /* Excluded from this release type: cursorStream */
+ /* Excluded from this release type: isClosed */
+ /* Excluded from this release type: mode */
+ /** @event */
+ static readonly RESPONSE: "response";
+ /** @event */
+ static readonly MORE: "more";
+ /** @event */
+ static readonly INIT: "init";
+ /** @event */
+ static readonly CLOSE: "close";
+ /**
+ * Fired for each new matching change in the specified namespace. Attaching a `change`
+ * event listener to a Change Stream will switch the stream into flowing mode. Data will
+ * then be passed as soon as it is available.
+ * @event
+ */
+ static readonly CHANGE: "change";
+ /** @event */
+ static readonly END: "end";
+ /** @event */
+ static readonly ERROR: "error";
+ /**
+ * Emitted each time the change stream stores a new resume token.
+ * @event
+ */
+ static readonly RESUME_TOKEN_CHANGED: "resumeTokenChanged";
+ private timeoutContext?;
+ /**
+ * Note that this property is here to uniquely identify a ChangeStream instance as the owner of
+ * the {@link CursorTimeoutContext} instance (see {@link ChangeStream._createChangeStreamCursor}) to ensure
+ * that {@link AbstractCursor.close} does not mutate the timeoutContext.
+ */
+ private contextOwner;
+ /* Excluded from this release type: __constructor */
+ /** The cached resume token that is used to resume after the most recently returned change. */
+ get resumeToken(): ResumeToken;
+ /** Returns the currently buffered documents length of the underlying cursor. */
+ bufferedCount(): number;
+ /** Check if there is any document still available in the Change Stream */
+ hasNext(): Promise;
+ /** Get the next available document from the Change Stream. */
+ next(): Promise;
+ /**
+ * Try to get the next available document from the Change Stream's cursor or `null` if an empty batch is returned
+ */
+ tryNext(): Promise;
+ [Symbol.asyncIterator](): AsyncGenerator;
+ /** Is the cursor closed */
+ get closed(): boolean;
+ /**
+ * Frees the internal resources used by the change stream.
+ */
+ close(): Promise;
+ /**
+ * Return a modified Readable stream including a possible transform method.
+ *
+ * NOTE: When using a Stream to process change stream events, the stream will
+ * NOT automatically resume in the case a resumable error is encountered.
+ *
+ * @throws MongoChangeStreamError if the underlying cursor or the change stream is closed
+ */
+ stream(): Readable & AsyncIterable;
+ /* Excluded from this release type: _setIsEmitter */
+ /* Excluded from this release type: _setIsIterator */
+ /* Excluded from this release type: _createChangeStreamCursor */
+ /* Excluded from this release type: _closeEmitterModeWithError */
+ /* Excluded from this release type: _streamEvents */
+ /* Excluded from this release type: _endStream */
+ /* Excluded from this release type: _processChange */
+ /* Excluded from this release type: _processErrorStreamMode */
+ /* Excluded from this release type: _processErrorIteratorMode */
+ private _resume;
+}
+
+/**
+ * Only present when the `showExpandedEvents` flag is enabled.
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/modify/#mongodb-data-modify
+ */
+export declare interface ChangeStreamCollModDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'modify';
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/create/#mongodb-data-create
+ */
+export declare interface ChangeStreamCreateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'create';
+ /**
+ * The type of the newly created object.
+ *
+ * @sinceServerVersion 8.1.0
+ */
+ nsType?: 'collection' | 'timeseries' | 'view';
+}
+
+/**
+ * Only present when the `showExpandedEvents` flag is enabled.
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/createIndexes/#mongodb-data-createIndexes
+ */
+export declare interface ChangeStreamCreateIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'createIndexes';
+}
+
+/* Excluded from this release type: ChangeStreamCursor */
+
+/* Excluded from this release type: ChangeStreamCursorOptions */
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/#delete-event
+ */
+export declare interface ChangeStreamDeleteDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'delete';
+ /** Namespace the delete event occurred on */
+ ns: ChangeStreamNameSpace;
+ /**
+ * Contains the pre-image of the modified or deleted document if the
+ * pre-image is available for the change event and either 'required' or
+ * 'whenAvailable' was specified for the 'fullDocumentBeforeChange' option
+ * when creating the change stream. If 'whenAvailable' was specified but the
+ * pre-image is unavailable, this will be explicitly set to null.
+ */
+ fullDocumentBeforeChange?: TSchema;
+}
+
+/** @public */
+export declare type ChangeStreamDocument = ChangeStreamInsertDocument | ChangeStreamUpdateDocument | ChangeStreamReplaceDocument | ChangeStreamDeleteDocument | ChangeStreamDropDocument | ChangeStreamRenameDocument | ChangeStreamDropDatabaseDocument | ChangeStreamInvalidateDocument | ChangeStreamCreateIndexDocument | ChangeStreamCreateDocument | ChangeStreamCollModDocument | ChangeStreamDropIndexDocument | ChangeStreamShardCollectionDocument | ChangeStreamReshardCollectionDocument | ChangeStreamRefineCollectionShardKeyDocument;
+
+/** @public */
+export declare interface ChangeStreamDocumentCollectionUUID {
+ /**
+ * The UUID (Binary subtype 4) of the collection that the operation was performed on.
+ *
+ * Only present when the `showExpandedEvents` flag is enabled.
+ *
+ * **NOTE:** collectionUUID will be converted to a NodeJS Buffer if the promoteBuffers
+ * flag is enabled.
+ *
+ * @sinceServerVersion 6.1.0
+ */
+ collectionUUID: Binary;
+}
+
+/** @public */
+export declare interface ChangeStreamDocumentCommon {
+ /**
+ * The id functions as an opaque token for use when resuming an interrupted
+ * change stream.
+ */
+ _id: ResumeToken;
+ /**
+ * The timestamp from the oplog entry associated with the event.
+ * For events that happened as part of a multi-document transaction, the associated change stream
+ * notifications will have the same clusterTime value, namely the time when the transaction was committed.
+ * On a sharded cluster, events that occur on different shards can have the same clusterTime but be
+ * associated with different transactions or even not be associated with any transaction.
+ * To identify events for a single transaction, you can use the combination of lsid and txnNumber in the change stream event document.
+ */
+ clusterTime?: Timestamp;
+ /**
+ * The transaction number.
+ * Only present if the operation is part of a multi-document transaction.
+ *
+ * **NOTE:** txnNumber can be a Long if promoteLongs is set to false
+ */
+ txnNumber?: number;
+ /**
+ * The identifier for the session associated with the transaction.
+ * Only present if the operation is part of a multi-document transaction.
+ */
+ lsid?: ServerSessionId;
+ /**
+ * When the change stream's backing aggregation pipeline contains the $changeStreamSplitLargeEvent
+ * stage, events larger than 16MB will be split into multiple events and contain the
+ * following information about which fragment the current event is.
+ */
+ splitEvent?: ChangeStreamSplitEvent;
+}
+
+/** @public */
+export declare interface ChangeStreamDocumentKey {
+ /**
+ * For unsharded collections this contains a single field `_id`.
+ * For sharded collections, this will contain all the components of the shard key
+ */
+ documentKey: {
+ _id: InferIdType;
+ [shardKey: string]: any;
+ };
+}
+
+/** @public */
+export declare interface ChangeStreamDocumentOperationDescription {
+ /**
+ * An description of the operation.
+ *
+ * Only present when the `showExpandedEvents` flag is enabled.
+ *
+ * @sinceServerVersion 6.1.0
+ */
+ operationDescription?: Document;
+}
+
+/** @public */
+export declare interface ChangeStreamDocumentWallTime {
+ /**
+ * The server date and time of the database operation.
+ * wallTime differs from clusterTime in that clusterTime is a timestamp taken from the oplog entry associated with the database operation event.
+ * @sinceServerVersion 6.0.0
+ */
+ wallTime?: Date;
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/#dropdatabase-event
+ */
+export declare interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'dropDatabase';
+ /** The database dropped */
+ ns: {
+ db: string;
+ };
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/#drop-event
+ */
+export declare interface ChangeStreamDropDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'drop';
+ /** Namespace the drop event occurred on */
+ ns: ChangeStreamNameSpace;
+}
+
+/**
+ * Only present when the `showExpandedEvents` flag is enabled.
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/dropIndexes/#mongodb-data-dropIndexes
+ */
+export declare interface ChangeStreamDropIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'dropIndexes';
+}
+
+/** @public */
+export declare type ChangeStreamEvents> = {
+ resumeTokenChanged(token: ResumeToken): void;
+ init(response: any): void;
+ more(response?: any): void;
+ response(): void;
+ end(): void;
+ error(error: Error): void;
+ change(change: TChange): void;
+ /**
+ * @remarks Note that the `close` event is currently emitted whenever the internal `ChangeStreamCursor`
+ * instance is closed, which can occur multiple times for a given `ChangeStream` instance.
+ *
+ * TODO(NODE-6434): address this issue in NODE-6434
+ */
+ close(): void;
+};
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/#insert-event
+ */
+export declare interface ChangeStreamInsertDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'insert';
+ /** This key will contain the document being inserted */
+ fullDocument: TSchema;
+ /** Namespace the insert event occurred on */
+ ns: ChangeStreamNameSpace;
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/#invalidate-event
+ */
+export declare interface ChangeStreamInvalidateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'invalidate';
+}
+
+/** @public */
+export declare interface ChangeStreamNameSpace {
+ db: string;
+ coll: string;
+}
+
+/**
+ * Options that can be passed to a ChangeStream. Note that startAfter, resumeAfter, and startAtOperationTime are all mutually exclusive, and the server will error if more than one is specified.
+ * @public
+ */
+export declare interface ChangeStreamOptions extends Omit {
+ /**
+ * Allowed values: 'updateLookup', 'whenAvailable', 'required'.
+ *
+ * When set to 'updateLookup', the change notification for partial updates
+ * will include both a delta describing the changes to the document as well
+ * as a copy of the entire document that was changed from some time after
+ * the change occurred.
+ *
+ * When set to 'whenAvailable', configures the change stream to return the
+ * post-image of the modified document for replace and update change events
+ * if the post-image for this event is available.
+ *
+ * When set to 'required', the same behavior as 'whenAvailable' except that
+ * an error is raised if the post-image is not available.
+ */
+ fullDocument?: string;
+ /**
+ * Allowed values: 'whenAvailable', 'required', 'off'.
+ *
+ * The default is to not send a value, which is equivalent to 'off'.
+ *
+ * When set to 'whenAvailable', configures the change stream to return the
+ * pre-image of the modified document for replace, update, and delete change
+ * events if it is available.
+ *
+ * When set to 'required', the same behavior as 'whenAvailable' except that
+ * an error is raised if the pre-image is not available.
+ */
+ fullDocumentBeforeChange?: string;
+ /** The maximum amount of time for the server to wait on new documents to satisfy a change stream query. */
+ maxAwaitTimeMS?: number;
+ /**
+ * Allows you to start a changeStream after a specified event.
+ * @see https://www.mongodb.com/docs/manual/changeStreams/#resumeafter-for-change-streams
+ */
+ resumeAfter?: ResumeToken;
+ /**
+ * Similar to resumeAfter, but will allow you to start after an invalidated event.
+ * @see https://www.mongodb.com/docs/manual/changeStreams/#startafter-for-change-streams
+ */
+ startAfter?: ResumeToken;
+ /** Will start the changeStream after the specified operationTime. */
+ startAtOperationTime?: OperationTime;
+ /**
+ * The number of documents to return per batch.
+ * @see https://www.mongodb.com/docs/manual/reference/command/aggregate
+ */
+ batchSize?: number;
+ /**
+ * When enabled, configures the change stream to include extra change events.
+ *
+ * - createIndexes
+ * - dropIndexes
+ * - modify
+ * - create
+ * - shardCollection
+ * - reshardCollection
+ * - refineCollectionShardKey
+ */
+ showExpandedEvents?: boolean;
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/refineCollectionShardKey/#mongodb-data-refineCollectionShardKey
+ */
+export declare interface ChangeStreamRefineCollectionShardKeyDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'refineCollectionShardKey';
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/#rename-event
+ */
+export declare interface ChangeStreamRenameDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'rename';
+ /** The new name for the `ns.coll` collection */
+ to: {
+ db: string;
+ coll: string;
+ };
+ /** The "from" namespace that the rename occurred on */
+ ns: ChangeStreamNameSpace;
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/#replace-event
+ */
+export declare interface ChangeStreamReplaceDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'replace';
+ /** The fullDocument of a replace event represents the document after the insert of the replacement document */
+ fullDocument: TSchema;
+ /** Namespace the replace event occurred on */
+ ns: ChangeStreamNameSpace;
+ /**
+ * Contains the pre-image of the modified or deleted document if the
+ * pre-image is available for the change event and either 'required' or
+ * 'whenAvailable' was specified for the 'fullDocumentBeforeChange' option
+ * when creating the change stream. If 'whenAvailable' was specified but the
+ * pre-image is unavailable, this will be explicitly set to null.
+ */
+ fullDocumentBeforeChange?: TSchema;
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/reshardCollection/#mongodb-data-reshardCollection
+ */
+export declare interface ChangeStreamReshardCollectionDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'reshardCollection';
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/shardCollection/#mongodb-data-shardCollection
+ */
+export declare interface ChangeStreamShardCollectionDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'shardCollection';
+}
+
+/** @public */
+export declare interface ChangeStreamSplitEvent {
+ /** Which fragment of the change this is. */
+ fragment: number;
+ /** The total number of fragments. */
+ of: number;
+}
+
+/**
+ * @public
+ * @see https://www.mongodb.com/docs/manual/reference/change-events/#update-event
+ */
+export declare interface ChangeStreamUpdateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
+ /** Describes the type of operation represented in this change notification */
+ operationType: 'update';
+ /**
+ * This is only set if `fullDocument` is set to `'updateLookup'`
+ * Contains the point-in-time post-image of the modified document if the
+ * post-image is available and either 'required' or 'whenAvailable' was
+ * specified for the 'fullDocument' option when creating the change stream.
+ */
+ fullDocument?: TSchema;
+ /** Contains a description of updated and removed fields in this operation */
+ updateDescription: UpdateDescription;
+ /** Namespace the update event occurred on */
+ ns: ChangeStreamNameSpace;
+ /**
+ * Contains the pre-image of the modified or deleted document if the
+ * pre-image is available for the change event and either 'required' or
+ * 'whenAvailable' was specified for the 'fullDocumentBeforeChange' option
+ * when creating the change stream. If 'whenAvailable' was specified but the
+ * pre-image is unavailable, this will be explicitly set to null.
+ */
+ fullDocumentBeforeChange?: TSchema;
+}
+
+/** @public */
+export declare interface ClientBulkWriteError {
+ code: number;
+ message: string;
+}
+
+/**
+ * A mapping of namespace strings to collections schemas.
+ * @public
+ *
+ * @example
+ * ```ts
+ * type MongoDBSchemas = {
+ * 'db.books': Book;
+ * 'db.authors': Author;
+ * }
+ *
+ * const model: ClientBulkWriteModel = {
+ * namespace: 'db.books'
+ * name: 'insertOne',
+ * document: { title: 'Practical MongoDB Aggregations', authorName: 3 } // error `authorName` cannot be number
+ * };
+ * ```
+ *
+ * The type of the `namespace` field narrows other parts of the BulkWriteModel to use the correct schema for type assertions.
+ *
+ */
+export declare type ClientBulkWriteModel = Record> = {
+ [Namespace in keyof SchemaMap]: AnyClientBulkWriteModel & {
+ namespace: Namespace;
+ };
+}[keyof SchemaMap];
+
+/** @public */
+export declare interface ClientBulkWriteOptions extends CommandOperationOptions {
+ /**
+ * If true, when an insert fails, don't execute the remaining writes.
+ * If false, continue with remaining inserts when one fails.
+ * @defaultValue `true` - inserts are ordered by default
+ */
+ ordered?: boolean;
+ /**
+ * Allow driver to bypass schema validation.
+ * @defaultValue `false` - documents will be validated by default
+ **/
+ bypassDocumentValidation?: boolean;
+ /** Map of parameter names and values that can be accessed using $$var (requires MongoDB 5.0). */
+ let?: Document;
+ /**
+ * Whether detailed results for each successful operation should be included in the returned
+ * BulkWriteResult.
+ */
+ verboseResults?: boolean;
+}
+
+/** @public */
+export declare interface ClientBulkWriteResult {
+ /**
+ * Whether the bulk write was acknowledged.
+ */
+ readonly acknowledged: boolean;
+ /**
+ * The total number of documents inserted across all insert operations.
+ */
+ readonly insertedCount: number;
+ /**
+ * The total number of documents upserted across all update operations.
+ */
+ readonly upsertedCount: number;
+ /**
+ * The total number of documents matched across all update operations.
+ */
+ readonly matchedCount: number;
+ /**
+ * The total number of documents modified across all update operations.
+ */
+ readonly modifiedCount: number;
+ /**
+ * The total number of documents deleted across all delete operations.
+ */
+ readonly deletedCount: number;
+ /**
+ * The results of each individual insert operation that was successfully performed.
+ */
+ readonly insertResults?: ReadonlyMap;
+ /**
+ * The results of each individual update operation that was successfully performed.
+ */
+ readonly updateResults?: ReadonlyMap;
+ /**
+ * The results of each individual delete operation that was successfully performed.
+ */
+ readonly deleteResults?: ReadonlyMap;
+}
+
+/** @public */
+export declare interface ClientDeleteManyModel extends ClientWriteModel {
+ name: 'deleteMany';
+ /**
+ * The filter used to determine if a document should be deleted.
+ * For a deleteMany operation, all matches are removed.
+ */
+ filter: Filter;
+ /** Specifies a collation. */
+ collation?: CollationOptions;
+ /** The index to use. If specified, then the query system will only consider plans using the hinted index. */
+ hint?: Hint;
+}
+
+/** @public */
+export declare interface ClientDeleteOneModel extends ClientWriteModel {
+ name: 'deleteOne';
+ /**
+ * The filter used to determine if a document should be deleted.
+ * For a deleteOne operation, the first match is removed.
+ */
+ filter: Filter;
+ /** Specifies a collation. */
+ collation?: CollationOptions;
+ /** The index to use. If specified, then the query system will only consider plans using the hinted index. */
+ hint?: Hint;
+}
+
+/** @public */
+export declare interface ClientDeleteResult {
+ /**
+ * The number of documents that were deleted.
+ */
+ deletedCount: number;
+}
+
+/**
+ * @public
+ * The public interface for explicit in-use encryption
+ */
+export declare class ClientEncryption {
+ /* Excluded from this release type: _client */
+ /* Excluded from this release type: _keyVaultNamespace */
+ /* Excluded from this release type: _keyVaultClient */
+ /* Excluded from this release type: _proxyOptions */
+ /* Excluded from this release type: _tlsOptions */
+ /* Excluded from this release type: _kmsProviders */
+ /* Excluded from this release type: _timeoutMS */
+ /* Excluded from this release type: _mongoCrypt */
+ /* Excluded from this release type: _credentialProviders */
+ /* Excluded from this release type: getMongoCrypt */
+ /**
+ * Create a new encryption instance
+ *
+ * @example
+ * ```ts
+ * new ClientEncryption(mongoClient, {
+ * keyVaultNamespace: 'client.encryption',
+ * kmsProviders: {
+ * local: {
+ * key: masterKey // The master key used for encryption/decryption. A 96-byte long Buffer
+ * }
+ * }
+ * });
+ * ```
+ *
+ * @example
+ * ```ts
+ * new ClientEncryption(mongoClient, {
+ * keyVaultNamespace: 'client.encryption',
+ * kmsProviders: {
+ * aws: {
+ * accessKeyId: AWS_ACCESS_KEY,
+ * secretAccessKey: AWS_SECRET_KEY
+ * }
+ * }
+ * });
+ * ```
+ */
+ constructor(client: MongoClient, options: ClientEncryptionOptions);
+ /**
+ * Creates a data key used for explicit encryption and inserts it into the key vault namespace
+ *
+ * @example
+ * ```ts
+ * // Using async/await to create a local key
+ * const dataKeyId = await clientEncryption.createDataKey('local');
+ * ```
+ *
+ * @example
+ * ```ts
+ * // Using async/await to create an aws key
+ * const dataKeyId = await clientEncryption.createDataKey('aws', {
+ * masterKey: {
+ * region: 'us-east-1',
+ * key: 'xxxxxxxxxxxxxx' // CMK ARN here
+ * }
+ * });
+ * ```
+ *
+ * @example
+ * ```ts
+ * // Using async/await to create an aws key with a keyAltName
+ * const dataKeyId = await clientEncryption.createDataKey('aws', {
+ * masterKey: {
+ * region: 'us-east-1',
+ * key: 'xxxxxxxxxxxxxx' // CMK ARN here
+ * },
+ * keyAltNames: [ 'mySpecialKey' ]
+ * });
+ * ```
+ */
+ createDataKey(provider: ClientEncryptionDataKeyProvider, options?: ClientEncryptionCreateDataKeyProviderOptions): Promise;
+ /**
+ * Searches the keyvault for any data keys matching the provided filter. If there are matches, rewrapManyDataKey then attempts to re-wrap the data keys using the provided options.
+ *
+ * If no matches are found, then no bulk write is performed.
+ *
+ * @example
+ * ```ts
+ * // rewrapping all data data keys (using a filter that matches all documents)
+ * const filter = {};
+ *
+ * const result = await clientEncryption.rewrapManyDataKey(filter);
+ * if (result.bulkWriteResult != null) {
+ * // keys were re-wrapped, results will be available in the bulkWrite object.
+ * }
+ * ```
+ *
+ * @example
+ * ```ts
+ * // attempting to rewrap all data keys with no matches
+ * const filter = { _id: new Binary() } // assume _id matches no documents in the database
+ * const result = await clientEncryption.rewrapManyDataKey(filter);
+ *
+ * if (result.bulkWriteResult == null) {
+ * // no keys matched, `bulkWriteResult` does not exist on the result object
+ * }
+ * ```
+ */
+ rewrapManyDataKey(filter: Filter, options?: ClientEncryptionRewrapManyDataKeyProviderOptions): Promise<{
+ bulkWriteResult?: BulkWriteResult;
+ }>;
+ /**
+ * Deletes the key with the provided id from the keyvault, if it exists.
+ *
+ * @example
+ * ```ts
+ * // delete a key by _id
+ * const id = new Binary(); // id is a bson binary subtype 4 object
+ * const { deletedCount } = await clientEncryption.deleteKey(id);
+ *
+ * if (deletedCount != null && deletedCount > 0) {
+ * // successful deletion
+ * }
+ * ```
+ *
+ */
+ deleteKey(_id: Binary): Promise;
+ /**
+ * Finds all the keys currently stored in the keyvault.
+ *
+ * This method will not throw.
+ *
+ * @returns a FindCursor over all keys in the keyvault.
+ * @example
+ * ```ts
+ * // fetching all keys
+ * const keys = await clientEncryption.getKeys().toArray();
+ * ```
+ */
+ getKeys(): FindCursor;
+ /**
+ * Finds a key in the keyvault with the specified _id.
+ *
+ * Returns a promise that either resolves to a {@link DataKey} if a document matches the key or null if no documents
+ * match the id. The promise rejects with an error if an error is thrown.
+ * @example
+ * ```ts
+ * // getting a key by id
+ * const id = new Binary(); // id is a bson binary subtype 4 object
+ * const key = await clientEncryption.getKey(id);
+ * if (!key) {
+ * // key is null if there was no matching key
+ * }
+ * ```
+ */
+ getKey(_id: Binary): Promise;
+ /**
+ * Finds a key in the keyvault which has the specified keyAltName.
+ *
+ * @param keyAltName - a keyAltName to search for a key
+ * @returns Returns a promise that either resolves to a {@link DataKey} if a document matches the key or null if no documents
+ * match the keyAltName. The promise rejects with an error if an error is thrown.
+ * @example
+ * ```ts
+ * // get a key by alt name
+ * const keyAltName = 'keyAltName';
+ * const key = await clientEncryption.getKeyByAltName(keyAltName);
+ * if (!key) {
+ * // key is null if there is no matching key
+ * }
+ * ```
+ */
+ getKeyByAltName(keyAltName: string): Promise | null>;
+ /**
+ * Adds a keyAltName to a key identified by the provided _id.
+ *
+ * This method resolves to/returns the *old* key value (prior to adding the new altKeyName).
+ *
+ * @param _id - The id of the document to update.
+ * @param keyAltName - a keyAltName to search for a key
+ * @returns Returns a promise that either resolves to a {@link DataKey} if a document matches the key or null if no documents
+ * match the id. The promise rejects with an error if an error is thrown.
+ * @example
+ * ```ts
+ * // adding an keyAltName to a data key
+ * const id = new Binary(); // id is a bson binary subtype 4 object
+ * const keyAltName = 'keyAltName';
+ * const oldKey = await clientEncryption.addKeyAltName(id, keyAltName);
+ * if (!oldKey) {
+ * // null is returned if there is no matching document with an id matching the supplied id
+ * }
+ * ```
+ */
+ addKeyAltName(_id: Binary, keyAltName: string): Promise | null>;
+ /**
+ * Adds a keyAltName to a key identified by the provided _id.
+ *
+ * This method resolves to/returns the *old* key value (prior to removing the new altKeyName).
+ *
+ * If the removed keyAltName is the last keyAltName for that key, the `altKeyNames` property is unset from the document.
+ *
+ * @param _id - The id of the document to update.
+ * @param keyAltName - a keyAltName to search for a key
+ * @returns Returns a promise that either resolves to a {@link DataKey} if a document matches the key or null if no documents
+ * match the id. The promise rejects with an error if an error is thrown.
+ * @example
+ * ```ts
+ * // removing a key alt name from a data key
+ * const id = new Binary(); // id is a bson binary subtype 4 object
+ * const keyAltName = 'keyAltName';
+ * const oldKey = await clientEncryption.removeKeyAltName(id, keyAltName);
+ *
+ * if (!oldKey) {
+ * // null is returned if there is no matching document with an id matching the supplied id
+ * }
+ * ```
+ */
+ removeKeyAltName(_id: Binary, keyAltName: string): Promise | null>;
+ /**
+ * A convenience method for creating an encrypted collection.
+ * This method will create data keys for any encryptedFields that do not have a `keyId` defined
+ * and then create a new collection with the full set of encryptedFields.
+ *
+ * @param db - A Node.js driver Db object with which to create the collection
+ * @param name - The name of the collection to be created
+ * @param options - Options for createDataKey and for createCollection
+ * @returns created collection and generated encryptedFields
+ * @throws MongoCryptCreateDataKeyError - If part way through the process a createDataKey invocation fails, an error will be rejected that has the partial `encryptedFields` that were created.
+ * @throws MongoCryptCreateEncryptedCollectionError - If creating the collection fails, an error will be rejected that has the entire `encryptedFields` that were created.
+ */
+ createEncryptedCollection(db: Db, name: string, options: {
+ provider: ClientEncryptionDataKeyProvider;
+ createCollectionOptions: Omit & {
+ encryptedFields: Document;
+ };
+ masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions;
+ }): Promise<{
+ collection: Collection;
+ encryptedFields: Document;
+ }>;
+ /**
+ * Explicitly encrypt a provided value. Note that either `options.keyId` or `options.keyAltName` must
+ * be specified. Specifying both `options.keyId` and `options.keyAltName` is considered an error.
+ *
+ * @param value - The value that you wish to serialize. Must be of a type that can be serialized into BSON
+ * @param options -
+ * @returns a Promise that either resolves with the encrypted value, or rejects with an error.
+ *
+ * @example
+ * ```ts
+ * // Encryption with async/await api
+ * async function encryptMyData(value) {
+ * const keyId = await clientEncryption.createDataKey('local');
+ * return clientEncryption.encrypt(value, { keyId, algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' });
+ * }
+ * ```
+ *
+ * @example
+ * ```ts
+ * // Encryption using a keyAltName
+ * async function encryptMyData(value) {
+ * await clientEncryption.createDataKey('local', { keyAltNames: 'mySpecialKey' });
+ * return clientEncryption.encrypt(value, { keyAltName: 'mySpecialKey', algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' });
+ * }
+ * ```
+ */
+ encrypt(value: unknown, options: ClientEncryptionEncryptOptions): Promise;
+ /**
+ * Encrypts a Match Expression or Aggregate Expression to query a range index.
+ *
+ * Only supported when queryType is "range" and algorithm is "Range".
+ *
+ * @param expression - a BSON document of one of the following forms:
+ * 1. A Match Expression of this form:
+ * `{$and: [{: {$gt: }}, {: {$lt: }}]}`
+ * 2. An Aggregate Expression of this form:
+ * `{$and: [{$gt: [, ]}, {$lt: [, ]}]}`
+ *
+ * `$gt` may also be `$gte`. `$lt` may also be `$lte`.
+ *
+ * @param options -
+ * @returns Returns a Promise that either resolves with the encrypted value or rejects with an error.
+ */
+ encryptExpression(expression: Document, options: ClientEncryptionEncryptOptions): Promise;
+ /**
+ * Explicitly decrypt a provided encrypted value
+ *
+ * @param value - An encrypted value
+ * @returns a Promise that either resolves with the decrypted value, or rejects with an error
+ *
+ * @example
+ * ```ts
+ * // Decrypting value with async/await API
+ * async function decryptMyValue(value) {
+ * return clientEncryption.decrypt(value);
+ * }
+ * ```
+ */
+ decrypt(value: Binary): Promise;
+ /* Excluded from this release type: askForKMSCredentials */
+ static get libmongocryptVersion(): string;
+ /* Excluded from this release type: _encrypt */
+}
+
+/**
+ * @public
+ * Options to provide when creating a new data key.
+ */
+export declare interface ClientEncryptionCreateDataKeyProviderOptions {
+ /**
+ * Identifies a new KMS-specific key used to encrypt the new data key
+ */
+ masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | KMIPEncryptionKeyOptions | undefined;
+ /**
+ * An optional list of string alternate names used to reference a key.
+ * If a key is created with alternate names, then encryption may refer to the key by the unique alternate name instead of by _id.
+ */
+ keyAltNames?: string[] | undefined;
+ /** @experimental */
+ keyMaterial?: Buffer | Binary;
+ /* Excluded from this release type: timeoutContext */
+}
+
+/**
+ * @public
+ *
+ * A data key provider. Allowed values:
+ *
+ * - aws, gcp, local, kmip or azure
+ * - (`mongodb-client-encryption>=6.0.1` only) a named key, in the form of:
+ * `aws:`, `gcp:`, `local:`, `kmip:`, `azure:`
+ * where `name` is an alphanumeric string, underscores allowed.
+ */
+export declare type ClientEncryptionDataKeyProvider = keyof KMSProviders;
+
+/**
+ * @public
+ * Options to provide when encrypting data.
+ */
+export declare interface ClientEncryptionEncryptOptions {
+ /**
+ * The algorithm to use for encryption.
+ */
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random' | 'Indexed' | 'Unindexed' | 'Range' | 'TextPreview';
+ /**
+ * The id of the Binary dataKey to use for encryption
+ */
+ keyId?: Binary;
+ /**
+ * A unique string name corresponding to an already existing dataKey.
+ */
+ keyAltName?: string;
+ /** The contention factor. */
+ contentionFactor?: bigint | number;
+ /**
+ * The query type.
+ */
+ queryType?: 'equality' | 'range' | 'prefixPreview' | 'suffixPreview' | 'substringPreview';
+ /** The index options for a Queryable Encryption field supporting "range" queries.*/
+ rangeOptions?: RangeOptions;
+ /**
+ * Options for a Queryable Encryption field supporting text queries. Only valid when `algorithm` is `TextPreview`.
+ *
+ * @experimental Public Technical Preview: `textPreview` is an experimental feature and may break at any time.
+ */
+ textOptions?: TextQueryOptions;
+}
+
+/**
+ * @public
+ * Additional settings to provide when creating a new `ClientEncryption` instance.
+ */
+export declare interface ClientEncryptionOptions {
+ /**
+ * The namespace of the key vault, used to store encryption keys
+ */
+ keyVaultNamespace: string;
+ /**
+ * A MongoClient used to fetch keys from a key vault. Defaults to client.
+ */
+ keyVaultClient?: MongoClient | undefined;
+ /**
+ * Options for specific KMS providers to use
+ */
+ kmsProviders?: KMSProviders;
+ /**
+ * Options for user provided custom credential providers.
+ */
+ credentialProviders?: CredentialProviders;
+ /**
+ * Options for specifying a Socks5 proxy to use for connecting to the KMS.
+ */
+ proxyOptions?: ProxyOptions;
+ /**
+ * TLS options for kms providers to use.
+ */
+ tlsOptions?: CSFLEKMSTlsOptions;
+ /**
+ * Sets the expiration time for the DEK in the cache in milliseconds. Defaults to 60000. 0 means no timeout.
+ */
+ keyExpirationMS?: number;
+ /**
+ * @experimental
+ *
+ * The timeout setting to be used for all the operations on ClientEncryption.
+ *
+ * When provided, `timeoutMS` is used as the timeout for each operation executed on
+ * the ClientEncryption object. For example:
+ *
+ * ```typescript
+ * const clientEncryption = new ClientEncryption(client, {
+ * timeoutMS: 1_000
+ * kmsProviders: { local: { key: '' } }
+ * });
+ *
+ * // `1_000` is used as the timeout for createDataKey call
+ * await clientEncryption.createDataKey('local');
+ * ```
+ *
+ * If `timeoutMS` is configured on the provided client, the client's `timeoutMS` value
+ * will be used unless `timeoutMS` is also provided as a client encryption option.
+ *
+ * ```typescript
+ * const client = new MongoClient('', { timeoutMS: 2_000 });
+ *
+ * // timeoutMS is set to 1_000 on clientEncryption
+ * const clientEncryption = new ClientEncryption(client, {
+ * timeoutMS: 1_000
+ * kmsProviders: { local: { key: '' } }
+ * });
+ * ```
+ */
+ timeoutMS?: number;
+}
+
+/**
+ * @public
+ * @experimental
+ */
+export declare interface ClientEncryptionRewrapManyDataKeyProviderOptions {
+ provider: ClientEncryptionDataKeyProvider;
+ masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | KMIPEncryptionKeyOptions | undefined;
+}
+
+/**
+ * @public
+ * @experimental
+ */
+export declare interface ClientEncryptionRewrapManyDataKeyResult {
+ /** The result of rewrapping data keys. If unset, no keys matched the filter. */
+ bulkWriteResult?: BulkWriteResult;
+}
+
+/**
+ * @public
+ *
+ * Socket options to use for KMS requests.
+ */
+export declare type ClientEncryptionSocketOptions = Pick;
+
+/**
+ * @public
+ *
+ * TLS options to use when connecting. The spec specifically calls out which insecure
+ * tls options are not allowed:
+ *
+ * - tlsAllowInvalidCertificates
+ * - tlsAllowInvalidHostnames
+ * - tlsInsecure
+ *
+ * These options are not included in the type, and are ignored if provided.
+ */
+export declare type ClientEncryptionTlsOptions = Pick