@@ -85,7 +85,7 @@ export type RdfInterface = {
8585 getRdfStatements : ( ) => Statement [ ]
8686}
8787
88- function status ( msg : string , statusMsg : ( ( msg :string ) => void ) | undefined ) {
88+ function status ( msg : string , statusMsg : ( ( msg :string ) => void ) | undefined = undefined ) {
8989 if ( statusMsg ) {
9090 statusMsg ( msg )
9191 }
@@ -129,7 +129,7 @@ export async function initialisePython(pyodideApi: PyodideAPI, rdfInterface: Rdf
129129const RUN_BG2CELLML = `
130130from pyodide.ffi import to_js
131131
132- def bg2cellml(uri: str, bg_rdf: str, metatata: bool=False, debug: bool=False):
132+ async def bg2cellml(uri: str, bg_rdf: str, metatata: bool=False, debug: bool=False):
133133 try:
134134 bgrdf_model = framework.make_bondgraph_model(uri, bg_rdf, debug=debug)
135135 if bgrdf_model.has_issues:
@@ -138,7 +138,7 @@ def bg2cellml(uri: str, bg_rdf: str, metatata: bool=False, debug: bool=False):
138138 cellml_model = bgrdf_model.make_cellml_model()
139139 result = { 'cellml': cellml_model.to_xml() }
140140 if metatata:
141- result['metatata'] = cellml_model.metadata(uri)
141+ result['metatata'] = await cellml_model.metadata(uri)
142142 return to_js(result)
143143 except Exception as e:
144144 return to_js({
@@ -149,21 +149,21 @@ bg2cellml
149149
150150//==============================================================================
151151
152- function bg2cellml ( uri : string , bgRdf : string , options : CellMLGenerationOptions | undefined = undefined ) : CellMLOutput {
152+ async function bg2cellml ( uri : string , bgRdf : string , options : CellMLGenerationOptions | undefined = undefined ) : Promise < CellMLOutput > {
153153 if ( pyodide ) {
154154 const bg2cellml = pyodide . runPython ( RUN_BG2CELLML )
155- return bg2cellml ( uri , bgRdf , options ?. metadata , options ?. debug ) // options
155+ return await bg2cellml ( uri , bgRdf , options ?. metadata , options ?. debug ) // options
156156 }
157157 return {
158158 issues : [ 'CellML conversion service has not been initialised' ]
159159 }
160160}
161161
162- export function celldl2cellml ( uri : string , source : string , options : CellMLGenerationOptions | undefined = undefined ) : CellMLOutput {
162+ export async function celldl2cellml ( uri : string , source : string , options : CellMLGenerationOptions | undefined = undefined ) : Promise < CellMLOutput > {
163163 if ( pyodide ) {
164164 const bgRdf = options ?. rdfSource ? source : getBgRdf ( source )
165165 const bg2cellml = pyodide . runPython ( RUN_BG2CELLML )
166- return bg2cellml ( uri , bgRdf , options )
166+ return await bg2cellml ( uri , bgRdf , options ?. metadata , options ?. debug )
167167 }
168168 return {
169169 issues : [ 'CellML conversion service has not been initialised' ]
@@ -177,7 +177,7 @@ export async function testBg2cellml(): Promise<CellMLOutput> {
177177 const response = await fetch ( model_uri )
178178 if ( response . ok ) {
179179 const model_source = await response . text ( )
180- const result = bg2cellml ( full_uri , model_source , {
180+ const result = await bg2cellml ( full_uri , model_source , {
181181 debug : true ,
182182 metadata : true
183183 } )
0 commit comments