1+ // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit,
2+ // DO NOT EDIT.
3+ //
4+ // To update this file, just rebuild your project or run
5+ // `swift package bridge-js`.
6+
7+ @_spi ( BridgeJS) import JavaScriptKit
8+
9+ func createDatabaseConnection( _ config: JSObject ) throws ( JSException) -> DatabaseConnection {
10+ #if arch(wasm32)
11+ @_extern ( wasm, module: " Check " , name: " bjs_createDatabaseConnection " )
12+ func bjs_createDatabaseConnection( _ config: Int32 ) -> Int32
13+ #else
14+ func bjs_createDatabaseConnection( _ config: Int32 ) -> Int32 {
15+ fatalError ( " Only available on WebAssembly " )
16+ }
17+ #endif
18+ let ret = bjs_createDatabaseConnection ( Int32 ( bitPattern: config. id) )
19+ if let error = _swift_js_take_exception ( ) {
20+ throw error
21+ }
22+ return DatabaseConnection ( takingThis: ret)
23+ }
24+
25+ func createLogger( _ level: String ) throws ( JSException) -> Logger {
26+ #if arch(wasm32)
27+ @_extern ( wasm, module: " Check " , name: " bjs_createLogger " )
28+ func bjs_createLogger( _ level: Int32 ) -> Int32
29+ #else
30+ func bjs_createLogger( _ level: Int32 ) -> Int32 {
31+ fatalError ( " Only available on WebAssembly " )
32+ }
33+ #endif
34+ var level = level
35+ let levelId = level. withUTF8 { b in
36+ _swift_js_make_js_string ( b. baseAddress. unsafelyUnwrapped, Int32 ( b. count) )
37+ }
38+ let ret = bjs_createLogger ( levelId)
39+ if let error = _swift_js_take_exception ( ) {
40+ throw error
41+ }
42+ return Logger ( takingThis: ret)
43+ }
44+
45+ func getConfigManager( ) throws ( JSException) -> ConfigManager {
46+ #if arch(wasm32)
47+ @_extern ( wasm, module: " Check " , name: " bjs_getConfigManager " )
48+ func bjs_getConfigManager( ) -> Int32
49+ #else
50+ func bjs_getConfigManager( ) -> Int32 {
51+ fatalError ( " Only available on WebAssembly " )
52+ }
53+ #endif
54+ let ret = bjs_getConfigManager ( )
55+ if let error = _swift_js_take_exception ( ) {
56+ throw error
57+ }
58+ return ConfigManager ( takingThis: ret)
59+ }
60+
61+ struct DatabaseConnection {
62+ let this : JSObject
63+
64+ init ( this: JSObject ) {
65+ self . this = this
66+ }
67+
68+ init ( takingThis this: Int32 ) {
69+ self . this = JSObject ( id: UInt32 ( bitPattern: this) )
70+ }
71+
72+ var isConnected : Bool {
73+ get throws ( JSException) {
74+ #if arch(wasm32)
75+ @_extern ( wasm, module: " Check " , name: " bjs_DatabaseConnection_isConnected_get " )
76+ func bjs_DatabaseConnection_isConnected_get( _ self: Int32 ) -> Int32
77+ #else
78+ func bjs_DatabaseConnection_isConnected_get( _ self: Int32 ) -> Int32 {
79+ fatalError ( " Only available on WebAssembly " )
80+ }
81+ #endif
82+ let ret = bjs_DatabaseConnection_isConnected_get ( Int32 ( bitPattern: self . this. id) )
83+ if let error = _swift_js_take_exception ( ) {
84+ throw error
85+ }
86+ return ret == 1
87+ }
88+ }
89+
90+ var connectionTimeout : Double {
91+ get throws ( JSException) {
92+ #if arch(wasm32)
93+ @_extern ( wasm, module: " Check " , name: " bjs_DatabaseConnection_connectionTimeout_get " )
94+ func bjs_DatabaseConnection_connectionTimeout_get( _ self: Int32 ) -> Float64
95+ #else
96+ func bjs_DatabaseConnection_connectionTimeout_get( _ self: Int32 ) -> Float64 {
97+ fatalError ( " Only available on WebAssembly " )
98+ }
99+ #endif
100+ let ret = bjs_DatabaseConnection_connectionTimeout_get ( Int32 ( bitPattern: self . this. id) )
101+ if let error = _swift_js_take_exception ( ) {
102+ throw error
103+ }
104+ return Double ( ret)
105+ }
106+ }
107+
108+ func setConnectionTimeout( _ newValue: Double ) throws ( JSException) -> Void {
109+ #if arch(wasm32)
110+ @_extern ( wasm, module: " Check " , name: " bjs_DatabaseConnection_connectionTimeout_set " )
111+ func bjs_DatabaseConnection_connectionTimeout_set( _ self: Int32 , _ newValue: Float64 ) -> Void
112+ #else
113+ func bjs_DatabaseConnection_connectionTimeout_set( _ self: Int32 , _ newValue: Float64 ) -> Void {
114+ fatalError ( " Only available on WebAssembly " )
115+ }
116+ #endif
117+ bjs_DatabaseConnection_connectionTimeout_set ( Int32 ( bitPattern: self . this. id) , newValue)
118+ if let error = _swift_js_take_exception ( ) {
119+ throw error
120+ }
121+ }
122+
123+ func connect( _ url: String ) throws ( JSException) -> Void {
124+ #if arch(wasm32)
125+ @_extern ( wasm, module: " Check " , name: " bjs_DatabaseConnection_connect " )
126+ func bjs_DatabaseConnection_connect( _ self: Int32 , _ url: Int32 ) -> Void
127+ #else
128+ func bjs_DatabaseConnection_connect( _ self: Int32 , _ url: Int32 ) -> Void {
129+ fatalError ( " Only available on WebAssembly " )
130+ }
131+ #endif
132+ var url = url
133+ let urlId = url. withUTF8 { b in
134+ _swift_js_make_js_string ( b. baseAddress. unsafelyUnwrapped, Int32 ( b. count) )
135+ }
136+ bjs_DatabaseConnection_connect ( Int32 ( bitPattern: self . this. id) , urlId)
137+ if let error = _swift_js_take_exception ( ) {
138+ throw error
139+ }
140+ }
141+
142+ func execute( _ query: String ) throws ( JSException) -> JSObject {
143+ #if arch(wasm32)
144+ @_extern ( wasm, module: " Check " , name: " bjs_DatabaseConnection_execute " )
145+ func bjs_DatabaseConnection_execute( _ self: Int32 , _ query: Int32 ) -> Int32
146+ #else
147+ func bjs_DatabaseConnection_execute( _ self: Int32 , _ query: Int32 ) -> Int32 {
148+ fatalError ( " Only available on WebAssembly " )
149+ }
150+ #endif
151+ var query = query
152+ let queryId = query. withUTF8 { b in
153+ _swift_js_make_js_string ( b. baseAddress. unsafelyUnwrapped, Int32 ( b. count) )
154+ }
155+ let ret = bjs_DatabaseConnection_execute ( Int32 ( bitPattern: self . this. id) , queryId)
156+ if let error = _swift_js_take_exception ( ) {
157+ throw error
158+ }
159+ return JSObject ( id: UInt32 ( bitPattern: ret) )
160+ }
161+
162+ }
163+
164+ struct Logger {
165+ let this : JSObject
166+
167+ init ( this: JSObject ) {
168+ self . this = this
169+ }
170+
171+ init ( takingThis this: Int32 ) {
172+ self . this = JSObject ( id: UInt32 ( bitPattern: this) )
173+ }
174+
175+ var level : String {
176+ get throws ( JSException) {
177+ #if arch(wasm32)
178+ @_extern ( wasm, module: " Check " , name: " bjs_Logger_level_get " )
179+ func bjs_Logger_level_get( _ self: Int32 ) -> Int32
180+ #else
181+ func bjs_Logger_level_get( _ self: Int32 ) -> Int32 {
182+ fatalError ( " Only available on WebAssembly " )
183+ }
184+ #endif
185+ let ret = bjs_Logger_level_get ( Int32 ( bitPattern: self . this. id) )
186+ if let error = _swift_js_take_exception ( ) {
187+ throw error
188+ }
189+ return String ( unsafeUninitializedCapacity: Int ( ret) ) { b in
190+ _swift_js_init_memory_with_result ( b. baseAddress. unsafelyUnwrapped, Int32 ( ret) )
191+ return Int ( ret)
192+ }
193+ }
194+ }
195+
196+ func log( _ message: String ) throws ( JSException) -> Void {
197+ #if arch(wasm32)
198+ @_extern ( wasm, module: " Check " , name: " bjs_Logger_log " )
199+ func bjs_Logger_log( _ self: Int32 , _ message: Int32 ) -> Void
200+ #else
201+ func bjs_Logger_log( _ self: Int32 , _ message: Int32 ) -> Void {
202+ fatalError ( " Only available on WebAssembly " )
203+ }
204+ #endif
205+ var message = message
206+ let messageId = message. withUTF8 { b in
207+ _swift_js_make_js_string ( b. baseAddress. unsafelyUnwrapped, Int32 ( b. count) )
208+ }
209+ bjs_Logger_log ( Int32 ( bitPattern: self . this. id) , messageId)
210+ if let error = _swift_js_take_exception ( ) {
211+ throw error
212+ }
213+ }
214+
215+ func error( _ message: String , _ error: JSObject ) throws ( JSException) -> Void {
216+ #if arch(wasm32)
217+ @_extern ( wasm, module: " Check " , name: " bjs_Logger_error " )
218+ func bjs_Logger_error( _ self: Int32 , _ message: Int32 , _ error: Int32 ) -> Void
219+ #else
220+ func bjs_Logger_error( _ self: Int32 , _ message: Int32 , _ error: Int32 ) -> Void {
221+ fatalError ( " Only available on WebAssembly " )
222+ }
223+ #endif
224+ var message = message
225+ let messageId = message. withUTF8 { b in
226+ _swift_js_make_js_string ( b. baseAddress. unsafelyUnwrapped, Int32 ( b. count) )
227+ }
228+ bjs_Logger_error ( Int32 ( bitPattern: self . this. id) , messageId, Int32 ( bitPattern: error. id) )
229+ if let error = _swift_js_take_exception ( ) {
230+ throw error
231+ }
232+ }
233+
234+ }
235+
236+ struct ConfigManager {
237+ let this : JSObject
238+
239+ init ( this: JSObject ) {
240+ self . this = this
241+ }
242+
243+ init ( takingThis this: Int32 ) {
244+ self . this = JSObject ( id: UInt32 ( bitPattern: this) )
245+ }
246+
247+ var configPath : String {
248+ get throws ( JSException) {
249+ #if arch(wasm32)
250+ @_extern ( wasm, module: " Check " , name: " bjs_ConfigManager_configPath_get " )
251+ func bjs_ConfigManager_configPath_get( _ self: Int32 ) -> Int32
252+ #else
253+ func bjs_ConfigManager_configPath_get( _ self: Int32 ) -> Int32 {
254+ fatalError ( " Only available on WebAssembly " )
255+ }
256+ #endif
257+ let ret = bjs_ConfigManager_configPath_get ( Int32 ( bitPattern: self . this. id) )
258+ if let error = _swift_js_take_exception ( ) {
259+ throw error
260+ }
261+ return String ( unsafeUninitializedCapacity: Int ( ret) ) { b in
262+ _swift_js_init_memory_with_result ( b. baseAddress. unsafelyUnwrapped, Int32 ( ret) )
263+ return Int ( ret)
264+ }
265+ }
266+ }
267+
268+ func get( _ key: String ) throws ( JSException) -> JSObject {
269+ #if arch(wasm32)
270+ @_extern ( wasm, module: " Check " , name: " bjs_ConfigManager_get " )
271+ func bjs_ConfigManager_get( _ self: Int32 , _ key: Int32 ) -> Int32
272+ #else
273+ func bjs_ConfigManager_get( _ self: Int32 , _ key: Int32 ) -> Int32 {
274+ fatalError ( " Only available on WebAssembly " )
275+ }
276+ #endif
277+ var key = key
278+ let keyId = key. withUTF8 { b in
279+ _swift_js_make_js_string ( b. baseAddress. unsafelyUnwrapped, Int32 ( b. count) )
280+ }
281+ let ret = bjs_ConfigManager_get ( Int32 ( bitPattern: self . this. id) , keyId)
282+ if let error = _swift_js_take_exception ( ) {
283+ throw error
284+ }
285+ return JSObject ( id: UInt32 ( bitPattern: ret) )
286+ }
287+
288+ func set( _ key: String , _ value: JSObject ) throws ( JSException) -> Void {
289+ #if arch(wasm32)
290+ @_extern ( wasm, module: " Check " , name: " bjs_ConfigManager_set " )
291+ func bjs_ConfigManager_set( _ self: Int32 , _ key: Int32 , _ value: Int32 ) -> Void
292+ #else
293+ func bjs_ConfigManager_set( _ self: Int32 , _ key: Int32 , _ value: Int32 ) -> Void {
294+ fatalError ( " Only available on WebAssembly " )
295+ }
296+ #endif
297+ var key = key
298+ let keyId = key. withUTF8 { b in
299+ _swift_js_make_js_string ( b. baseAddress. unsafelyUnwrapped, Int32 ( b. count) )
300+ }
301+ bjs_ConfigManager_set ( Int32 ( bitPattern: self . this. id) , keyId, Int32 ( bitPattern: value. id) )
302+ if let error = _swift_js_take_exception ( ) {
303+ throw error
304+ }
305+ }
306+
307+ }
0 commit comments