typeorm 0.3.25-dev.eb3093d → 0.3.26-dev.01dddfe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/browser/connection/ConnectionOptionsReader.js +1 -1
- package/browser/connection/ConnectionOptionsReader.js.map +1 -1
- package/browser/connection/options-reader/ConnectionOptionsEnvReader.d.ts +1 -1
- package/browser/connection/options-reader/ConnectionOptionsEnvReader.js +1 -1
- package/browser/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
- package/browser/driver/aurora-mysql/AuroraMysqlDriver.d.ts +1 -1
- package/browser/driver/aurora-mysql/AuroraMysqlQueryRunner.js +11 -20
- package/browser/driver/aurora-mysql/AuroraMysqlQueryRunner.js.map +1 -1
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.js +2 -2
- package/browser/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
- package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js +3 -3
- package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachDriver.js +3 -2
- package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/browser/driver/cordova/CordovaQueryRunner.js +1 -1
- package/browser/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/browser/driver/expo/legacy/ExpoLegacyQueryRunner.js +1 -1
- package/browser/driver/expo/legacy/ExpoLegacyQueryRunner.js.map +1 -1
- package/browser/driver/mongodb/MongoDriver.d.ts +1 -1
- package/browser/driver/mongodb/MongoDriver.js +4 -4
- package/browser/driver/mongodb/MongoDriver.js.map +1 -1
- package/browser/driver/mongodb/bson.typings.d.ts +0 -4
- package/browser/driver/mongodb/bson.typings.js +1 -1
- package/browser/driver/mongodb/bson.typings.js.map +1 -1
- package/browser/driver/mongodb/typings.d.ts +7 -10
- package/browser/driver/mongodb/typings.js +2 -2
- package/browser/driver/mongodb/typings.js.map +1 -1
- package/browser/driver/mysql/MysqlDriver.d.ts +1 -1
- package/browser/driver/mysql/MysqlDriver.js +3 -2
- package/browser/driver/mysql/MysqlDriver.js.map +1 -1
- package/browser/driver/mysql/MysqlQueryRunner.js +1 -1
- package/browser/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/browser/driver/nativescript/NativescriptQueryRunner.js +1 -1
- package/browser/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/browser/driver/oracle/OracleDriver.js +3 -7
- package/browser/driver/oracle/OracleDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresDriver.js +4 -5
- package/browser/driver/postgres/PostgresDriver.js.map +1 -1
- package/browser/driver/react-native/ReactNativeDriver.d.ts +1 -1
- package/browser/driver/react-native/ReactNativeQueryRunner.js +1 -1
- package/browser/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/browser/driver/sap/SapDriver.d.ts +1 -1
- package/browser/driver/sap/SapDriver.js +47 -40
- package/browser/driver/sap/SapDriver.js.map +1 -1
- package/browser/driver/sap/SapQueryRunner.js +22 -37
- package/browser/driver/sap/SapQueryRunner.js.map +1 -1
- package/browser/driver/spanner/SpannerDriver.d.ts +1 -1
- package/browser/driver/sqlite/SqliteDriver.js +1 -1
- package/browser/driver/sqlite/SqliteDriver.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +2 -2
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/browser/driver/sqljs/SqljsDriver.d.ts +2 -1
- package/browser/driver/sqlserver/SqlServerDriver.js +3 -2
- package/browser/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/browser/driver/types/ColumnTypes.d.ts +1 -1
- package/browser/driver/types/ColumnTypes.js.map +1 -1
- package/browser/entity-manager/EntityManager.d.ts +1 -1
- package/browser/entity-manager/EntityManager.js +1 -1
- package/browser/entity-manager/EntityManager.js.map +1 -1
- package/browser/entity-manager/MongoEntityManager.js +3 -3
- package/browser/entity-manager/MongoEntityManager.js.map +1 -1
- package/browser/error/InitializedRelationError.d.ts +1 -1
- package/browser/error/InitializedRelationError.js +1 -1
- package/browser/error/InitializedRelationError.js.map +1 -1
- package/browser/logger/FormattedConsoleLogger.js +1 -1
- package/browser/logger/FormattedConsoleLogger.js.map +1 -1
- package/browser/metadata/ColumnMetadata.d.ts +3 -3
- package/browser/metadata/ColumnMetadata.js +1 -1
- package/browser/metadata/ColumnMetadata.js.map +1 -1
- package/browser/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +14 -0
- package/browser/metadata-builder/ClosureJunctionEntityMetadataBuilder.js.map +1 -1
- package/browser/metadata-builder/EntityMetadataValidator.js +2 -4
- package/browser/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/browser/metadata-builder/RelationJoinColumnBuilder.js +7 -0
- package/browser/metadata-builder/RelationJoinColumnBuilder.js.map +1 -1
- package/browser/persistence/SubjectChangedColumnsComputer.js +4 -4
- package/browser/persistence/SubjectChangedColumnsComputer.js.map +1 -1
- package/browser/persistence/SubjectExecutor.js +4 -10
- package/browser/persistence/SubjectExecutor.js.map +1 -1
- package/browser/persistence/SubjectTopologicalSorter.js +5 -4
- package/browser/persistence/SubjectTopologicalSorter.js.map +1 -1
- package/browser/query-builder/RelationLoader.js +2 -0
- package/browser/query-builder/RelationLoader.js.map +1 -1
- package/browser/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/browser/query-runner/QueryLock.js +1 -0
- package/browser/query-runner/QueryLock.js.map +1 -1
- package/browser/util/ImportUtils.d.ts +1 -1
- package/browser/util/ImportUtils.js +2 -1
- package/browser/util/ImportUtils.js.map +1 -1
- package/browser/util/OrmUtils.d.ts +11 -10
- package/browser/util/OrmUtils.js +31 -31
- package/browser/util/OrmUtils.js.map +1 -1
- package/cli.js +3 -1
- package/cli.js.map +1 -1
- package/connection/ConnectionOptionsReader.js +1 -1
- package/connection/ConnectionOptionsReader.js.map +1 -1
- package/connection/options-reader/ConnectionOptionsEnvReader.d.ts +1 -1
- package/connection/options-reader/ConnectionOptionsEnvReader.js +1 -1
- package/connection/options-reader/ConnectionOptionsEnvReader.js.map +1 -1
- package/driver/aurora-mysql/AuroraMysqlDriver.d.ts +1 -1
- package/driver/aurora-mysql/AuroraMysqlQueryRunner.js +11 -20
- package/driver/aurora-mysql/AuroraMysqlQueryRunner.js.map +1 -1
- package/driver/better-sqlite3/BetterSqlite3Driver.js +2 -2
- package/driver/better-sqlite3/BetterSqlite3Driver.js.map +1 -1
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.js +3 -3
- package/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
- package/driver/cockroachdb/CockroachDriver.js +3 -2
- package/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/driver/cordova/CordovaQueryRunner.js +1 -1
- package/driver/cordova/CordovaQueryRunner.js.map +1 -1
- package/driver/expo/legacy/ExpoLegacyQueryRunner.js +1 -1
- package/driver/expo/legacy/ExpoLegacyQueryRunner.js.map +1 -1
- package/driver/mongodb/MongoDriver.d.ts +1 -1
- package/driver/mongodb/MongoDriver.js +4 -4
- package/driver/mongodb/MongoDriver.js.map +1 -1
- package/driver/mongodb/bson.typings.d.ts +0 -4
- package/driver/mongodb/bson.typings.js +0 -1
- package/driver/mongodb/bson.typings.js.map +1 -1
- package/driver/mongodb/typings.d.ts +7 -10
- package/driver/mongodb/typings.js +3 -2
- package/driver/mongodb/typings.js.map +1 -1
- package/driver/mysql/MysqlDriver.d.ts +1 -1
- package/driver/mysql/MysqlDriver.js +3 -2
- package/driver/mysql/MysqlDriver.js.map +1 -1
- package/driver/mysql/MysqlQueryRunner.js +1 -1
- package/driver/mysql/MysqlQueryRunner.js.map +1 -1
- package/driver/nativescript/NativescriptQueryRunner.js +1 -1
- package/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
- package/driver/oracle/OracleDriver.js +3 -7
- package/driver/oracle/OracleDriver.js.map +1 -1
- package/driver/postgres/PostgresDriver.js +4 -5
- package/driver/postgres/PostgresDriver.js.map +1 -1
- package/driver/react-native/ReactNativeDriver.d.ts +1 -1
- package/driver/react-native/ReactNativeQueryRunner.js +1 -1
- package/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
- package/driver/sap/SapDriver.d.ts +1 -1
- package/driver/sap/SapDriver.js +47 -40
- package/driver/sap/SapDriver.js.map +1 -1
- package/driver/sap/SapQueryRunner.js +22 -37
- package/driver/sap/SapQueryRunner.js.map +1 -1
- package/driver/spanner/SpannerDriver.d.ts +1 -1
- package/driver/sqlite/SqliteDriver.js +1 -1
- package/driver/sqlite/SqliteDriver.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +2 -2
- package/driver/sqlite-abstract/AbstractSqliteDriver.js +1 -1
- package/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/driver/sqljs/SqljsDriver.d.ts +2 -1
- package/driver/sqlserver/SqlServerDriver.js +3 -2
- package/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/driver/types/ColumnTypes.d.ts +1 -1
- package/driver/types/ColumnTypes.js.map +1 -1
- package/entity-manager/EntityManager.d.ts +1 -1
- package/entity-manager/EntityManager.js +1 -1
- package/entity-manager/EntityManager.js.map +1 -1
- package/entity-manager/MongoEntityManager.js +3 -3
- package/entity-manager/MongoEntityManager.js.map +1 -1
- package/error/InitializedRelationError.d.ts +1 -1
- package/error/InitializedRelationError.js +1 -1
- package/error/InitializedRelationError.js.map +1 -1
- package/index.mjs +2 -2
- package/logger/FormattedConsoleLogger.js +1 -1
- package/logger/FormattedConsoleLogger.js.map +1 -1
- package/metadata/ColumnMetadata.d.ts +3 -3
- package/metadata/ColumnMetadata.js +1 -1
- package/metadata/ColumnMetadata.js.map +1 -1
- package/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +14 -0
- package/metadata-builder/ClosureJunctionEntityMetadataBuilder.js.map +1 -1
- package/metadata-builder/EntityMetadataValidator.js +2 -4
- package/metadata-builder/EntityMetadataValidator.js.map +1 -1
- package/metadata-builder/RelationJoinColumnBuilder.js +7 -0
- package/metadata-builder/RelationJoinColumnBuilder.js.map +1 -1
- package/package.json +1 -1
- package/persistence/SubjectChangedColumnsComputer.js +4 -4
- package/persistence/SubjectChangedColumnsComputer.js.map +1 -1
- package/persistence/SubjectExecutor.js +4 -10
- package/persistence/SubjectExecutor.js.map +1 -1
- package/persistence/SubjectTopologicalSorter.js +5 -4
- package/persistence/SubjectTopologicalSorter.js.map +1 -1
- package/query-builder/RelationLoader.js +2 -0
- package/query-builder/RelationLoader.js.map +1 -1
- package/query-builder/transformer/RawSqlResultsToEntityTransformer.js.map +1 -1
- package/query-runner/QueryLock.js +1 -0
- package/query-runner/QueryLock.js.map +1 -1
- package/util/ImportUtils.d.ts +1 -1
- package/util/ImportUtils.js +2 -1
- package/util/ImportUtils.js.map +1 -1
- package/util/OrmUtils.d.ts +11 -10
- package/util/OrmUtils.js +31 -31
- package/util/OrmUtils.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/driver/expo/legacy/ExpoLegacyQueryRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAA;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AAEtF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAqBzE;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,yBAAyB;IAWhE,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,MAAwB;QAChC,KAAK,EA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AM,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CACvC,GAAG,EACH,KAAK,EACL,UAAU,EACV,IAAI,CACP,CAAA;oBACD,IAAI,CAAC,WAAW,CAAC,wBAAwB,CACrC,iBAAiB,EACjB,KAAK,EACL,UAAU,EACV,KAAK,EACL,SAAS,EACT,SAAS,EACT,GAAG,CACN,CAAA;oBACD,MAAM,iBAAiB,CAAC,IAAI,EAAE,CAAA;oBAE9B,IAAI,CAAC,IAAI,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,CAAA;gBACtD,CAAC,CACJ,CAAA;YACL,CAAC,EACD,KAAK,EAAE,GAAQ,EAAE,EAAE;gBACf,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAA;gBAChC,IAAI,CAAC,GAAG,CAAC,CAAA;YACb,CAAC,EACD,GAAG,EAAE;gBACD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAA;gBAChC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;YAChC,CAAC,CACJ,CAAA;QACL,CAAC,CAAC,CAAA;IACN,CAAC;CACJ","file":"ExpoLegacyQueryRunner.js","sourcesContent":["import { QueryRunnerAlreadyReleasedError } from \"../../../error/QueryRunnerAlreadyReleasedError\"\nimport { QueryFailedError } from \"../../../error/QueryFailedError\"\nimport { AbstractSqliteQueryRunner } from \"../../sqlite-abstract/AbstractSqliteQueryRunner\"\nimport { TransactionNotStartedError } from \"../../../error/TransactionNotStartedError\"\nimport { ExpoLegacyDriver } from \"./ExpoLegacyDriver\"\nimport { Broadcaster } from \"../../../subscriber/Broadcaster\"\nimport { QueryResult } from \"../../../query-runner/QueryResult\"\nimport { BroadcasterResult } from \"../../../subscriber/BroadcasterResult\"\n\n// Needed to satisfy the Typescript compiler\ninterface IResultSet {\n insertId: number | undefined\n rowsAffected: number\n rows: {\n length: number\n item: (idx: number) => any\n _array: any[]\n }\n}\ninterface ITransaction {\n executeSql: (\n sql: string,\n args: any[] | undefined,\n ok: (tsx: ITransaction, resultSet: IResultSet) => void,\n fail: (tsx: ITransaction, err: any) => void,\n ) => void\n}\n\n/**\n * Runs queries on a single sqlite database connection.\n */\nexport class ExpoLegacyQueryRunner extends AbstractSqliteQueryRunner {\n /**\n * Database driver used by connection.\n */\n driver: ExpoLegacyDriver\n\n /**\n * Database transaction object\n */\n private transaction?: ITransaction\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(driver: ExpoLegacyDriver) {\n super()\n this.driver = driver\n this.connection = driver.connection\n this.broadcaster = new Broadcaster(this)\n }\n\n /**\n * Starts transaction. Within Expo, all database operations happen in a\n * transaction context, so issuing a `BEGIN TRANSACTION` command is\n * redundant and will result in the following error:\n *\n * `Error: Error code 1: cannot start a transaction within a transaction`\n *\n * Instead, we keep track of a `Transaction` object in `this.transaction`\n * and continue using the same object until we wish to commit the\n * transaction.\n */\n async startTransaction(): Promise<void> {\n this.isTransactionActive = true\n try {\n await this.broadcaster.broadcast(\"BeforeTransactionStart\")\n } catch (err) {\n this.isTransactionActive = false\n throw err\n }\n\n this.transactionDepth += 1\n\n await this.broadcaster.broadcast(\"AfterTransactionStart\")\n }\n\n /**\n * Commits transaction.\n * Error will be thrown if transaction was not started.\n * Since Expo will automatically commit the transaction once all the\n * callbacks of the transaction object have been completed, \"committing\" a\n * transaction in this driver's context means that we delete the transaction\n * object and set the stage for the next transaction.\n */\n async commitTransaction(): Promise<void> {\n if (\n !this.isTransactionActive &&\n typeof this.transaction === \"undefined\"\n )\n throw new TransactionNotStartedError()\n\n await this.broadcaster.broadcast(\"BeforeTransactionCommit\")\n\n this.transaction = undefined\n this.isTransactionActive = false\n\n this.transactionDepth -= 1\n\n await this.broadcaster.broadcast(\"AfterTransactionCommit\")\n }\n\n /**\n * Rollbacks transaction.\n * Error will be thrown if transaction was not started.\n * This method's functionality is identical to `commitTransaction()` because\n * the transaction lifecycle is handled within the Expo transaction object.\n * Issuing separate statements for `COMMIT` or `ROLLBACK` aren't necessary.\n */\n async rollbackTransaction(): Promise<void> {\n if (\n !this.isTransactionActive &&\n typeof this.transaction === \"undefined\"\n )\n throw new TransactionNotStartedError()\n\n await this.broadcaster.broadcast(\"BeforeTransactionRollback\")\n\n this.transaction = undefined\n this.isTransactionActive = false\n\n this.transactionDepth -= 1\n\n await this.broadcaster.broadcast(\"AfterTransactionRollback\")\n }\n\n /**\n * Called before migrations are run.\n */\n async beforeMigration(): Promise<void> {\n const databaseConnection = await this.connect()\n return new Promise((ok, fail) => {\n databaseConnection.exec(\n [{ sql: \"PRAGMA foreign_keys = OFF\", args: [] }],\n false,\n (err: any) => (err ? fail(err) : ok()),\n )\n })\n }\n\n /**\n * Called after migrations are run.\n */\n async afterMigration(): Promise<void> {\n const databaseConnection = await this.connect()\n return new Promise((ok, fail) => {\n databaseConnection.exec(\n [{ sql: \"PRAGMA foreign_keys = ON\", args: [] }],\n false,\n (err: any) => (err ? fail(err) : ok()),\n )\n })\n }\n\n /**\n * Executes a given SQL query.\n */\n async query(\n query: string,\n parameters?: any[],\n useStructuredResult = false,\n ): Promise<any> {\n if (this.isReleased) throw new QueryRunnerAlreadyReleasedError()\n\n return new Promise<any>(async (ok, fail) => {\n const databaseConnection = await this.connect()\n const broadcasterResult = new BroadcasterResult()\n\n this.driver.connection.logger.logQuery(query, parameters, this)\n this.broadcaster.broadcastBeforeQueryEvent(\n broadcasterResult,\n query,\n parameters,\n )\n\n const queryStartTime = Date.now()\n // All Expo SQL queries are executed in a transaction context\n databaseConnection.transaction(\n async (transaction: ITransaction) => {\n if (typeof this.transaction === \"undefined\") {\n await this.startTransaction()\n this.transaction = transaction\n }\n this.transaction.executeSql(\n query,\n parameters,\n async (t: ITransaction, raw: IResultSet) => {\n // log slow queries if maxQueryExecution time is set\n const maxQueryExecutionTime =\n this.driver.options.maxQueryExecutionTime\n const queryEndTime = Date.now()\n const queryExecutionTime =\n queryEndTime - queryStartTime\n\n this.broadcaster.broadcastAfterQueryEvent(\n broadcasterResult,\n query,\n parameters,\n true,\n queryExecutionTime,\n raw,\n undefined,\n )\n await broadcasterResult.wait()\n\n if (\n maxQueryExecutionTime &&\n queryExecutionTime > maxQueryExecutionTime\n ) {\n this.driver.connection.logger.logQuerySlow(\n queryExecutionTime,\n query,\n parameters,\n this,\n )\n }\n\n const result = new QueryResult()\n\n if (raw?.hasOwnProperty(\"rowsAffected\")) {\n result.affected = raw.rowsAffected\n }\n\n if (raw?.hasOwnProperty(\"rows\")) {\n let resultSet = []\n for (let i = 0; i < raw.rows.length; i++) {\n resultSet.push(raw.rows.item(i))\n }\n\n result.raw = resultSet\n result.records = resultSet\n }\n\n // return id of inserted row, if query was insert statement.\n if (query.startsWith(\"INSERT INTO\")) {\n result.raw = raw.insertId\n }\n\n if (useStructuredResult) {\n ok(result)\n } else {\n ok(result.raw)\n }\n },\n async (t: ITransaction, err: any) => {\n this.driver.connection.logger.logQueryError(\n err,\n query,\n parameters,\n this,\n )\n this.broadcaster.broadcastAfterQueryEvent(\n broadcasterResult,\n query,\n parameters,\n false,\n undefined,\n undefined,\n err,\n )\n await broadcasterResult.wait()\n\n fail(new QueryFailedError(query, parameters, err))\n },\n )\n },\n async (err: any) => {\n await this.rollbackTransaction()\n fail(err)\n },\n () => {\n this.isTransactionActive = false\n this.transaction = undefined\n },\n )\n })\n }\n}\n"],"sourceRoot":"../../.."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/driver/expo/legacy/ExpoLegacyQueryRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAA;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AAEtF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,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CAAC,MAAM,CAAC,CAAA;oBACd,CAAC;yBAAM,CAAC;wBACJ,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;oBAClB,CAAC;gBACL,CAAC,EACD,KAAK,EAAE,CAAe,EAAE,GAAQ,EAAE,EAAE;oBAChC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CACvC,GAAG,EACH,KAAK,EACL,UAAU,EACV,IAAI,CACP,CAAA;oBACD,IAAI,CAAC,WAAW,CAAC,wBAAwB,CACrC,iBAAiB,EACjB,KAAK,EACL,UAAU,EACV,KAAK,EACL,SAAS,EACT,SAAS,EACT,GAAG,CACN,CAAA;oBACD,MAAM,iBAAiB,CAAC,IAAI,EAAE,CAAA;oBAE9B,IAAI,CAAC,IAAI,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,CAAA;gBACtD,CAAC,CACJ,CAAA;YACL,CAAC,EACD,KAAK,EAAE,GAAQ,EAAE,EAAE;gBACf,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAA;gBAChC,IAAI,CAAC,GAAG,CAAC,CAAA;YACb,CAAC,EACD,GAAG,EAAE;gBACD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAA;gBAChC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;YAChC,CAAC,CACJ,CAAA;QACL,CAAC,CAAC,CAAA;IACN,CAAC;CACJ","file":"ExpoLegacyQueryRunner.js","sourcesContent":["import { QueryRunnerAlreadyReleasedError } from \"../../../error/QueryRunnerAlreadyReleasedError\"\nimport { QueryFailedError } from \"../../../error/QueryFailedError\"\nimport { AbstractSqliteQueryRunner } from \"../../sqlite-abstract/AbstractSqliteQueryRunner\"\nimport { TransactionNotStartedError } from \"../../../error/TransactionNotStartedError\"\nimport { ExpoLegacyDriver } from \"./ExpoLegacyDriver\"\nimport { Broadcaster } from \"../../../subscriber/Broadcaster\"\nimport { QueryResult } from \"../../../query-runner/QueryResult\"\nimport { BroadcasterResult } from \"../../../subscriber/BroadcasterResult\"\n\n// Needed to satisfy the Typescript compiler\ninterface IResultSet {\n insertId: number | undefined\n rowsAffected: number\n rows: {\n length: number\n item: (idx: number) => any\n _array: any[]\n }\n}\ninterface ITransaction {\n executeSql: (\n sql: string,\n args: any[] | undefined,\n ok: (tsx: ITransaction, resultSet: IResultSet) => void,\n fail: (tsx: ITransaction, err: any) => void,\n ) => void\n}\n\n/**\n * Runs queries on a single sqlite database connection.\n */\nexport class ExpoLegacyQueryRunner extends AbstractSqliteQueryRunner {\n /**\n * Database driver used by connection.\n */\n driver: ExpoLegacyDriver\n\n /**\n * Database transaction object\n */\n private transaction?: ITransaction\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(driver: ExpoLegacyDriver) {\n super()\n this.driver = driver\n this.connection = driver.connection\n this.broadcaster = new Broadcaster(this)\n }\n\n /**\n * Starts transaction. Within Expo, all database operations happen in a\n * transaction context, so issuing a `BEGIN TRANSACTION` command is\n * redundant and will result in the following error:\n *\n * `Error: Error code 1: cannot start a transaction within a transaction`\n *\n * Instead, we keep track of a `Transaction` object in `this.transaction`\n * and continue using the same object until we wish to commit the\n * transaction.\n */\n async startTransaction(): Promise<void> {\n this.isTransactionActive = true\n try {\n await this.broadcaster.broadcast(\"BeforeTransactionStart\")\n } catch (err) {\n this.isTransactionActive = false\n throw err\n }\n\n this.transactionDepth += 1\n\n await this.broadcaster.broadcast(\"AfterTransactionStart\")\n }\n\n /**\n * Commits transaction.\n * Error will be thrown if transaction was not started.\n * Since Expo will automatically commit the transaction once all the\n * callbacks of the transaction object have been completed, \"committing\" a\n * transaction in this driver's context means that we delete the transaction\n * object and set the stage for the next transaction.\n */\n async commitTransaction(): Promise<void> {\n if (\n !this.isTransactionActive &&\n typeof this.transaction === \"undefined\"\n )\n throw new TransactionNotStartedError()\n\n await this.broadcaster.broadcast(\"BeforeTransactionCommit\")\n\n this.transaction = undefined\n this.isTransactionActive = false\n\n this.transactionDepth -= 1\n\n await this.broadcaster.broadcast(\"AfterTransactionCommit\")\n }\n\n /**\n * Rollbacks transaction.\n * Error will be thrown if transaction was not started.\n * This method's functionality is identical to `commitTransaction()` because\n * the transaction lifecycle is handled within the Expo transaction object.\n * Issuing separate statements for `COMMIT` or `ROLLBACK` aren't necessary.\n */\n async rollbackTransaction(): Promise<void> {\n if (\n !this.isTransactionActive &&\n typeof this.transaction === \"undefined\"\n )\n throw new TransactionNotStartedError()\n\n await this.broadcaster.broadcast(\"BeforeTransactionRollback\")\n\n this.transaction = undefined\n this.isTransactionActive = false\n\n this.transactionDepth -= 1\n\n await this.broadcaster.broadcast(\"AfterTransactionRollback\")\n }\n\n /**\n * Called before migrations are run.\n */\n async beforeMigration(): Promise<void> {\n const databaseConnection = await this.connect()\n return new Promise((ok, fail) => {\n databaseConnection.exec(\n [{ sql: \"PRAGMA foreign_keys = OFF\", args: [] }],\n false,\n (err: any) => (err ? fail(err) : ok()),\n )\n })\n }\n\n /**\n * Called after migrations are run.\n */\n async afterMigration(): Promise<void> {\n const databaseConnection = await this.connect()\n return new Promise((ok, fail) => {\n databaseConnection.exec(\n [{ sql: \"PRAGMA foreign_keys = ON\", args: [] }],\n false,\n (err: any) => (err ? fail(err) : ok()),\n )\n })\n }\n\n /**\n * Executes a given SQL query.\n */\n async query(\n query: string,\n parameters?: any[],\n useStructuredResult = false,\n ): Promise<any> {\n if (this.isReleased) throw new QueryRunnerAlreadyReleasedError()\n\n return new Promise<any>(async (ok, fail) => {\n const databaseConnection = await this.connect()\n const broadcasterResult = new BroadcasterResult()\n\n this.driver.connection.logger.logQuery(query, parameters, this)\n this.broadcaster.broadcastBeforeQueryEvent(\n broadcasterResult,\n query,\n parameters,\n )\n\n const queryStartTime = Date.now()\n // All Expo SQL queries are executed in a transaction context\n databaseConnection.transaction(\n async (transaction: ITransaction) => {\n if (typeof this.transaction === \"undefined\") {\n await this.startTransaction()\n this.transaction = transaction\n }\n this.transaction.executeSql(\n query,\n parameters,\n async (t: ITransaction, raw: IResultSet) => {\n // log slow queries if maxQueryExecution time is set\n const maxQueryExecutionTime =\n this.driver.options.maxQueryExecutionTime\n const queryEndTime = Date.now()\n const queryExecutionTime =\n queryEndTime - queryStartTime\n\n this.broadcaster.broadcastAfterQueryEvent(\n broadcasterResult,\n query,\n parameters,\n true,\n queryExecutionTime,\n raw,\n undefined,\n )\n await broadcasterResult.wait()\n\n if (\n maxQueryExecutionTime &&\n queryExecutionTime > maxQueryExecutionTime\n ) {\n this.driver.connection.logger.logQuerySlow(\n queryExecutionTime,\n query,\n parameters,\n this,\n )\n }\n\n const result = new QueryResult()\n\n if (raw?.hasOwnProperty(\"rowsAffected\")) {\n result.affected = raw.rowsAffected\n }\n\n if (raw?.hasOwnProperty(\"rows\")) {\n const resultSet = []\n for (let i = 0; i < raw.rows.length; i++) {\n resultSet.push(raw.rows.item(i))\n }\n\n result.raw = resultSet\n result.records = resultSet\n }\n\n // return id of inserted row, if query was insert statement.\n if (query.startsWith(\"INSERT INTO\")) {\n result.raw = raw.insertId\n }\n\n if (useStructuredResult) {\n ok(result)\n } else {\n ok(result.raw)\n }\n },\n async (t: ITransaction, err: any) => {\n this.driver.connection.logger.logQueryError(\n err,\n query,\n parameters,\n this,\n )\n this.broadcaster.broadcastAfterQueryEvent(\n broadcasterResult,\n query,\n parameters,\n false,\n undefined,\n undefined,\n err,\n )\n await broadcasterResult.wait()\n\n fail(new QueryFailedError(query, parameters, err))\n },\n )\n },\n async (err: any) => {\n await this.rollbackTransaction()\n fail(err)\n },\n () => {\n this.isTransactionActive = false\n this.transaction = undefined\n },\n )\n })\n }\n}\n"],"sourceRoot":"../../.."}
|
|
@@ -183,7 +183,7 @@ export declare class MongoDriver implements Driver {
|
|
|
183
183
|
/**
|
|
184
184
|
* Creates generated map of values generated or returned by database after INSERT query.
|
|
185
185
|
*/
|
|
186
|
-
createGeneratedMap(metadata: EntityMetadata, insertedId: any):
|
|
186
|
+
createGeneratedMap(metadata: EntityMetadata, insertedId: any): ObjectLiteral;
|
|
187
187
|
/**
|
|
188
188
|
* Differentiate columns of this table and columns from the given column metadatas columns
|
|
189
189
|
* and returns only changed.
|
|
@@ -170,12 +170,12 @@ export class MongoDriver {
|
|
|
170
170
|
* Closes connection with the database.
|
|
171
171
|
*/
|
|
172
172
|
async disconnect() {
|
|
173
|
-
|
|
173
|
+
const queryRunner = this.queryRunner;
|
|
174
|
+
if (!queryRunner) {
|
|
174
175
|
throw new ConnectionIsNotSetError("mongodb");
|
|
175
|
-
|
|
176
|
-
this.queryRunner.databaseConnection.close();
|
|
176
|
+
}
|
|
177
177
|
this.queryRunner = undefined;
|
|
178
|
-
|
|
178
|
+
await queryRunner.databaseConnection.close();
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Creates a schema builder used to build and sync a schema.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/driver/mongodb/MongoDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAK5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAK5E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D;;GAEG;AACH,MAAM,OAAO,WAAW;IAwLpB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QA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YACxB,YAAY,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;QACrD,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QAE1C,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ","file":"MongoDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { ConnectionIsNotSetError } from \"../../error/ConnectionIsNotSetError\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { MongoQueryRunner } from \"./MongoQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source/DataSource\"\nimport { MongoConnectionOptions } from \"./MongoConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { MongoSchemaBuilder } from \"../../schema-builder/MongoSchemaBuilder\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { DataSourceOptions } from \"../../data-source/DataSourceOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { ObjectUtils } from \"../../util/ObjectUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\n\n/**\n * Organizes communication with MongoDB.\n */\nexport class MongoDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Underlying mongodb library.\n */\n mongodb: any\n\n /**\n * Mongodb does not require to dynamically create query runner each time,\n * because it does not have a regular connection pool as RDBMS systems have.\n */\n queryRunner?: MongoQueryRunner\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: MongoConnectionOptions\n\n /**\n * Master database used to perform all write queries.\n */\n database?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = false\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"none\" as const\n\n /**\n * Mongodb does not need to have column types because they are not used in schema sync.\n */\n supportedDataTypes: ColumnType[] = []\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[]\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = []\n\n /**\n * Mongodb does not need to have a strong defined mapped column types because they are not used in schema sync.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"int\",\n createDateDefault: \"\",\n updateDate: \"int\",\n updateDateDefault: \"\",\n deleteDate: \"int\",\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"int\",\n migrationTimestamp: \"int\",\n cacheId: \"int\",\n cacheIdentifier: \"int\",\n cacheTime: \"int\",\n cacheDuration: \"int\",\n cacheQuery: \"int\",\n cacheResult: \"int\",\n metadataType: \"int\",\n metadataDatabase: \"int\",\n metadataSchema: \"int\",\n metadataTable: \"int\",\n metadataName: \"int\",\n metadataValue: \"int\",\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults\n\n /**\n * No documentation specifying a maximum length for identifiers could be found\n * for MongoDB.\n */\n maxAliasLength?: number\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\n }\n\n // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep in sync with MongoConnectionOptions\n */\n protected validOptionNames: string[] = [\n \"appName\",\n \"authMechanism\",\n \"authSource\",\n \"autoEncryption\",\n \"checkServerIdentity\",\n \"compressors\",\n \"connectTimeoutMS\",\n \"directConnection\",\n \"family\",\n \"forceServerObjectId\",\n \"ignoreUndefined\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"localThresholdMS\",\n \"maxStalenessSeconds\",\n \"minPoolSize\",\n \"monitorCommands\",\n \"noDelay\",\n \"pkFactory\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"promoteValues\",\n \"raw\",\n \"readConcern\",\n \"readPreference\",\n \"readPreferenceTags\",\n \"replicaSet\",\n \"retryWrites\",\n \"serializeFunctions\",\n \"socketTimeoutMS\",\n \"ssl\",\n \"sslCA\",\n \"sslCRL\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslValidate\",\n \"tls\",\n \"tlsAllowInvalidCertificates\",\n \"tlsCAFile\",\n \"tlsCertificateKeyFile\",\n \"tlsCertificateKeyFilePassword\",\n \"w\",\n \"writeConcern\",\n \"wtimeoutMS\",\n // Undocumented deprecated options\n // todo: remove next major version\n \"appname\",\n \"fsync\",\n \"j\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"wtimeout\",\n ]\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n this.options = connection.options as MongoConnectionOptions\n\n // validate options to make sure everything is correct and driver will be able to establish connection\n this.validateOptions(connection.options)\n\n // load mongodb package\n this.loadDependencies()\n\n this.database = DriverUtils.buildMongoDBDriverOptions(\n this.options,\n ).database\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n async connect(): Promise<void> {\n const options = DriverUtils.buildMongoDBDriverOptions(this.options)\n\n const client = await this.mongodb.MongoClient.connect(\n this.buildConnectionUrl(options),\n this.buildConnectionOptions(options),\n )\n\n this.queryRunner = new MongoQueryRunner(this.connection, client)\n ObjectUtils.assign(this.queryRunner, {\n manager: this.connection.manager,\n })\n }\n\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {\n if (!this.queryRunner) throw new ConnectionIsNotSetError(\"mongodb\")\n // const handler = (err: any) => (err ? fail(err) : ok())\n this.queryRunner.databaseConnection.close()\n this.queryRunner = undefined\n // return ok()\n }\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new MongoSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return this.queryRunner!\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n throw new TypeORMError(\n `This operation is not supported by Mongodb driver.`,\n )\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return columnName\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n return tableName\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { tableName: string; schema?: string; database?: string } {\n if (InstanceChecker.isEntityMetadata(target)) {\n return {\n tableName: target.tableName,\n }\n }\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n return {\n tableName: target.name,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n return {\n tableName: target.referencedTableName,\n }\n }\n\n return {\n tableName: target,\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type?: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertedId: any) {\n return metadata.objectIdColumn!.createValueMap(insertedId)\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Validate driver options to make sure everything is correct and driver will be able to establish connection.\n */\n protected validateOptions(options: DataSourceOptions) {\n // todo: fix\n // if (!options.url) {\n // if (!options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // }\n }\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): any {\n try {\n const mongodb = this.options.driver || PlatformTools.load(\"mongodb\")\n this.mongodb = mongodb\n } catch (e) {\n throw new DriverPackageNotInstalledError(\"MongoDB\", \"mongodb\")\n }\n }\n\n /**\n * Builds connection url that is passed to underlying driver to perform connection to the mongodb database.\n */\n protected buildConnectionUrl(options: { [key: string]: any }): string {\n const schemaUrlPart = options.type.toLowerCase()\n const credentialsUrlPart =\n options.username && options.password\n ? `${encodeURIComponent(options.username)}:${encodeURIComponent(\n options.password,\n )}@`\n : \"\"\n\n const portUrlPart =\n schemaUrlPart === \"mongodb+srv\" ? \"\" : `:${options.port || \"27017\"}`\n\n let connectionString: string\n if (options.replicaSet) {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.hostReplicaSet ||\n options.host + portUrlPart ||\n \"127.0.0.1\" + portUrlPart\n }/${options.database || \"\"}`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}`\n }\n\n return connectionString\n }\n\n /**\n * Build connection options from MongoConnectionOptions\n */\n protected buildConnectionOptions(options: { [key: string]: any }): any {\n const mongoOptions: any = {}\n\n for (const optionName of this.validOptionNames) {\n if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\n\n mongoOptions.driverInfo = {\n name: \"TypeORM\",\n }\n\n if (\"poolSize\" in options) {\n mongoOptions[\"maxPoolSize\"] = options[\"poolSize\"]\n }\n\n Object.assign(mongoOptions, options.extra)\n\n return mongoOptions\n }\n}\n"],"sourceRoot":"../.."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/driver/mongodb/MongoDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAK5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAK5E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D;;GAEG;AACH,MAAM,OAAO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AY,CAAC,UAAU,GAAG;YACtB,IAAI,EAAE,SAAS;SAClB,CAAA;QAED,IAAI,UAAU,IAAI,OAAO,EAAE,CAAC;YACxB,YAAY,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;QACrD,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QAE1C,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ","file":"MongoDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { ConnectionIsNotSetError } from \"../../error/ConnectionIsNotSetError\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { MongoQueryRunner } from \"./MongoQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source/DataSource\"\nimport { MongoConnectionOptions } from \"./MongoConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { MongoSchemaBuilder } from \"../../schema-builder/MongoSchemaBuilder\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { DataSourceOptions } from \"../../data-source/DataSourceOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { ObjectUtils } from \"../../util/ObjectUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\n\n/**\n * Organizes communication with MongoDB.\n */\nexport class MongoDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Underlying mongodb library.\n */\n mongodb: any\n\n /**\n * Mongodb does not require to dynamically create query runner each time,\n * because it does not have a regular connection pool as RDBMS systems have.\n */\n queryRunner?: MongoQueryRunner\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: MongoConnectionOptions\n\n /**\n * Master database used to perform all write queries.\n */\n database?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = false\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"none\" as const\n\n /**\n * Mongodb does not need to have column types because they are not used in schema sync.\n */\n supportedDataTypes: ColumnType[] = []\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[]\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = []\n\n /**\n * Mongodb does not need to have a strong defined mapped column types because they are not used in schema sync.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"int\",\n createDateDefault: \"\",\n updateDate: \"int\",\n updateDateDefault: \"\",\n deleteDate: \"int\",\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"int\",\n migrationTimestamp: \"int\",\n cacheId: \"int\",\n cacheIdentifier: \"int\",\n cacheTime: \"int\",\n cacheDuration: \"int\",\n cacheQuery: \"int\",\n cacheResult: \"int\",\n metadataType: \"int\",\n metadataDatabase: \"int\",\n metadataSchema: \"int\",\n metadataTable: \"int\",\n metadataName: \"int\",\n metadataValue: \"int\",\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults\n\n /**\n * No documentation specifying a maximum length for identifiers could be found\n * for MongoDB.\n */\n maxAliasLength?: number\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\n }\n\n // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep in sync with MongoConnectionOptions\n */\n protected validOptionNames: string[] = [\n \"appName\",\n \"authMechanism\",\n \"authSource\",\n \"autoEncryption\",\n \"checkServerIdentity\",\n \"compressors\",\n \"connectTimeoutMS\",\n \"directConnection\",\n \"family\",\n \"forceServerObjectId\",\n \"ignoreUndefined\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"localThresholdMS\",\n \"maxStalenessSeconds\",\n \"minPoolSize\",\n \"monitorCommands\",\n \"noDelay\",\n \"pkFactory\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"promoteValues\",\n \"raw\",\n \"readConcern\",\n \"readPreference\",\n \"readPreferenceTags\",\n \"replicaSet\",\n \"retryWrites\",\n \"serializeFunctions\",\n \"socketTimeoutMS\",\n \"ssl\",\n \"sslCA\",\n \"sslCRL\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslValidate\",\n \"tls\",\n \"tlsAllowInvalidCertificates\",\n \"tlsCAFile\",\n \"tlsCertificateKeyFile\",\n \"tlsCertificateKeyFilePassword\",\n \"w\",\n \"writeConcern\",\n \"wtimeoutMS\",\n // Undocumented deprecated options\n // todo: remove next major version\n \"appname\",\n \"fsync\",\n \"j\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"wtimeout\",\n ]\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n this.options = connection.options as MongoConnectionOptions\n\n // validate options to make sure everything is correct and driver will be able to establish connection\n this.validateOptions(connection.options)\n\n // load mongodb package\n this.loadDependencies()\n\n this.database = DriverUtils.buildMongoDBDriverOptions(\n this.options,\n ).database\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n async connect(): Promise<void> {\n const options = DriverUtils.buildMongoDBDriverOptions(this.options)\n\n const client = await this.mongodb.MongoClient.connect(\n this.buildConnectionUrl(options),\n this.buildConnectionOptions(options),\n )\n\n this.queryRunner = new MongoQueryRunner(this.connection, client)\n ObjectUtils.assign(this.queryRunner, {\n manager: this.connection.manager,\n })\n }\n\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {\n const queryRunner = this.queryRunner\n if (!queryRunner) {\n throw new ConnectionIsNotSetError(\"mongodb\")\n }\n\n this.queryRunner = undefined\n await queryRunner.databaseConnection.close()\n }\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new MongoSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return this.queryRunner!\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n throw new TypeORMError(\n `This operation is not supported by Mongodb driver.`,\n )\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return columnName\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n return tableName\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { tableName: string; schema?: string; database?: string } {\n if (InstanceChecker.isEntityMetadata(target)) {\n return {\n tableName: target.tableName,\n }\n }\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n return {\n tableName: target.name,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n return {\n tableName: target.referencedTableName,\n }\n }\n\n return {\n tableName: target,\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type?: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertedId: any) {\n return metadata.objectIdColumn!.createValueMap(insertedId)\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Validate driver options to make sure everything is correct and driver will be able to establish connection.\n */\n protected validateOptions(options: DataSourceOptions) {\n // todo: fix\n // if (!options.url) {\n // if (!options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // }\n }\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): any {\n try {\n const mongodb = this.options.driver || PlatformTools.load(\"mongodb\")\n this.mongodb = mongodb\n } catch (e) {\n throw new DriverPackageNotInstalledError(\"MongoDB\", \"mongodb\")\n }\n }\n\n /**\n * Builds connection url that is passed to underlying driver to perform connection to the mongodb database.\n */\n protected buildConnectionUrl(options: { [key: string]: any }): string {\n const schemaUrlPart = options.type.toLowerCase()\n const credentialsUrlPart =\n options.username && options.password\n ? `${encodeURIComponent(options.username)}:${encodeURIComponent(\n options.password,\n )}@`\n : \"\"\n\n const portUrlPart =\n schemaUrlPart === \"mongodb+srv\" ? \"\" : `:${options.port || \"27017\"}`\n\n let connectionString: string\n if (options.replicaSet) {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.hostReplicaSet ||\n options.host + portUrlPart ||\n \"127.0.0.1\" + portUrlPart\n }/${options.database || \"\"}`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}`\n }\n\n return connectionString\n }\n\n /**\n * Build connection options from MongoConnectionOptions\n */\n protected buildConnectionOptions(options: { [key: string]: any }): any {\n const mongoOptions: any = {}\n\n for (const optionName of this.validOptionNames) {\n if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\n\n mongoOptions.driverInfo = {\n name: \"TypeORM\",\n }\n\n if (\"poolSize\" in options) {\n mongoOptions[\"maxPoolSize\"] = options[\"poolSize\"]\n }\n\n Object.assign(mongoOptions, options.extra)\n\n return mongoOptions\n }\n}\n"],"sourceRoot":"../.."}
|
|
@@ -92,10 +92,6 @@ export declare interface BinaryExtendedLegacy {
|
|
|
92
92
|
}
|
|
93
93
|
/** @public */
|
|
94
94
|
export declare type BinarySequence = Uint8Array | number[];
|
|
95
|
-
declare namespace BSON {
|
|
96
|
-
export { setInternalBufferSize, serialize, serializeWithBufferAndIndex, deserialize, calculateObjectSize, deserializeStream, UUIDExtended, BinaryExtended, BinaryExtendedLegacy, BinarySequence, CodeExtended, DBRefLike, Decimal128Extended, DoubleExtended, EJSONOptions, 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, BSONValue, BSONError, BSONVersionError, BSONRuntimeError, BSONType, EJSON, Document, CalculateObjectSizeOptions, };
|
|
97
|
-
}
|
|
98
|
-
export { BSON };
|
|
99
95
|
/**
|
|
100
96
|
* @public
|
|
101
97
|
* @category Error
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/driver/mongodb/bson.typings.ts"],"names":[],"mappings":"AA6JA,OAAO,EAAE,IAAI,EAAE,CAAA","file":"bson.typings.js","sourcesContent":["/**\n * A class representation of the BSON Binary type.\n * @public\n * @category BSONType\n */\nexport declare class Binary extends BSONValue {\n get _bsontype(): \"Binary\"\n /* Excluded from this release type: BSON_BINARY_SUBTYPE_DEFAULT */\n /** Initial buffer default size */\n static readonly BUFFER_SIZE = 256\n /** Default BSON type */\n static readonly SUBTYPE_DEFAULT = 0\n /** Function BSON type */\n static readonly SUBTYPE_FUNCTION = 1\n /** Byte Array BSON type */\n static readonly SUBTYPE_BYTE_ARRAY = 2\n /** Deprecated UUID BSON type @deprecated Please use SUBTYPE_UUID */\n static readonly SUBTYPE_UUID_OLD = 3\n /** UUID BSON type */\n static readonly SUBTYPE_UUID = 4\n /** MD5 BSON type */\n static readonly SUBTYPE_MD5 = 5\n /** Encrypted BSON type */\n static readonly SUBTYPE_ENCRYPTED = 6\n /** Column BSON type */\n static readonly SUBTYPE_COLUMN = 7\n /** User BSON type */\n static readonly SUBTYPE_USER_DEFINED = 128\n buffer: Uint8Array\n sub_type: number\n position: number\n /**\n * Create a new Binary instance.\n *\n * This constructor can accept a string as its first argument. In this case,\n * this string will be encoded using ISO-8859-1, **not** using UTF-8.\n * This is almost certainly not what you want. Use `new Binary(Buffer.from(string))`\n * instead to convert the string to a Buffer using UTF-8 first.\n *\n * @param buffer - a buffer object containing the binary data.\n * @param subType - the option binary type.\n */\n constructor(buffer?: string | BinarySequence, subType?: number)\n /**\n * Updates this binary with byte_value.\n *\n * @param byteValue - a single byte we wish to write.\n */\n put(byteValue: string | number | Uint8Array | number[]): void\n /**\n * Writes a buffer or string to the binary.\n *\n * @param sequence - a string or buffer to be written to the Binary BSON object.\n * @param offset - specify the binary of where to write the content.\n */\n write(sequence: string | BinarySequence, offset: number): void\n /**\n * Reads **length** bytes starting at **position**.\n *\n * @param position - read from the given position in the Binary.\n * @param length - the number of bytes to read.\n */\n read(position: number, length: number): BinarySequence\n /**\n * Returns the value of this binary as a string.\n * @param asRaw - Will skip converting to a string\n * @remarks\n * This is handy when calling this function conditionally for some key value pairs and not others\n */\n value(asRaw?: boolean): string | BinarySequence\n /** the length of the binary sequence */\n length(): number\n toJSON(): string\n toString(encoding?: \"hex\" | \"base64\" | \"utf8\" | \"utf-8\"): string\n /* Excluded from this release type: toExtendedJSON */\n toUUID(): UUID\n /** Creates an Binary instance from a hex digit string */\n static createFromHexString(hex: string, subType?: number): Binary\n /** Creates an Binary instance from a base64 string */\n static createFromBase64(base64: string, subType?: number): Binary\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface BinaryExtended {\n $binary: {\n subType: string\n base64: string\n }\n}\n\n/** @public */\nexport declare interface BinaryExtendedLegacy {\n $type: string\n $binary: string\n}\n\n/** @public */\nexport declare type BinarySequence = Uint8Array | number[]\n\ndeclare namespace BSON {\n export {\n setInternalBufferSize,\n serialize,\n serializeWithBufferAndIndex,\n deserialize,\n calculateObjectSize,\n deserializeStream,\n UUIDExtended,\n BinaryExtended,\n BinaryExtendedLegacy,\n BinarySequence,\n CodeExtended,\n DBRefLike,\n Decimal128Extended,\n DoubleExtended,\n EJSONOptions,\n Int32Extended,\n LongExtended,\n MaxKeyExtended,\n MinKeyExtended,\n ObjectIdExtended,\n ObjectIdLike,\n BSONRegExpExtended,\n BSONRegExpExtendedLegacy,\n BSONSymbolExtended,\n LongWithoutOverrides,\n TimestampExtended,\n TimestampOverrides,\n LongWithoutOverridesClass,\n SerializeOptions,\n DeserializeOptions,\n Code,\n BSONSymbol,\n DBRef,\n Binary,\n ObjectId,\n UUID,\n Long,\n Timestamp,\n Double,\n Int32,\n MinKey,\n MaxKey,\n BSONRegExp,\n Decimal128,\n BSONValue,\n BSONError,\n BSONVersionError,\n BSONRuntimeError,\n BSONType,\n EJSON,\n Document,\n CalculateObjectSizeOptions,\n }\n}\nexport { BSON }\n\n/**\n * @public\n * @category Error\n *\n * `BSONError` objects are thrown when BSON ecounters an error.\n *\n * This is the parent class for all the other errors thrown by this library.\n */\nexport declare class BSONError extends Error {\n /* Excluded from this release type: bsonError */\n get name(): string\n constructor(message: string)\n /**\n * @public\n *\n * All errors thrown from the BSON library inherit from `BSONError`.\n * This method can assist with determining if an error originates from the BSON library\n * even if it does not pass an `instanceof` check against this class' constructor.\n *\n * @param value - any javascript value that needs type checking\n */\n static isBSONError(value: unknown): value is BSONError\n}\n\n/**\n * A class representation of the BSON RegExp type.\n * @public\n * @category BSONType\n */\nexport declare class BSONRegExp extends BSONValue {\n get _bsontype(): \"BSONRegExp\"\n pattern: string\n options: string\n /**\n * @param pattern - The regular expression pattern to match\n * @param options - The regular expression options\n */\n constructor(pattern: string, options?: string)\n static parseOptions(options?: string): string\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface BSONRegExpExtended {\n $regularExpression: {\n pattern: string\n options: string\n }\n}\n\n/** @public */\nexport declare interface BSONRegExpExtendedLegacy {\n $regex: string | BSONRegExp\n $options: string\n}\n\n/**\n * @public\n * @category Error\n *\n * An error generated when BSON functions encounter an unexpected input\n * or reaches an unexpected/invalid internal state\n *\n */\nexport declare class BSONRuntimeError extends BSONError {\n get name(): \"BSONRuntimeError\"\n constructor(message: string)\n}\n\n/**\n * A class representation of the BSON Symbol type.\n * @public\n * @category BSONType\n */\nexport declare class BSONSymbol extends BSONValue {\n get _bsontype(): \"BSONSymbol\"\n value: string\n /**\n * @param value - the string representing the symbol.\n */\n constructor(value: string)\n /** Access the wrapped string value. */\n valueOf(): string\n toString(): string\n inspect(): string\n toJSON(): string\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n}\n\n/** @public */\nexport declare interface BSONSymbolExtended {\n $symbol: string\n}\n\n/** @public */\nexport declare const BSONType: Readonly<{\n readonly double: 1\n readonly string: 2\n readonly object: 3\n readonly array: 4\n readonly binData: 5\n readonly undefined: 6\n readonly objectId: 7\n readonly bool: 8\n readonly date: 9\n readonly null: 10\n readonly regex: 11\n readonly dbPointer: 12\n readonly javascript: 13\n readonly symbol: 14\n readonly javascriptWithScope: 15\n readonly int: 16\n readonly timestamp: 17\n readonly long: 18\n readonly decimal: 19\n readonly minKey: -1\n readonly maxKey: 127\n}>\n\n/** @public */\nexport declare type BSONType = (typeof BSONType)[keyof typeof BSONType]\n\n/** @public */\nexport declare abstract class BSONValue {\n /** @public */\n abstract get _bsontype(): string\n /** @public */\n abstract inspect(): string\n /* Excluded from this release type: toExtendedJSON */\n}\n\n/**\n * @public\n * @category Error\n */\nexport declare class BSONVersionError extends BSONError {\n get name(): \"BSONVersionError\"\n constructor()\n}\n\n/**\n * Calculate the bson size for a passed in Javascript object.\n *\n * @param object - the Javascript object to calculate the BSON byte size for\n * @returns size of BSON object in bytes\n * @public\n */\nexport declare function calculateObjectSize(\n object: Document,\n options?: CalculateObjectSizeOptions,\n): number\n\n/** @public */\nexport declare type CalculateObjectSizeOptions = Pick<\n SerializeOptions,\n \"serializeFunctions\" | \"ignoreUndefined\"\n>\n\n/**\n * A class representation of the BSON Code type.\n * @public\n * @category BSONType\n */\nexport declare class Code extends BSONValue {\n get _bsontype(): \"Code\"\n code: string\n scope: Document | null\n /**\n * @param code - a string or function.\n * @param scope - an optional scope for the function.\n */\n constructor(code: string | Function, scope?: Document | null)\n toJSON(): {\n code: string\n scope?: Document\n }\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface CodeExtended {\n $code: string\n $scope?: Document\n}\n\n/**\n * A class representation of the BSON DBRef type.\n * @public\n * @category BSONType\n */\nexport declare class DBRef extends BSONValue {\n get _bsontype(): \"DBRef\"\n collection: string\n oid: ObjectId\n db?: string\n fields: Document\n /**\n * @param collection - the collection name.\n * @param oid - the reference ObjectId.\n * @param db - optional db name, if omitted the reference is local to the current db.\n */\n constructor(\n collection: string,\n oid: ObjectId,\n db?: string,\n fields?: Document,\n )\n /* Excluded from this release type: namespace */\n /* Excluded from this release type: namespace */\n toJSON(): DBRefLike & Document\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface DBRefLike {\n $ref: string\n $id: ObjectId\n $db?: string\n}\n\n/**\n * A class representation of the BSON Decimal128 type.\n * @public\n * @category BSONType\n */\nexport declare class Decimal128 extends BSONValue {\n get _bsontype(): \"Decimal128\"\n readonly bytes: Uint8Array\n /**\n * @param bytes - a buffer containing the raw Decimal128 bytes in little endian order,\n * or a string representation as returned by .toString()\n */\n constructor(bytes: Uint8Array | string)\n /**\n * Create a Decimal128 instance from a string representation\n *\n * @param representation - a numeric string representation.\n */\n static fromString(representation: string): Decimal128\n /** Create a string representation of the raw Decimal128 value */\n toString(): string\n toJSON(): Decimal128Extended\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface Decimal128Extended {\n $numberDecimal: string\n}\n\n/**\n * Deserialize data as BSON.\n *\n * @param buffer - the buffer containing the serialized set of BSON documents.\n * @returns returns the deserialized Javascript Object.\n * @public\n */\nexport declare function deserialize(\n buffer: Uint8Array,\n options?: DeserializeOptions,\n): Document\n\n/** @public */\nexport declare interface DeserializeOptions {\n /** when deserializing a Long will return as a BigInt. */\n useBigInt64?: boolean\n /** when deserializing a Long will fit it into a Number if it's smaller than 53 bits. */\n promoteLongs?: boolean\n /** when deserializing a Binary will return it as a node.js Buffer instance. */\n promoteBuffers?: boolean\n /** when deserializing will promote BSON values to their Node.js closest equivalent types. */\n promoteValues?: boolean\n /** allow to specify if there what fields we wish to return as unserialized raw buffer. */\n fieldsAsRaw?: Document\n /** return BSON regular expressions as BSONRegExp instances. */\n bsonRegExp?: boolean\n /** allows the buffer to be larger than the parsed BSON object. */\n allowObjectSmallerThanBufferSize?: boolean\n /** Offset into buffer to begin reading document from */\n index?: number\n raw?: boolean\n /** Allows for opt-out utf-8 validation for all keys or\n * specified keys. Must be all true or all false.\n *\n * @example\n * ```js\n * // disables validation on all keys\n * validation: { utf8: false }\n *\n * // enables validation only on specified keys a, b, and c\n * validation: { utf8: { a: true, b: true, c: true } }\n *\n * // disables validation only on specified keys a, b\n * validation: { utf8: { a: false, b: false } }\n * ```\n */\n validation?: {\n utf8: boolean | Record<string, true> | Record<string, false>\n }\n}\n\n/**\n * Deserialize stream data as BSON documents.\n *\n * @param data - the buffer containing the serialized set of BSON documents.\n * @param startIndex - the start index in the data Buffer where the deserialization is to start.\n * @param numberOfDocuments - number of documents to deserialize.\n * @param documents - an array where to store the deserialized documents.\n * @param docStartIndex - the index in the documents array from where to start inserting documents.\n * @param options - additional options used for the deserialization.\n * @returns next index in the buffer after deserialization **x** numbers of documents.\n * @public\n */\nexport declare function deserializeStream(\n data: Uint8Array | ArrayBuffer,\n startIndex: number,\n numberOfDocuments: number,\n documents: Document[],\n docStartIndex: number,\n options: DeserializeOptions,\n): number\n\n/** @public */\nexport declare interface Document {\n [key: string]: any\n}\n\n/**\n * A class representation of the BSON Double type.\n * @public\n * @category BSONType\n */\nexport declare class Double extends BSONValue {\n get _bsontype(): \"Double\"\n value: number\n /**\n * Create a Double type\n *\n * @param value - the number we want to represent as a double.\n */\n constructor(value: number)\n /**\n * Access the number value.\n *\n * @returns returns the wrapped double number.\n */\n valueOf(): number\n toJSON(): number\n toString(radix?: number): string\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface DoubleExtended {\n $numberDouble: string\n}\n\n/** @public */\nexport declare const EJSON: {\n parse: typeof parse\n stringify: typeof stringify\n serialize: typeof EJSONserialize\n deserialize: typeof EJSONdeserialize\n}\n\n/**\n * Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types\n *\n * @param ejson - The Extended JSON object to deserialize\n * @param options - Optional settings passed to the parse method\n */\ndeclare function EJSONdeserialize(ejson: Document, options?: EJSONOptions): any\n\n/** @public */\nexport declare type EJSONOptions = {\n /** Output using the Extended JSON v1 spec */\n legacy?: boolean\n /** Enable Extended JSON's `relaxed` mode, which attempts to return native JS types where possible, rather than BSON types */\n relaxed?: boolean\n /** Enable native bigint support */\n useBigInt64?: boolean\n}\n\n/**\n * Serializes an object to an Extended JSON string, and reparse it as a JavaScript object.\n *\n * @param value - The object to serialize\n * @param options - Optional settings passed to the `stringify` function\n */\ndeclare function EJSONserialize(value: any, options?: EJSONOptions): Document\n\n/**\n * A class representation of a BSON Int32 type.\n * @public\n * @category BSONType\n */\nexport declare class Int32 extends BSONValue {\n get _bsontype(): \"Int32\"\n value: number\n /**\n * Create an Int32 type\n *\n * @param value - the number we want to represent as an int32.\n */\n constructor(value: number | string)\n /**\n * Access the number value.\n *\n * @returns returns the wrapped int32 number.\n */\n valueOf(): number\n toString(radix?: number): string\n toJSON(): number\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface Int32Extended {\n $numberInt: string\n}\n\ndeclare const kId: unique symbol\n\n/**\n * A class representing a 64-bit integer\n * @public\n * @category BSONType\n * @remarks\n * The internal representation of a long is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16 bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n * Common constant values ZERO, ONE, NEG_ONE, etc. are found as static properties on this class.\n */\nexport declare class Long extends BSONValue {\n get _bsontype(): \"Long\"\n /** An indicator used to reliably determine if an object is a Long or not. */\n get __isLong__(): boolean\n /**\n * The high 32 bits as a signed value.\n */\n high: number\n /**\n * The low 32 bits as a signed value.\n */\n low: number\n /**\n * Whether unsigned or not.\n */\n unsigned: boolean\n /**\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\n * See the from* functions below for more convenient ways of constructing Longs.\n *\n * Acceptable signatures are:\n * - Long(low, high, unsigned?)\n * - Long(bigint, unsigned?)\n * - Long(string, unsigned?)\n *\n * @param low - The low (signed) 32 bits of the long\n * @param high - The high (signed) 32 bits of the long\n * @param unsigned - Whether unsigned or not, defaults to signed\n */\n constructor(\n low?: number | bigint | string,\n high?: number | boolean,\n unsigned?: boolean,\n )\n static TWO_PWR_24: Long\n /** Maximum unsigned value. */\n static MAX_UNSIGNED_VALUE: Long\n /** Signed zero */\n static ZERO: Long\n /** Unsigned zero. */\n static UZERO: Long\n /** Signed one. */\n static ONE: Long\n /** Unsigned one. */\n static UONE: Long\n /** Signed negative one. */\n static NEG_ONE: Long\n /** Maximum signed value. */\n static MAX_VALUE: Long\n /** Minimum signed value. */\n static MIN_VALUE: Long\n /**\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits.\n * Each is assumed to use 32 bits.\n * @param lowBits - The low 32 bits\n * @param highBits - The high 32 bits\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long\n /**\n * Returns a Long representing the given 32 bit integer value.\n * @param value - The 32 bit integer in question\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromInt(value: number, unsigned?: boolean): Long\n /**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n * @param value - The number in question\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromNumber(value: number, unsigned?: boolean): Long\n /**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n * @param value - The number in question\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromBigInt(value: bigint, unsigned?: boolean): Long\n /**\n * Returns a Long representation of the given string, written using the specified radix.\n * @param str - The textual representation of the Long\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @param radix - The radix in which the text is written (2-36), defaults to 10\n * @returns The corresponding Long value\n */\n static fromString(str: string, unsigned?: boolean, radix?: number): Long\n /**\n * Creates a Long from its byte representation.\n * @param bytes - Byte representation\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @param le - Whether little or big endian, defaults to big endian\n * @returns The corresponding Long value\n */\n static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long\n /**\n * Creates a Long from its little endian byte representation.\n * @param bytes - Little endian byte representation\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromBytesLE(bytes: number[], unsigned?: boolean): Long\n /**\n * Creates a Long from its big endian byte representation.\n * @param bytes - Big endian byte representation\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromBytesBE(bytes: number[], unsigned?: boolean): Long\n /**\n * Tests if the specified object is a Long.\n */\n static isLong(value: unknown): value is Long\n /**\n * Converts the specified value to a Long.\n * @param unsigned - Whether unsigned or not, defaults to signed\n */\n static fromValue(\n val:\n | number\n | string\n | {\n low: number\n high: number\n unsigned?: boolean\n },\n unsigned?: boolean,\n ): Long\n /** Returns the sum of this and the specified Long. */\n add(addend: string | number | Long | Timestamp): Long\n /**\n * Returns the sum of this and the specified Long.\n * @returns Sum\n */\n and(other: string | number | Long | Timestamp): Long\n /**\n * Compares this Long's value with the specified's.\n * @returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater\n */\n compare(other: string | number | Long | Timestamp): 0 | 1 | -1\n /** This is an alias of {@link Long.compare} */\n comp(other: string | number | Long | Timestamp): 0 | 1 | -1\n /**\n * Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned.\n * @returns Quotient\n */\n divide(divisor: string | number | Long | Timestamp): Long\n /**This is an alias of {@link Long.divide} */\n div(divisor: string | number | Long | Timestamp): Long\n /**\n * Tests if this Long's value equals the specified's.\n * @param other - Other value\n */\n equals(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.equals} */\n eq(other: string | number | Long | Timestamp): boolean\n /** Gets the high 32 bits as a signed integer. */\n getHighBits(): number\n /** Gets the high 32 bits as an unsigned integer. */\n getHighBitsUnsigned(): number\n /** Gets the low 32 bits as a signed integer. */\n getLowBits(): number\n /** Gets the low 32 bits as an unsigned integer. */\n getLowBitsUnsigned(): number\n /** Gets the number of bits needed to represent the absolute value of this Long. */\n getNumBitsAbs(): number\n /** Tests if this Long's value is greater than the specified's. */\n greaterThan(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.greaterThan} */\n gt(other: string | number | Long | Timestamp): boolean\n /** Tests if this Long's value is greater than or equal the specified's. */\n greaterThanOrEqual(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.greaterThanOrEqual} */\n gte(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.greaterThanOrEqual} */\n ge(other: string | number | Long | Timestamp): boolean\n /** Tests if this Long's value is even. */\n isEven(): boolean\n /** Tests if this Long's value is negative. */\n isNegative(): boolean\n /** Tests if this Long's value is odd. */\n isOdd(): boolean\n /** Tests if this Long's value is positive. */\n isPositive(): boolean\n /** Tests if this Long's value equals zero. */\n isZero(): boolean\n /** Tests if this Long's value is less than the specified's. */\n lessThan(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long#lessThan}. */\n lt(other: string | number | Long | Timestamp): boolean\n /** Tests if this Long's value is less than or equal the specified's. */\n lessThanOrEqual(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.lessThanOrEqual} */\n lte(other: string | number | Long | Timestamp): boolean\n /** Returns this Long modulo the specified. */\n modulo(divisor: string | number | Long | Timestamp): Long\n /** This is an alias of {@link Long.modulo} */\n mod(divisor: string | number | Long | Timestamp): Long\n /** This is an alias of {@link Long.modulo} */\n rem(divisor: string | number | Long | Timestamp): Long\n /**\n * Returns the product of this and the specified Long.\n * @param multiplier - Multiplier\n * @returns Product\n */\n multiply(multiplier: string | number | Long | Timestamp): Long\n /** This is an alias of {@link Long.multiply} */\n mul(multiplier: string | number | Long | Timestamp): Long\n /** Returns the Negation of this Long's value. */\n negate(): Long\n /** This is an alias of {@link Long.negate} */\n neg(): Long\n /** Returns the bitwise NOT of this Long. */\n not(): Long\n /** Tests if this Long's value differs from the specified's. */\n notEquals(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.notEquals} */\n neq(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.notEquals} */\n ne(other: string | number | Long | Timestamp): boolean\n /**\n * Returns the bitwise OR of this Long and the specified.\n */\n or(other: number | string | Long): Long\n /**\n * Returns this Long with bits shifted to the left by the given amount.\n * @param numBits - Number of bits\n * @returns Shifted Long\n */\n shiftLeft(numBits: number | Long): Long\n /** This is an alias of {@link Long.shiftLeft} */\n shl(numBits: number | Long): Long\n /**\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\n * @param numBits - Number of bits\n * @returns Shifted Long\n */\n shiftRight(numBits: number | Long): Long\n /** This is an alias of {@link Long.shiftRight} */\n shr(numBits: number | Long): Long\n /**\n * Returns this Long with bits logically shifted to the right by the given amount.\n * @param numBits - Number of bits\n * @returns Shifted Long\n */\n shiftRightUnsigned(numBits: Long | number): Long\n /** This is an alias of {@link Long.shiftRightUnsigned} */\n shr_u(numBits: number | Long): Long\n /** This is an alias of {@link Long.shiftRightUnsigned} */\n shru(numBits: number | Long): Long\n /**\n * Returns the difference of this and the specified Long.\n * @param subtrahend - Subtrahend\n * @returns Difference\n */\n subtract(subtrahend: string | number | Long | Timestamp): Long\n /** This is an alias of {@link Long.subtract} */\n sub(subtrahend: string | number | Long | Timestamp): Long\n /** Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. */\n toInt(): number\n /** Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). */\n toNumber(): number\n /** Converts the Long to a BigInt (arbitrary precision). */\n toBigInt(): bigint\n /**\n * Converts this Long to its byte representation.\n * @param le - Whether little or big endian, defaults to big endian\n * @returns Byte representation\n */\n toBytes(le?: boolean): number[]\n /**\n * Converts this Long to its little endian byte representation.\n * @returns Little endian byte representation\n */\n toBytesLE(): number[]\n /**\n * Converts this Long to its big endian byte representation.\n * @returns Big endian byte representation\n */\n toBytesBE(): number[]\n /**\n * Converts this Long to signed.\n */\n toSigned(): Long\n /**\n * Converts the Long to a string written in the specified radix.\n * @param radix - Radix (2-36), defaults to 10\n * @throws RangeError If `radix` is out of range\n */\n toString(radix?: number): string\n /** Converts this Long to unsigned. */\n toUnsigned(): Long\n /** Returns the bitwise XOR of this Long and the given one. */\n xor(other: Long | number | string): Long\n /** This is an alias of {@link Long.isZero} */\n eqz(): boolean\n /** This is an alias of {@link Long.lessThanOrEqual} */\n le(other: string | number | Long | Timestamp): boolean\n toExtendedJSON(options?: EJSONOptions): number | LongExtended\n static fromExtendedJSON(\n doc: {\n $numberLong: string\n },\n options?: EJSONOptions,\n ): number | Long | bigint\n inspect(): string\n}\n\n/** @public */\nexport declare interface LongExtended {\n $numberLong: string\n}\n\n/** @public */\nexport declare type LongWithoutOverrides = new (\n low: unknown,\n high?: number | boolean,\n unsigned?: boolean,\n) => {\n [P in Exclude<keyof Long, TimestampOverrides>]: Long[P]\n}\n\n/** @public */\nexport declare const LongWithoutOverridesClass: LongWithoutOverrides\n\n/**\n * A class representation of the BSON MaxKey type.\n * @public\n * @category BSONType\n */\nexport declare class MaxKey extends BSONValue {\n get _bsontype(): \"MaxKey\"\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface MaxKeyExtended {\n $maxKey: 1\n}\n\n/**\n * A class representation of the BSON MinKey type.\n * @public\n * @category BSONType\n */\nexport declare class MinKey extends BSONValue {\n get _bsontype(): \"MinKey\"\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface MinKeyExtended {\n $minKey: 1\n}\n\n/**\n * A class representation of the BSON ObjectId type.\n * @public\n * @category BSONType\n */\nexport declare class ObjectId extends BSONValue {\n get _bsontype(): \"ObjectId\"\n /* Excluded from this release type: index */\n static cacheHexString: boolean\n /* Excluded from this release type: [kId] */\n /* Excluded from this release type: __id */\n /**\n * Create an ObjectId type\n *\n * @param inputId - Can be a 24 character hex string, 12 byte binary Buffer, or a number.\n */\n constructor(\n inputId?: string | number | ObjectId | ObjectIdLike | Uint8Array,\n )\n /**\n * The ObjectId bytes\n * @readonly\n */\n get id(): Uint8Array\n set id(value: Uint8Array)\n /** Returns the ObjectId id as a 24 character hex string representation */\n toHexString(): string\n /* Excluded from this release type: getInc */\n /**\n * Generate a 12 byte id buffer used in ObjectId's\n *\n * @param time - pass in a second based timestamp.\n */\n static generate(time?: number): Uint8Array\n /**\n * Converts the id into a 24 character hex string for printing, unless encoding is provided.\n * @param encoding - hex or base64\n */\n toString(encoding?: \"hex\" | \"base64\"): string\n /** Converts to its JSON the 24 character hex string representation. */\n toJSON(): string\n /**\n * Compares the equality of this ObjectId with `otherID`.\n *\n * @param otherId - ObjectId instance to compare against.\n */\n equals(otherId: string | ObjectId | ObjectIdLike): boolean\n /** Returns the generation date (accurate up to the second) that this ID was generated. */\n getTimestamp(): Date\n /* Excluded from this release type: createPk */\n /**\n * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.\n *\n * @param time - an integer number representing a number of seconds.\n */\n static createFromTime(time: number): ObjectId\n /**\n * Creates an ObjectId from a hex string representation of an ObjectId.\n *\n * @param hexString - create a ObjectId from a passed in 24 character hexstring.\n */\n static createFromHexString(hexString: string): ObjectId\n /** Creates an ObjectId instance from a base64 string */\n static createFromBase64(base64: string): ObjectId\n /**\n * Checks if a value is a valid bson ObjectId\n *\n * @param id - ObjectId instance to validate.\n */\n static isValid(\n id: string | number | ObjectId | ObjectIdLike | Uint8Array,\n ): boolean\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface ObjectIdExtended {\n $oid: string\n}\n\n/** @public */\nexport declare interface ObjectIdLike {\n id: string | Uint8Array\n __id?: string\n toHexString(): string\n}\n\n/**\n * Parse an Extended JSON string, constructing the JavaScript value or object described by that\n * string.\n *\n * @example\n * ```js\n * const { EJSON } = require('bson');\n * const text = '{ \"int32\": { \"$numberInt\": \"10\" } }';\n *\n * // prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }\n * console.log(EJSON.parse(text, { relaxed: false }));\n *\n * // prints { int32: 10 }\n * console.log(EJSON.parse(text));\n * ```\n */\ndeclare function parse(text: string, options?: EJSONOptions): any\n\n/**\n * Serialize a Javascript object.\n *\n * @param object - the Javascript object to serialize.\n * @returns Buffer object containing the serialized object.\n * @public\n */\nexport declare function serialize(\n object: Document,\n options?: SerializeOptions,\n): Uint8Array\n\n/** @public */\nexport declare interface SerializeOptions {\n /** the serializer will check if keys are valid. */\n checkKeys?: boolean\n /** serialize the javascript functions **(default:false)**. */\n serializeFunctions?: boolean\n /** serialize will not emit undefined fields **(default:true)** */\n ignoreUndefined?: boolean\n /* Excluded from this release type: minInternalBufferSize */\n /** the index in the buffer where we wish to start serializing into */\n index?: number\n}\n\n/**\n * Serialize a Javascript object using a predefined Buffer and index into the buffer,\n * useful when pre-allocating the space for serialization.\n *\n * @param object - the Javascript object to serialize.\n * @param finalBuffer - the Buffer you pre-allocated to store the serialized BSON object.\n * @returns the index pointing to the last written byte in the buffer.\n * @public\n */\nexport declare function serializeWithBufferAndIndex(\n object: Document,\n finalBuffer: Uint8Array,\n options?: SerializeOptions,\n): number\n\n/**\n * Sets the size of the internal serialization buffer.\n *\n * @param size - The desired size for the internal serialization buffer\n * @public\n */\nexport declare function setInternalBufferSize(size: number): void\n\n/**\n * Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer\n * function is specified or optionally including only the specified properties if a replacer array\n * is specified.\n *\n * @param value - The value to convert to extended JSON\n * @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\n * @param space - A String or Number object that's used to insert white space into the output JSON string for readability purposes.\n * @param options - Optional settings\n *\n * @example\n * ```js\n * const { EJSON } = require('bson');\n * const Int32 = require('mongodb').Int32;\n * const doc = { int32: new Int32(10) };\n *\n * // prints '{\"int32\":{\"$numberInt\":\"10\"}}'\n * console.log(EJSON.stringify(doc, { relaxed: false }));\n *\n * // prints '{\"int32\":10}'\n * console.log(EJSON.stringify(doc));\n * ```\n */\ndeclare function stringify(\n value: any,\n replacer?:\n | (number | string)[]\n | ((this: any, key: string, value: any) => any)\n | EJSONOptions,\n space?: string | number,\n options?: EJSONOptions,\n): string\n\n/**\n * @public\n * @category BSONType\n * */\nexport declare class Timestamp extends LongWithoutOverridesClass {\n get _bsontype(): \"Timestamp\"\n static readonly MAX_VALUE: Long\n /**\n * @param int - A 64-bit bigint representing the Timestamp.\n */\n constructor(int: bigint)\n /**\n * @param long - A 64-bit Long representing the Timestamp.\n */\n constructor(long: Long)\n /**\n * @param value - A pair of two values indicating timestamp and increment.\n */\n constructor(value: { t: number; i: number })\n toJSON(): {\n $timestamp: string\n }\n /** Returns a Timestamp represented by the given (32-bit) integer value. */\n static fromInt(value: number): Timestamp\n /** Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned. */\n static fromNumber(value: number): Timestamp\n /**\n * Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits.\n *\n * @param lowBits - the low 32-bits.\n * @param highBits - the high 32-bits.\n */\n static fromBits(lowBits: number, highBits: number): Timestamp\n /**\n * Returns a Timestamp from the given string, optionally using the given radix.\n *\n * @param str - the textual representation of the Timestamp.\n * @param optRadix - the radix in which the text is written.\n */\n static fromString(str: string, optRadix: number): Timestamp\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface TimestampExtended {\n $timestamp: {\n t: number\n i: number\n }\n}\n\n/** @public */\nexport declare type TimestampOverrides =\n | \"_bsontype\"\n | \"toExtendedJSON\"\n | \"fromExtendedJSON\"\n | \"inspect\"\n\n/**\n * A class representation of the BSON UUID type.\n * @public\n */\nexport declare class UUID extends Binary {\n static cacheHexString: boolean\n /* Excluded from this release type: __id */\n /**\n * Create an UUID type\n *\n * @param input - Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer.\n */\n constructor(input?: string | Uint8Array | UUID)\n /**\n * The UUID bytes\n * @readonly\n */\n get id(): Uint8Array\n set id(value: Uint8Array)\n /**\n * Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)\n * @param includeDashes - should the string exclude dash-separators.\n * */\n toHexString(includeDashes?: boolean): string\n /**\n * Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified.\n */\n toString(encoding?: \"hex\" | \"base64\"): string\n /**\n * Converts the id into its JSON string representation.\n * A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n */\n toJSON(): string\n /**\n * Compares the equality of this UUID with `otherID`.\n *\n * @param otherId - UUID instance to compare against.\n */\n equals(otherId: string | Uint8Array | UUID): boolean\n /**\n * Creates a Binary instance from the current UUID.\n */\n toBinary(): Binary\n /**\n * Generates a populated buffer containing a v4 uuid\n */\n static generate(): Uint8Array\n /**\n * Checks if a value is a valid bson UUID\n * @param input - UUID, string or Buffer to validate.\n */\n static isValid(input: string | Uint8Array | UUID): boolean\n /**\n * Creates an UUID from a hex string representation of an UUID.\n * @param hexString - 32 or 36 character hex string (dashes excluded/included).\n */\n static createFromHexString(hexString: string): UUID\n /** Creates an UUID from a base64 string representation of an UUID. */\n static createFromBase64(base64: string): UUID\n inspect(): string\n}\n\n/** @public */\nexport declare type UUIDExtended = {\n $uuid: string\n}\n\nexport {}\n"],"sourceRoot":"../.."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/driver/mongodb/bson.typings.ts"],"names":[],"mappings":"","file":"bson.typings.js","sourcesContent":["/**\n * A class representation of the BSON Binary type.\n * @public\n * @category BSONType\n */\nexport declare class Binary extends BSONValue {\n get _bsontype(): \"Binary\"\n /* Excluded from this release type: BSON_BINARY_SUBTYPE_DEFAULT */\n /** Initial buffer default size */\n static readonly BUFFER_SIZE = 256\n /** Default BSON type */\n static readonly SUBTYPE_DEFAULT = 0\n /** Function BSON type */\n static readonly SUBTYPE_FUNCTION = 1\n /** Byte Array BSON type */\n static readonly SUBTYPE_BYTE_ARRAY = 2\n /** Deprecated UUID BSON type @deprecated Please use SUBTYPE_UUID */\n static readonly SUBTYPE_UUID_OLD = 3\n /** UUID BSON type */\n static readonly SUBTYPE_UUID = 4\n /** MD5 BSON type */\n static readonly SUBTYPE_MD5 = 5\n /** Encrypted BSON type */\n static readonly SUBTYPE_ENCRYPTED = 6\n /** Column BSON type */\n static readonly SUBTYPE_COLUMN = 7\n /** User BSON type */\n static readonly SUBTYPE_USER_DEFINED = 128\n buffer: Uint8Array\n sub_type: number\n position: number\n /**\n * Create a new Binary instance.\n *\n * This constructor can accept a string as its first argument. In this case,\n * this string will be encoded using ISO-8859-1, **not** using UTF-8.\n * This is almost certainly not what you want. Use `new Binary(Buffer.from(string))`\n * instead to convert the string to a Buffer using UTF-8 first.\n *\n * @param buffer - a buffer object containing the binary data.\n * @param subType - the option binary type.\n */\n constructor(buffer?: string | BinarySequence, subType?: number)\n /**\n * Updates this binary with byte_value.\n *\n * @param byteValue - a single byte we wish to write.\n */\n put(byteValue: string | number | Uint8Array | number[]): void\n /**\n * Writes a buffer or string to the binary.\n *\n * @param sequence - a string or buffer to be written to the Binary BSON object.\n * @param offset - specify the binary of where to write the content.\n */\n write(sequence: string | BinarySequence, offset: number): void\n /**\n * Reads **length** bytes starting at **position**.\n *\n * @param position - read from the given position in the Binary.\n * @param length - the number of bytes to read.\n */\n read(position: number, length: number): BinarySequence\n /**\n * Returns the value of this binary as a string.\n * @param asRaw - Will skip converting to a string\n * @remarks\n * This is handy when calling this function conditionally for some key value pairs and not others\n */\n value(asRaw?: boolean): string | BinarySequence\n /** the length of the binary sequence */\n length(): number\n toJSON(): string\n toString(encoding?: \"hex\" | \"base64\" | \"utf8\" | \"utf-8\"): string\n /* Excluded from this release type: toExtendedJSON */\n toUUID(): UUID\n /** Creates an Binary instance from a hex digit string */\n static createFromHexString(hex: string, subType?: number): Binary\n /** Creates an Binary instance from a base64 string */\n static createFromBase64(base64: string, subType?: number): Binary\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface BinaryExtended {\n $binary: {\n subType: string\n base64: string\n }\n}\n\n/** @public */\nexport declare interface BinaryExtendedLegacy {\n $type: string\n $binary: string\n}\n\n/** @public */\nexport declare type BinarySequence = Uint8Array | number[]\n\n/**\n * @public\n * @category Error\n *\n * `BSONError` objects are thrown when BSON ecounters an error.\n *\n * This is the parent class for all the other errors thrown by this library.\n */\nexport declare class BSONError extends Error {\n /* Excluded from this release type: bsonError */\n get name(): string\n constructor(message: string)\n /**\n * @public\n *\n * All errors thrown from the BSON library inherit from `BSONError`.\n * This method can assist with determining if an error originates from the BSON library\n * even if it does not pass an `instanceof` check against this class' constructor.\n *\n * @param value - any javascript value that needs type checking\n */\n static isBSONError(value: unknown): value is BSONError\n}\n\n/**\n * A class representation of the BSON RegExp type.\n * @public\n * @category BSONType\n */\nexport declare class BSONRegExp extends BSONValue {\n get _bsontype(): \"BSONRegExp\"\n pattern: string\n options: string\n /**\n * @param pattern - The regular expression pattern to match\n * @param options - The regular expression options\n */\n constructor(pattern: string, options?: string)\n static parseOptions(options?: string): string\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface BSONRegExpExtended {\n $regularExpression: {\n pattern: string\n options: string\n }\n}\n\n/** @public */\nexport declare interface BSONRegExpExtendedLegacy {\n $regex: string | BSONRegExp\n $options: string\n}\n\n/**\n * @public\n * @category Error\n *\n * An error generated when BSON functions encounter an unexpected input\n * or reaches an unexpected/invalid internal state\n *\n */\nexport declare class BSONRuntimeError extends BSONError {\n get name(): \"BSONRuntimeError\"\n constructor(message: string)\n}\n\n/**\n * A class representation of the BSON Symbol type.\n * @public\n * @category BSONType\n */\nexport declare class BSONSymbol extends BSONValue {\n get _bsontype(): \"BSONSymbol\"\n value: string\n /**\n * @param value - the string representing the symbol.\n */\n constructor(value: string)\n /** Access the wrapped string value. */\n valueOf(): string\n toString(): string\n inspect(): string\n toJSON(): string\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n}\n\n/** @public */\nexport declare interface BSONSymbolExtended {\n $symbol: string\n}\n\n/** @public */\nexport declare const BSONType: Readonly<{\n readonly double: 1\n readonly string: 2\n readonly object: 3\n readonly array: 4\n readonly binData: 5\n readonly undefined: 6\n readonly objectId: 7\n readonly bool: 8\n readonly date: 9\n readonly null: 10\n readonly regex: 11\n readonly dbPointer: 12\n readonly javascript: 13\n readonly symbol: 14\n readonly javascriptWithScope: 15\n readonly int: 16\n readonly timestamp: 17\n readonly long: 18\n readonly decimal: 19\n readonly minKey: -1\n readonly maxKey: 127\n}>\n\n/** @public */\nexport declare type BSONType = (typeof BSONType)[keyof typeof BSONType]\n\n/** @public */\nexport declare abstract class BSONValue {\n /** @public */\n abstract get _bsontype(): string\n /** @public */\n abstract inspect(): string\n /* Excluded from this release type: toExtendedJSON */\n}\n\n/**\n * @public\n * @category Error\n */\nexport declare class BSONVersionError extends BSONError {\n get name(): \"BSONVersionError\"\n constructor()\n}\n\n/**\n * Calculate the bson size for a passed in Javascript object.\n *\n * @param object - the Javascript object to calculate the BSON byte size for\n * @returns size of BSON object in bytes\n * @public\n */\nexport declare function calculateObjectSize(\n object: Document,\n options?: CalculateObjectSizeOptions,\n): number\n\n/** @public */\nexport declare type CalculateObjectSizeOptions = Pick<\n SerializeOptions,\n \"serializeFunctions\" | \"ignoreUndefined\"\n>\n\n/**\n * A class representation of the BSON Code type.\n * @public\n * @category BSONType\n */\nexport declare class Code extends BSONValue {\n get _bsontype(): \"Code\"\n code: string\n scope: Document | null\n /**\n * @param code - a string or function.\n * @param scope - an optional scope for the function.\n */\n constructor(code: string | Function, scope?: Document | null)\n toJSON(): {\n code: string\n scope?: Document\n }\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface CodeExtended {\n $code: string\n $scope?: Document\n}\n\n/**\n * A class representation of the BSON DBRef type.\n * @public\n * @category BSONType\n */\nexport declare class DBRef extends BSONValue {\n get _bsontype(): \"DBRef\"\n collection: string\n oid: ObjectId\n db?: string\n fields: Document\n /**\n * @param collection - the collection name.\n * @param oid - the reference ObjectId.\n * @param db - optional db name, if omitted the reference is local to the current db.\n */\n constructor(\n collection: string,\n oid: ObjectId,\n db?: string,\n fields?: Document,\n )\n /* Excluded from this release type: namespace */\n /* Excluded from this release type: namespace */\n toJSON(): DBRefLike & Document\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface DBRefLike {\n $ref: string\n $id: ObjectId\n $db?: string\n}\n\n/**\n * A class representation of the BSON Decimal128 type.\n * @public\n * @category BSONType\n */\nexport declare class Decimal128 extends BSONValue {\n get _bsontype(): \"Decimal128\"\n readonly bytes: Uint8Array\n /**\n * @param bytes - a buffer containing the raw Decimal128 bytes in little endian order,\n * or a string representation as returned by .toString()\n */\n constructor(bytes: Uint8Array | string)\n /**\n * Create a Decimal128 instance from a string representation\n *\n * @param representation - a numeric string representation.\n */\n static fromString(representation: string): Decimal128\n /** Create a string representation of the raw Decimal128 value */\n toString(): string\n toJSON(): Decimal128Extended\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface Decimal128Extended {\n $numberDecimal: string\n}\n\n/**\n * Deserialize data as BSON.\n *\n * @param buffer - the buffer containing the serialized set of BSON documents.\n * @returns returns the deserialized Javascript Object.\n * @public\n */\nexport declare function deserialize(\n buffer: Uint8Array,\n options?: DeserializeOptions,\n): Document\n\n/** @public */\nexport declare interface DeserializeOptions {\n /** when deserializing a Long will return as a BigInt. */\n useBigInt64?: boolean\n /** when deserializing a Long will fit it into a Number if it's smaller than 53 bits. */\n promoteLongs?: boolean\n /** when deserializing a Binary will return it as a node.js Buffer instance. */\n promoteBuffers?: boolean\n /** when deserializing will promote BSON values to their Node.js closest equivalent types. */\n promoteValues?: boolean\n /** allow to specify if there what fields we wish to return as unserialized raw buffer. */\n fieldsAsRaw?: Document\n /** return BSON regular expressions as BSONRegExp instances. */\n bsonRegExp?: boolean\n /** allows the buffer to be larger than the parsed BSON object. */\n allowObjectSmallerThanBufferSize?: boolean\n /** Offset into buffer to begin reading document from */\n index?: number\n raw?: boolean\n /** Allows for opt-out utf-8 validation for all keys or\n * specified keys. Must be all true or all false.\n *\n * @example\n * ```js\n * // disables validation on all keys\n * validation: { utf8: false }\n *\n * // enables validation only on specified keys a, b, and c\n * validation: { utf8: { a: true, b: true, c: true } }\n *\n * // disables validation only on specified keys a, b\n * validation: { utf8: { a: false, b: false } }\n * ```\n */\n validation?: {\n utf8: boolean | Record<string, true> | Record<string, false>\n }\n}\n\n/**\n * Deserialize stream data as BSON documents.\n *\n * @param data - the buffer containing the serialized set of BSON documents.\n * @param startIndex - the start index in the data Buffer where the deserialization is to start.\n * @param numberOfDocuments - number of documents to deserialize.\n * @param documents - an array where to store the deserialized documents.\n * @param docStartIndex - the index in the documents array from where to start inserting documents.\n * @param options - additional options used for the deserialization.\n * @returns next index in the buffer after deserialization **x** numbers of documents.\n * @public\n */\nexport declare function deserializeStream(\n data: Uint8Array | ArrayBuffer,\n startIndex: number,\n numberOfDocuments: number,\n documents: Document[],\n docStartIndex: number,\n options: DeserializeOptions,\n): number\n\n/** @public */\nexport declare interface Document {\n [key: string]: any\n}\n\n/**\n * A class representation of the BSON Double type.\n * @public\n * @category BSONType\n */\nexport declare class Double extends BSONValue {\n get _bsontype(): \"Double\"\n value: number\n /**\n * Create a Double type\n *\n * @param value - the number we want to represent as a double.\n */\n constructor(value: number)\n /**\n * Access the number value.\n *\n * @returns returns the wrapped double number.\n */\n valueOf(): number\n toJSON(): number\n toString(radix?: number): string\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface DoubleExtended {\n $numberDouble: string\n}\n\n/** @public */\nexport declare const EJSON: {\n parse: typeof parse\n stringify: typeof stringify\n serialize: typeof EJSONserialize\n deserialize: typeof EJSONdeserialize\n}\n\n/**\n * Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types\n *\n * @param ejson - The Extended JSON object to deserialize\n * @param options - Optional settings passed to the parse method\n */\ndeclare function EJSONdeserialize(ejson: Document, options?: EJSONOptions): any\n\n/** @public */\nexport declare type EJSONOptions = {\n /** Output using the Extended JSON v1 spec */\n legacy?: boolean\n /** Enable Extended JSON's `relaxed` mode, which attempts to return native JS types where possible, rather than BSON types */\n relaxed?: boolean\n /** Enable native bigint support */\n useBigInt64?: boolean\n}\n\n/**\n * Serializes an object to an Extended JSON string, and reparse it as a JavaScript object.\n *\n * @param value - The object to serialize\n * @param options - Optional settings passed to the `stringify` function\n */\ndeclare function EJSONserialize(value: any, options?: EJSONOptions): Document\n\n/**\n * A class representation of a BSON Int32 type.\n * @public\n * @category BSONType\n */\nexport declare class Int32 extends BSONValue {\n get _bsontype(): \"Int32\"\n value: number\n /**\n * Create an Int32 type\n *\n * @param value - the number we want to represent as an int32.\n */\n constructor(value: number | string)\n /**\n * Access the number value.\n *\n * @returns returns the wrapped int32 number.\n */\n valueOf(): number\n toString(radix?: number): string\n toJSON(): number\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface Int32Extended {\n $numberInt: string\n}\n\ndeclare const kId: unique symbol\n\n/**\n * A class representing a 64-bit integer\n * @public\n * @category BSONType\n * @remarks\n * The internal representation of a long is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16 bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n * Common constant values ZERO, ONE, NEG_ONE, etc. are found as static properties on this class.\n */\nexport declare class Long extends BSONValue {\n get _bsontype(): \"Long\"\n /** An indicator used to reliably determine if an object is a Long or not. */\n get __isLong__(): boolean\n /**\n * The high 32 bits as a signed value.\n */\n high: number\n /**\n * The low 32 bits as a signed value.\n */\n low: number\n /**\n * Whether unsigned or not.\n */\n unsigned: boolean\n /**\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\n * See the from* functions below for more convenient ways of constructing Longs.\n *\n * Acceptable signatures are:\n * - Long(low, high, unsigned?)\n * - Long(bigint, unsigned?)\n * - Long(string, unsigned?)\n *\n * @param low - The low (signed) 32 bits of the long\n * @param high - The high (signed) 32 bits of the long\n * @param unsigned - Whether unsigned or not, defaults to signed\n */\n constructor(\n low?: number | bigint | string,\n high?: number | boolean,\n unsigned?: boolean,\n )\n static TWO_PWR_24: Long\n /** Maximum unsigned value. */\n static MAX_UNSIGNED_VALUE: Long\n /** Signed zero */\n static ZERO: Long\n /** Unsigned zero. */\n static UZERO: Long\n /** Signed one. */\n static ONE: Long\n /** Unsigned one. */\n static UONE: Long\n /** Signed negative one. */\n static NEG_ONE: Long\n /** Maximum signed value. */\n static MAX_VALUE: Long\n /** Minimum signed value. */\n static MIN_VALUE: Long\n /**\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits.\n * Each is assumed to use 32 bits.\n * @param lowBits - The low 32 bits\n * @param highBits - The high 32 bits\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long\n /**\n * Returns a Long representing the given 32 bit integer value.\n * @param value - The 32 bit integer in question\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromInt(value: number, unsigned?: boolean): Long\n /**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n * @param value - The number in question\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromNumber(value: number, unsigned?: boolean): Long\n /**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n * @param value - The number in question\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromBigInt(value: bigint, unsigned?: boolean): Long\n /**\n * Returns a Long representation of the given string, written using the specified radix.\n * @param str - The textual representation of the Long\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @param radix - The radix in which the text is written (2-36), defaults to 10\n * @returns The corresponding Long value\n */\n static fromString(str: string, unsigned?: boolean, radix?: number): Long\n /**\n * Creates a Long from its byte representation.\n * @param bytes - Byte representation\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @param le - Whether little or big endian, defaults to big endian\n * @returns The corresponding Long value\n */\n static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long\n /**\n * Creates a Long from its little endian byte representation.\n * @param bytes - Little endian byte representation\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromBytesLE(bytes: number[], unsigned?: boolean): Long\n /**\n * Creates a Long from its big endian byte representation.\n * @param bytes - Big endian byte representation\n * @param unsigned - Whether unsigned or not, defaults to signed\n * @returns The corresponding Long value\n */\n static fromBytesBE(bytes: number[], unsigned?: boolean): Long\n /**\n * Tests if the specified object is a Long.\n */\n static isLong(value: unknown): value is Long\n /**\n * Converts the specified value to a Long.\n * @param unsigned - Whether unsigned or not, defaults to signed\n */\n static fromValue(\n val:\n | number\n | string\n | {\n low: number\n high: number\n unsigned?: boolean\n },\n unsigned?: boolean,\n ): Long\n /** Returns the sum of this and the specified Long. */\n add(addend: string | number | Long | Timestamp): Long\n /**\n * Returns the sum of this and the specified Long.\n * @returns Sum\n */\n and(other: string | number | Long | Timestamp): Long\n /**\n * Compares this Long's value with the specified's.\n * @returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater\n */\n compare(other: string | number | Long | Timestamp): 0 | 1 | -1\n /** This is an alias of {@link Long.compare} */\n comp(other: string | number | Long | Timestamp): 0 | 1 | -1\n /**\n * Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned.\n * @returns Quotient\n */\n divide(divisor: string | number | Long | Timestamp): Long\n /**This is an alias of {@link Long.divide} */\n div(divisor: string | number | Long | Timestamp): Long\n /**\n * Tests if this Long's value equals the specified's.\n * @param other - Other value\n */\n equals(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.equals} */\n eq(other: string | number | Long | Timestamp): boolean\n /** Gets the high 32 bits as a signed integer. */\n getHighBits(): number\n /** Gets the high 32 bits as an unsigned integer. */\n getHighBitsUnsigned(): number\n /** Gets the low 32 bits as a signed integer. */\n getLowBits(): number\n /** Gets the low 32 bits as an unsigned integer. */\n getLowBitsUnsigned(): number\n /** Gets the number of bits needed to represent the absolute value of this Long. */\n getNumBitsAbs(): number\n /** Tests if this Long's value is greater than the specified's. */\n greaterThan(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.greaterThan} */\n gt(other: string | number | Long | Timestamp): boolean\n /** Tests if this Long's value is greater than or equal the specified's. */\n greaterThanOrEqual(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.greaterThanOrEqual} */\n gte(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.greaterThanOrEqual} */\n ge(other: string | number | Long | Timestamp): boolean\n /** Tests if this Long's value is even. */\n isEven(): boolean\n /** Tests if this Long's value is negative. */\n isNegative(): boolean\n /** Tests if this Long's value is odd. */\n isOdd(): boolean\n /** Tests if this Long's value is positive. */\n isPositive(): boolean\n /** Tests if this Long's value equals zero. */\n isZero(): boolean\n /** Tests if this Long's value is less than the specified's. */\n lessThan(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long#lessThan}. */\n lt(other: string | number | Long | Timestamp): boolean\n /** Tests if this Long's value is less than or equal the specified's. */\n lessThanOrEqual(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.lessThanOrEqual} */\n lte(other: string | number | Long | Timestamp): boolean\n /** Returns this Long modulo the specified. */\n modulo(divisor: string | number | Long | Timestamp): Long\n /** This is an alias of {@link Long.modulo} */\n mod(divisor: string | number | Long | Timestamp): Long\n /** This is an alias of {@link Long.modulo} */\n rem(divisor: string | number | Long | Timestamp): Long\n /**\n * Returns the product of this and the specified Long.\n * @param multiplier - Multiplier\n * @returns Product\n */\n multiply(multiplier: string | number | Long | Timestamp): Long\n /** This is an alias of {@link Long.multiply} */\n mul(multiplier: string | number | Long | Timestamp): Long\n /** Returns the Negation of this Long's value. */\n negate(): Long\n /** This is an alias of {@link Long.negate} */\n neg(): Long\n /** Returns the bitwise NOT of this Long. */\n not(): Long\n /** Tests if this Long's value differs from the specified's. */\n notEquals(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.notEquals} */\n neq(other: string | number | Long | Timestamp): boolean\n /** This is an alias of {@link Long.notEquals} */\n ne(other: string | number | Long | Timestamp): boolean\n /**\n * Returns the bitwise OR of this Long and the specified.\n */\n or(other: number | string | Long): Long\n /**\n * Returns this Long with bits shifted to the left by the given amount.\n * @param numBits - Number of bits\n * @returns Shifted Long\n */\n shiftLeft(numBits: number | Long): Long\n /** This is an alias of {@link Long.shiftLeft} */\n shl(numBits: number | Long): Long\n /**\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\n * @param numBits - Number of bits\n * @returns Shifted Long\n */\n shiftRight(numBits: number | Long): Long\n /** This is an alias of {@link Long.shiftRight} */\n shr(numBits: number | Long): Long\n /**\n * Returns this Long with bits logically shifted to the right by the given amount.\n * @param numBits - Number of bits\n * @returns Shifted Long\n */\n shiftRightUnsigned(numBits: Long | number): Long\n /** This is an alias of {@link Long.shiftRightUnsigned} */\n shr_u(numBits: number | Long): Long\n /** This is an alias of {@link Long.shiftRightUnsigned} */\n shru(numBits: number | Long): Long\n /**\n * Returns the difference of this and the specified Long.\n * @param subtrahend - Subtrahend\n * @returns Difference\n */\n subtract(subtrahend: string | number | Long | Timestamp): Long\n /** This is an alias of {@link Long.subtract} */\n sub(subtrahend: string | number | Long | Timestamp): Long\n /** Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. */\n toInt(): number\n /** Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). */\n toNumber(): number\n /** Converts the Long to a BigInt (arbitrary precision). */\n toBigInt(): bigint\n /**\n * Converts this Long to its byte representation.\n * @param le - Whether little or big endian, defaults to big endian\n * @returns Byte representation\n */\n toBytes(le?: boolean): number[]\n /**\n * Converts this Long to its little endian byte representation.\n * @returns Little endian byte representation\n */\n toBytesLE(): number[]\n /**\n * Converts this Long to its big endian byte representation.\n * @returns Big endian byte representation\n */\n toBytesBE(): number[]\n /**\n * Converts this Long to signed.\n */\n toSigned(): Long\n /**\n * Converts the Long to a string written in the specified radix.\n * @param radix - Radix (2-36), defaults to 10\n * @throws RangeError If `radix` is out of range\n */\n toString(radix?: number): string\n /** Converts this Long to unsigned. */\n toUnsigned(): Long\n /** Returns the bitwise XOR of this Long and the given one. */\n xor(other: Long | number | string): Long\n /** This is an alias of {@link Long.isZero} */\n eqz(): boolean\n /** This is an alias of {@link Long.lessThanOrEqual} */\n le(other: string | number | Long | Timestamp): boolean\n toExtendedJSON(options?: EJSONOptions): number | LongExtended\n static fromExtendedJSON(\n doc: {\n $numberLong: string\n },\n options?: EJSONOptions,\n ): number | Long | bigint\n inspect(): string\n}\n\n/** @public */\nexport declare interface LongExtended {\n $numberLong: string\n}\n\n/** @public */\nexport declare type LongWithoutOverrides = new (\n low: unknown,\n high?: number | boolean,\n unsigned?: boolean,\n) => {\n [P in Exclude<keyof Long, TimestampOverrides>]: Long[P]\n}\n\n/** @public */\nexport declare const LongWithoutOverridesClass: LongWithoutOverrides\n\n/**\n * A class representation of the BSON MaxKey type.\n * @public\n * @category BSONType\n */\nexport declare class MaxKey extends BSONValue {\n get _bsontype(): \"MaxKey\"\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface MaxKeyExtended {\n $maxKey: 1\n}\n\n/**\n * A class representation of the BSON MinKey type.\n * @public\n * @category BSONType\n */\nexport declare class MinKey extends BSONValue {\n get _bsontype(): \"MinKey\"\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface MinKeyExtended {\n $minKey: 1\n}\n\n/**\n * A class representation of the BSON ObjectId type.\n * @public\n * @category BSONType\n */\nexport declare class ObjectId extends BSONValue {\n get _bsontype(): \"ObjectId\"\n /* Excluded from this release type: index */\n static cacheHexString: boolean\n /* Excluded from this release type: [kId] */\n /* Excluded from this release type: __id */\n /**\n * Create an ObjectId type\n *\n * @param inputId - Can be a 24 character hex string, 12 byte binary Buffer, or a number.\n */\n constructor(\n inputId?: string | number | ObjectId | ObjectIdLike | Uint8Array,\n )\n /**\n * The ObjectId bytes\n * @readonly\n */\n get id(): Uint8Array\n set id(value: Uint8Array)\n /** Returns the ObjectId id as a 24 character hex string representation */\n toHexString(): string\n /* Excluded from this release type: getInc */\n /**\n * Generate a 12 byte id buffer used in ObjectId's\n *\n * @param time - pass in a second based timestamp.\n */\n static generate(time?: number): Uint8Array\n /**\n * Converts the id into a 24 character hex string for printing, unless encoding is provided.\n * @param encoding - hex or base64\n */\n toString(encoding?: \"hex\" | \"base64\"): string\n /** Converts to its JSON the 24 character hex string representation. */\n toJSON(): string\n /**\n * Compares the equality of this ObjectId with `otherID`.\n *\n * @param otherId - ObjectId instance to compare against.\n */\n equals(otherId: string | ObjectId | ObjectIdLike): boolean\n /** Returns the generation date (accurate up to the second) that this ID was generated. */\n getTimestamp(): Date\n /* Excluded from this release type: createPk */\n /**\n * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.\n *\n * @param time - an integer number representing a number of seconds.\n */\n static createFromTime(time: number): ObjectId\n /**\n * Creates an ObjectId from a hex string representation of an ObjectId.\n *\n * @param hexString - create a ObjectId from a passed in 24 character hexstring.\n */\n static createFromHexString(hexString: string): ObjectId\n /** Creates an ObjectId instance from a base64 string */\n static createFromBase64(base64: string): ObjectId\n /**\n * Checks if a value is a valid bson ObjectId\n *\n * @param id - ObjectId instance to validate.\n */\n static isValid(\n id: string | number | ObjectId | ObjectIdLike | Uint8Array,\n ): boolean\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface ObjectIdExtended {\n $oid: string\n}\n\n/** @public */\nexport declare interface ObjectIdLike {\n id: string | Uint8Array\n __id?: string\n toHexString(): string\n}\n\n/**\n * Parse an Extended JSON string, constructing the JavaScript value or object described by that\n * string.\n *\n * @example\n * ```js\n * const { EJSON } = require('bson');\n * const text = '{ \"int32\": { \"$numberInt\": \"10\" } }';\n *\n * // prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }\n * console.log(EJSON.parse(text, { relaxed: false }));\n *\n * // prints { int32: 10 }\n * console.log(EJSON.parse(text));\n * ```\n */\ndeclare function parse(text: string, options?: EJSONOptions): any\n\n/**\n * Serialize a Javascript object.\n *\n * @param object - the Javascript object to serialize.\n * @returns Buffer object containing the serialized object.\n * @public\n */\nexport declare function serialize(\n object: Document,\n options?: SerializeOptions,\n): Uint8Array\n\n/** @public */\nexport declare interface SerializeOptions {\n /** the serializer will check if keys are valid. */\n checkKeys?: boolean\n /** serialize the javascript functions **(default:false)**. */\n serializeFunctions?: boolean\n /** serialize will not emit undefined fields **(default:true)** */\n ignoreUndefined?: boolean\n /* Excluded from this release type: minInternalBufferSize */\n /** the index in the buffer where we wish to start serializing into */\n index?: number\n}\n\n/**\n * Serialize a Javascript object using a predefined Buffer and index into the buffer,\n * useful when pre-allocating the space for serialization.\n *\n * @param object - the Javascript object to serialize.\n * @param finalBuffer - the Buffer you pre-allocated to store the serialized BSON object.\n * @returns the index pointing to the last written byte in the buffer.\n * @public\n */\nexport declare function serializeWithBufferAndIndex(\n object: Document,\n finalBuffer: Uint8Array,\n options?: SerializeOptions,\n): number\n\n/**\n * Sets the size of the internal serialization buffer.\n *\n * @param size - The desired size for the internal serialization buffer\n * @public\n */\nexport declare function setInternalBufferSize(size: number): void\n\n/**\n * Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer\n * function is specified or optionally including only the specified properties if a replacer array\n * is specified.\n *\n * @param value - The value to convert to extended JSON\n * @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\n * @param space - A String or Number object that's used to insert white space into the output JSON string for readability purposes.\n * @param options - Optional settings\n *\n * @example\n * ```js\n * const { EJSON } = require('bson');\n * const Int32 = require('mongodb').Int32;\n * const doc = { int32: new Int32(10) };\n *\n * // prints '{\"int32\":{\"$numberInt\":\"10\"}}'\n * console.log(EJSON.stringify(doc, { relaxed: false }));\n *\n * // prints '{\"int32\":10}'\n * console.log(EJSON.stringify(doc));\n * ```\n */\ndeclare function stringify(\n value: any,\n replacer?:\n | (number | string)[]\n | ((this: any, key: string, value: any) => any)\n | EJSONOptions,\n space?: string | number,\n options?: EJSONOptions,\n): string\n\n/**\n * @public\n * @category BSONType\n * */\nexport declare class Timestamp extends LongWithoutOverridesClass {\n get _bsontype(): \"Timestamp\"\n static readonly MAX_VALUE: Long\n /**\n * @param int - A 64-bit bigint representing the Timestamp.\n */\n constructor(int: bigint)\n /**\n * @param long - A 64-bit Long representing the Timestamp.\n */\n constructor(long: Long)\n /**\n * @param value - A pair of two values indicating timestamp and increment.\n */\n constructor(value: { t: number; i: number })\n toJSON(): {\n $timestamp: string\n }\n /** Returns a Timestamp represented by the given (32-bit) integer value. */\n static fromInt(value: number): Timestamp\n /** Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned. */\n static fromNumber(value: number): Timestamp\n /**\n * Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits.\n *\n * @param lowBits - the low 32-bits.\n * @param highBits - the high 32-bits.\n */\n static fromBits(lowBits: number, highBits: number): Timestamp\n /**\n * Returns a Timestamp from the given string, optionally using the given radix.\n *\n * @param str - the textual representation of the Timestamp.\n * @param optRadix - the radix in which the text is written.\n */\n static fromString(str: string, optRadix: number): Timestamp\n /* Excluded from this release type: toExtendedJSON */\n /* Excluded from this release type: fromExtendedJSON */\n inspect(): string\n}\n\n/** @public */\nexport declare interface TimestampExtended {\n $timestamp: {\n t: number\n i: number\n }\n}\n\n/** @public */\nexport declare type TimestampOverrides =\n | \"_bsontype\"\n | \"toExtendedJSON\"\n | \"fromExtendedJSON\"\n | \"inspect\"\n\n/**\n * A class representation of the BSON UUID type.\n * @public\n */\nexport declare class UUID extends Binary {\n static cacheHexString: boolean\n /* Excluded from this release type: __id */\n /**\n * Create an UUID type\n *\n * @param input - Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer.\n */\n constructor(input?: string | Uint8Array | UUID)\n /**\n * The UUID bytes\n * @readonly\n */\n get id(): Uint8Array\n set id(value: Uint8Array)\n /**\n * Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)\n * @param includeDashes - should the string exclude dash-separators.\n * */\n toHexString(includeDashes?: boolean): string\n /**\n * Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified.\n */\n toString(encoding?: \"hex\" | \"base64\"): string\n /**\n * Converts the id into its JSON string representation.\n * A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n */\n toJSON(): string\n /**\n * Compares the equality of this UUID with `otherID`.\n *\n * @param otherId - UUID instance to compare against.\n */\n equals(otherId: string | Uint8Array | UUID): boolean\n /**\n * Creates a Binary instance from the current UUID.\n */\n toBinary(): Binary\n /**\n * Generates a populated buffer containing a v4 uuid\n */\n static generate(): Uint8Array\n /**\n * Checks if a value is a valid bson UUID\n * @param input - UUID, string or Buffer to validate.\n */\n static isValid(input: string | Uint8Array | UUID): boolean\n /**\n * Creates an UUID from a hex string representation of an UUID.\n * @param hexString - 32 or 36 character hex string (dashes excluded/included).\n */\n static createFromHexString(hexString: string): UUID\n /** Creates an UUID from a base64 string representation of an UUID. */\n static createFromBase64(base64: string): UUID\n inspect(): string\n}\n\n/** @public */\nexport declare type UUIDExtended = {\n $uuid: string\n}\n\nexport {}\n"],"sourceRoot":"../.."}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { BSON, BSONRegExp, BSONSymbol, BSONType, Binary, Code, DBRef, Decimal128, DeserializeOptions, Document, Double, Int32, Long, MaxKey, MinKey, ObjectId, ObjectIdLike, SerializeOptions, Timestamp, deserialize, serialize } from "./bson.typings";
|
|
2
|
-
import type { ConnectionOptions as ConnectionOptions_2 } from "tls";
|
|
3
|
-
import type { Socket } from "net";
|
|
4
1
|
import type { SrvRecord } from "dns";
|
|
5
|
-
import type { TcpNetConnectOpts } from "net";
|
|
6
|
-
import type { TLSSocket } from "tls";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
2
|
+
import type { Socket, TcpNetConnectOpts } from "net";
|
|
3
|
+
import type { ConnectionOptions as ConnectionOptions_2, TLSSocket, TLSSocketOptions } from "tls";
|
|
4
|
+
import { EventEmitter, Readable } from "../../platform/PlatformTools";
|
|
5
|
+
import { BSONRegExp, BSONSymbol, BSONType, Binary, Code, DBRef, Decimal128, DeserializeOptions, Document, Double, Int32, Long, MaxKey, MinKey, ObjectId, ObjectIdLike, SerializeOptions, Timestamp, deserialize, serialize } from "./bson.typings";
|
|
6
|
+
export * as BSON from "./bson.typings";
|
|
9
7
|
/** @public */
|
|
10
8
|
export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> {
|
|
11
9
|
/** @event */
|
|
@@ -453,8 +451,8 @@ export declare interface AuthMechanismProperties extends Document {
|
|
|
453
451
|
PROVIDER_NAME?: "aws";
|
|
454
452
|
}
|
|
455
453
|
/** @public */
|
|
456
|
-
export declare
|
|
457
|
-
|
|
454
|
+
export declare class AutoEncrypter {
|
|
455
|
+
constructor(client: MongoClient, options: AutoEncryptionOptions);
|
|
458
456
|
init(cb: Callback): void;
|
|
459
457
|
teardown(force: boolean, callback: Callback): void;
|
|
460
458
|
encrypt(ns: string, cmd: Document, options: any, callback: Callback<Document>): void;
|
|
@@ -676,7 +674,6 @@ export declare type BatchType = (typeof BatchType)[keyof typeof BatchType];
|
|
|
676
674
|
export { Binary };
|
|
677
675
|
/** @public */
|
|
678
676
|
export declare type BitwiseFilter = number /** numeric bit mask */ | Binary /** BinData bit mask */ | ReadonlyArray<number>;
|
|
679
|
-
export { BSON };
|
|
680
677
|
export { BSONRegExp };
|
|
681
678
|
/**
|
|
682
679
|
* BSON Serialization options.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BSONRegExp, BSONSymbol, BSONType, Binary, Code, DBRef, Decimal128, Double, Int32, Long, MaxKey, MinKey, ObjectId, Timestamp, deserialize, serialize, } from "./bson.typings";
|
|
2
|
+
export * as BSON from "./bson.typings";
|
|
2
3
|
export { Binary };
|
|
3
|
-
export { BSON };
|
|
4
4
|
export { BSONRegExp };
|
|
5
5
|
export { BSONSymbol };
|
|
6
6
|
export { BSONType };
|