Closed orimay closed 4 months ago
Unfortunately this isn't currently supported as the JavaScript engine doesn't compile to WebAssembly
@macjuul It now seems to be possible:
import {
Surreal,
type Emitter,
type Engine,
type EngineEvents,
} from 'surrealdb.js';
import { surrealdbWasmEngines } from 'surrealdb.wasm';
const db = new Surreal({
engines: surrealdbWasmEngines({
strict: false,
capabilities: {
guest_access: true,
functions: true,
network_targets: true,
},
}) as Record<string, new (emitter: Emitter<EngineEvents>) => Engine>,
});
The functions
capability refers to regular built-in and SurrealQL functions, not embedded scripting functions written in JavaScript. I cannot guarantee these will ever be supported due to the complexity behind exposing these through WebAssembly
Oh, that's a pity. Thank you!
Describe your feature request In-browser sandbox doesn't allow to use embedded functions, throws error
Embedded functions are not enabled
. It would've been nice to have access to this functionality. Thank you!Are you willing to contribute this feature? I am not willing to contribute