mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
41 lines
872 B
TypeScript
41 lines
872 B
TypeScript
// Loaded from https://deno.land/x/mongo@v0.20.0/src/protocol/handshake.ts
|
|
|
|
|
|
import { WireProtocol } from "./protocol.ts";
|
|
|
|
export const driverMetadata = {
|
|
driver: {
|
|
name: "Deno Mongo",
|
|
version: "v0.0.1",
|
|
},
|
|
os: {
|
|
type: Deno.build.os,
|
|
name: Deno.build.os,
|
|
architecture: Deno.build.arch,
|
|
},
|
|
};
|
|
|
|
interface HandshakeResponse {
|
|
ismaster: string;
|
|
maxBsonObjectSize: number;
|
|
maxMessageSizeBytes: number;
|
|
maxWriteBatchSize: number;
|
|
localTime: Date;
|
|
logicalSessionTimeoutMinutes: number;
|
|
connectionId: number;
|
|
minWireVersion: number;
|
|
maxWireVersion: number;
|
|
readOnly: boolean;
|
|
ok: number;
|
|
}
|
|
|
|
export async function handshake(
|
|
protocol: WireProtocol,
|
|
): Promise<HandshakeResponse> {
|
|
const reply = await protocol.commandSingle<HandshakeResponse>("admin", {
|
|
isMaster: true,
|
|
client: driverMetadata,
|
|
});
|
|
return reply;
|
|
}
|