From 9fbf1c38ed89bcda95ca99391d3bf86eb44ae46f Mon Sep 17 00:00:00 2001 From: Jersey Date: Wed, 15 May 2024 21:59:09 -0400 Subject: [PATCH] actually format the code --- deps.ts | 6 +++--- mod.ts | 28 +++++++++++++-------------- src/auth/scram.ts | 2 +- src/auth/x509.ts | 2 +- src/collection/commands/update.ts | 2 +- src/protocol/message.ts | 2 +- src/protocol/protocol.ts | 8 ++++++-- src/utils/saslprep/sparse_bitfield.ts | 2 +- tests/cases/09_geospatial_types.ts | 6 +++++- tests/common.ts | 2 +- 10 files changed, 34 insertions(+), 26 deletions(-) diff --git a/deps.ts b/deps.ts index 8fbe501..a70a811 100644 --- a/deps.ts +++ b/deps.ts @@ -1,20 +1,20 @@ export { + Binary, BSONRegExp, BSONSymbol, - Binary, Code, DBRef, Decimal128, + deserialize, Double, Int32, Long, MaxKey, MinKey, ObjectId, + serialize, Timestamp, UUID, - deserialize, - serialize } from "jsr:@lucsoft/web-bson@^0.3.1"; export { crypto as stdCrypto } from "jsr:@std/crypto@^0.224.0/crypto"; export { decodeBase64, encodeBase64 } from "jsr:@std/encoding@^0.224.0/base64"; diff --git a/mod.ts b/mod.ts index 96090c1..32bf828 100644 --- a/mod.ts +++ b/mod.ts @@ -1,38 +1,39 @@ /** * @module - * + * * # deno_mongo - * + * * **deno_mongo** is a **MongoDB** driver for Deno which also supports Deno Deploy. - * + * * ## ATTENTION - * + * * Deno has support for npm modules now, so you can also use `npm:mongodb`. * See [this](https://github.com/denodrivers/mongo/issues/380) for more details. - * + * * ## Usage - * + * * Replace `version` with the latest version of the driver. - * + * * ```ts * import { MongoClient } from 'jsr:@db/mongo@version'; * ``` - * + * * See [the README](https://github.com/denodrivers/mongo) for more examples. - * + * * ## Other community resources and examples - * + * * - [atlas_sdk](https://deno.land/x/atlas_sdk) - TypeSafe MongoDB Atlas SDK * - [dangoDB](https://github.com/oslabs-beta/dangoDB) - MongoDB ORM for Deno * - [deno-deploy-mongo](https://github.com/erfanium/deno-deploy-mongo) - A simple app with Deno, MongoDB, and Oak using MongoDB Atlas * - [deno_rest](https://github.com/vicky-gonsalves/deno_rest) - An Oak-based template for RESTful APIs using this driver * - [denomongo-unittest-utils](https://github.com/Gang-of-Fork/denomongo-unittest-utils) - Mock collection for unit tests - * */ export { + Binary, BSONRegExp, - BSONSymbol, Binary, Code, + BSONSymbol, + Code, DBRef, Decimal128, Double, @@ -42,11 +43,10 @@ export { MinKey, ObjectId, Timestamp, - UUID + UUID, } from "./deps.ts"; export { MongoClient } from "./src/client.ts"; export { Collection } from "./src/collection/mod.ts"; export { Database } from "./src/database.ts"; export { GridFSBucket } from "./src/gridfs/bucket.ts"; export * from "./src/types.ts"; - diff --git a/src/auth/scram.ts b/src/auth/scram.ts index f199ed6..22a84d2 100644 --- a/src/auth/scram.ts +++ b/src/auth/scram.ts @@ -10,7 +10,7 @@ import type { HandshakeDocument } from "../protocol/handshake.ts"; import { driverMetadata } from "../protocol/mod.ts"; import type { Credential, Document } from "../types.ts"; import { saslprep } from "../utils/saslprep/mod.ts"; -import { AuthPlugin, type AuthContext } from "./base.ts"; +import { type AuthContext, AuthPlugin } from "./base.ts"; import { pbkdf2 } from "./pbkdf2.ts"; type CryptoMethod = "sha1" | "sha256"; diff --git a/src/auth/x509.ts b/src/auth/x509.ts index 92ee3ab..c246e48 100644 --- a/src/auth/x509.ts +++ b/src/auth/x509.ts @@ -1,7 +1,7 @@ import type { HandshakeDocument } from "../protocol/handshake.ts"; import { driverMetadata } from "../protocol/mod.ts"; import type { Credential, Document } from "../types.ts"; -import { AuthPlugin, type AuthContext } from "./base.ts"; +import { type AuthContext, AuthPlugin } from "./base.ts"; export interface X509Command extends Document { authenticate: number; diff --git a/src/collection/commands/update.ts b/src/collection/commands/update.ts index 12e5f99..35bea5a 100644 --- a/src/collection/commands/update.ts +++ b/src/collection/commands/update.ts @@ -1,7 +1,7 @@ import type { ObjectId } from "../../../deps.ts"; import type { WireProtocol } from "../../protocol/mod.ts"; import type { Document, UpdateOptions } from "../../types.ts"; - + interface UpdateResponse { ok: number; nModified: number; diff --git a/src/protocol/message.ts b/src/protocol/message.ts index bcd994a..38ec721 100644 --- a/src/protocol/message.ts +++ b/src/protocol/message.ts @@ -1,6 +1,6 @@ import { deserialize, serialize } from "../../deps.ts"; import type { Document } from "../types.ts"; -import { OpCode, setHeader, type MessageHeader } from "./header.ts"; +import { type MessageHeader, OpCode, setHeader } from "./header.ts"; type MessageFlags = number; diff --git a/src/protocol/protocol.ts b/src/protocol/protocol.ts index d60fa51..fcf039b 100644 --- a/src/protocol/protocol.ts +++ b/src/protocol/protocol.ts @@ -1,12 +1,16 @@ import { MongoDriverError, - MongoServerError, type MongoErrorInfo, + MongoServerError, } from "../error.ts"; import type { Document } from "../types.ts"; import { handshake } from "./handshake.ts"; import { parseHeader } from "./header.ts"; -import { deserializeMessage, serializeMessage, type Message } from "./message.ts"; +import { + deserializeMessage, + type Message, + serializeMessage, +} from "./message.ts"; interface CommandTask { requestId: number; diff --git a/src/utils/saslprep/sparse_bitfield.ts b/src/utils/saslprep/sparse_bitfield.ts index 0f5d6a0..af0e75f 100644 --- a/src/utils/saslprep/sparse_bitfield.ts +++ b/src/utils/saslprep/sparse_bitfield.ts @@ -1,4 +1,4 @@ -import { Pager, type Page } from "./memory_pager.ts"; +import { type Page, Pager } from "./memory_pager.ts"; /** Is the given number a power of two? */ function powerOfTwo(x: number): boolean { diff --git a/tests/cases/09_geospatial_types.ts b/tests/cases/09_geospatial_types.ts index f1b59d7..7bfb8fb 100644 --- a/tests/cases/09_geospatial_types.ts +++ b/tests/cases/09_geospatial_types.ts @@ -1,6 +1,10 @@ import type { Database } from "../../mod.ts"; import type { Collection } from "../../src/collection/collection.ts"; -import type { Geometry, GeometryObject, Point } from "../../src/types/geojson.ts"; +import type { + Geometry, + GeometryObject, + Point, +} from "../../src/types/geojson.ts"; import type { $box, $center, diff --git a/tests/common.ts b/tests/common.ts index 43820bc..bb37852 100644 --- a/tests/common.ts +++ b/tests/common.ts @@ -1,4 +1,4 @@ -import { MongoClient, type Database } from "../mod.ts"; +import { type Database, MongoClient } from "../mod.ts"; const hostname = "127.0.0.1";