-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3ed90a
commit 43ace01
Showing
3 changed files
with
9 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { prepare } from "https://deno.land/x/[email protected]/mod.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export { exists } from "https://deno.land/std@v0.38.0/fs/mod.ts"; | ||
export { exists } from "https://deno.land/std@v0.39.0/fs/mod.ts"; | ||
export { | ||
assert, | ||
assertEquals, | ||
assertThrows | ||
} from "https://deno.land/std@v0.38.0/testing/asserts.ts"; | ||
} from "https://deno.land/std@v0.39.0/testing/asserts.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { prepare } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { prepare } from "../deps.ts"; | ||
import { RELEASE_URL } from "../mod.ts"; | ||
import { CommandType } from "./types.ts"; | ||
|
||
|
@@ -24,12 +24,12 @@ export async function init(releaseUrl = RELEASE_URL) { | |
urls: { | ||
mac: `${releaseUrl}/lib${PLUGIN_NAME}.dylib`, | ||
win: `${releaseUrl}/${PLUGIN_NAME}.dll`, | ||
linux: `${releaseUrl}/lib${PLUGIN_NAME}.so` | ||
} | ||
linux: `${releaseUrl}/lib${PLUGIN_NAME}.so`, | ||
}, | ||
}; | ||
|
||
const Mongo = await prepare(options); | ||
dispatcher = Mongo.ops["mongo_command"]; | ||
dispatcher = Mongo.ops["mongo_command"] as Deno.PluginOp; | ||
dispatcher.setAsyncHandler((msg: Uint8Array) => { | ||
const { command_id, data } = JSON.parse(decoder.decode(msg)); | ||
const resolver = pendingCommands.get(command_id); | ||
|
@@ -57,13 +57,13 @@ export function dispatchAsync( | |
command: Command, | ||
data?: ArrayBufferView | ||
): Promise<unknown> { | ||
return new Promise(resolve => { | ||
return new Promise((resolve) => { | ||
const commandId = nextCommandId++; | ||
pendingCommands.set(commandId, resolve); | ||
const control = encoder.encode( | ||
JSON.stringify({ | ||
...command, | ||
command_id: commandId | ||
command_id: commandId, | ||
}) | ||
); | ||
if (!dispatcher) { | ||
|