MCPcopy
hub / github.com/prisma/prisma / loadSchemaEngine

Function loadSchemaEngine

packages/internals/src/WasmSchemaEngineLoader.ts:35–48  ·  view source on GitHub ↗
(
    input: ConstructorOptions,
    debug: (arg: string) => void,
    adapter: ErrorCapturingSqlDriverAdapterFactory,
  )

Source from the content-addressed store, hash-verified

33let loadedWasmInstance: typeof SchemaEngine
34export const wasmSchemaEngineLoader = {
35 async loadSchemaEngine(
36 input: ConstructorOptions,
37 debug: (arg: string) => void,
38 adapter: ErrorCapturingSqlDriverAdapterFactory,
39 ) {
40 // we only create the instance once for efficiency and also because wasm
41 // bindgen keeps an internal cache of its instance already, when the wasm
42 // compiler is loaded more than once it crashes with `unwrap_throw failed`.
43 if (loadedWasmInstance === undefined) {
44 loadedWasmInstance = await getSchemaEngineWasmInstance()
45 }
46
47 return await loadedWasmInstance.new(input, debug, adapter)
48 },
49}

Callers

nothing calls this directly

Calls 2

newMethod · 0.45

Tested by

no test coverage detected