Skip to content

Commit 2ffbb72

Browse files
committed
fix: properly type engine options
1 parent bda6d91 commit 2ffbb72

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

src/runtime/types/index.ts

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type { PublicRuntimeConfig, RuntimeConfig } from '@nuxt/schema'
2+
import type { createWasmWorkerEngines } from '@surrealdb/wasm'
3+
import type { createNodeEngines } from '@surrealdb/node'
24
import type { ConnectOptions, Surreal } from 'surrealdb'
35

46
export type { Surreal, SurrealSession } from 'surrealdb'
@@ -27,23 +29,11 @@ export type SurrealServerRuntimeConfig<
2729

2830
/* Wasm */
2931

30-
interface CapabilitiesAllowDenyList {
31-
allow?: boolean | string[]
32-
deny?: boolean | string[]
33-
}
34-
export interface SurrealEngineOptions {
35-
strict?: boolean
36-
query_timeout?: number
37-
transaction_timeout?: number
38-
capabilities?: boolean | {
39-
scripting?: boolean
40-
guest_access?: boolean
41-
live_query_notifications?: boolean
42-
functions?: boolean | string[] | CapabilitiesAllowDenyList
43-
network_targets?: boolean | string[] | CapabilitiesAllowDenyList
44-
experimental?: boolean | string[] | CapabilitiesAllowDenyList
45-
}
46-
}
32+
export type SurrealWasmEngineOptions = NonNullable<Parameters<typeof createWasmWorkerEngines>[0]>
33+
34+
/* Node */
35+
36+
export type SurrealNodeEngineOptions = NonNullable<Parameters<typeof createNodeEngines>[0]>
4737

4838
/* Module */
4939

@@ -73,10 +63,10 @@ export interface ModuleOptions {
7363
*/
7464
preferHttp?: boolean
7565
memory?: Omit<SurrealClientOptions, 'endpoint'> & {
76-
wasmEngine?: SurrealEngineOptions
66+
wasmEngine?: SurrealWasmEngineOptions
7767
}
7868
local?: SurrealClientOptions & {
79-
wasmEngine?: SurrealEngineOptions
69+
wasmEngine?: SurrealWasmEngineOptions
8070
}
8171
}
8272
server?: SurrealServerOptions & {
@@ -87,10 +77,10 @@ export interface ModuleOptions {
8777
*/
8878
preferHttp?: boolean
8979
memory?: Omit<SurrealServerOptions, 'endpoint'> & {
90-
nodeEngine?: SurrealEngineOptions
80+
nodeEngine?: SurrealNodeEngineOptions
9181
}
9282
local?: SurrealServerOptions & {
93-
nodeEngine?: SurrealEngineOptions
83+
nodeEngine?: SurrealNodeEngineOptions
9484
}
9585
}
9686
}

0 commit comments

Comments
 (0)