Skip to content

Commit 167216e

Browse files
committed
feat(gate): change to open the artifacts from the typegate engine
1 parent 6768d49 commit 167216e

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

typegate/engine/src/runtimes/wasmedge.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ fn param_cast(out: &str, res: &mut Vec<Box<dyn Any + Send + Sync>>) -> Result<St
5454
pub fn op_wasmedge_wasi(#[serde] input: WasiInput) -> Result<String> {
5555
// https://github.com/second-state/wasmedge-rustsdk-examples
5656

57-
let bytes = general_purpose::STANDARD
58-
.decode(input.wasm.as_bytes())
59-
.unwrap();
57+
let wasm_path = PathBuf::from(input.wasm);
58+
let wasm_binary = common::archive::encode_to_base_64(&wasm_path).unwrap();
59+
60+
let bytes = general_purpose::STANDARD.decode(wasm_binary).unwrap();
6061
let module = Module::from_bytes(None, bytes).unwrap();
6162

6263
let config = ConfigBuilder::default()

typegate/src/services/file_upload_service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export async function handleFileUpload(
8181
throw new Error("File size does not match");
8282
}
8383

84+
// adjust relative to the root path
8485
const fileStorageDir = `metatype_artifacts/${engine.name}/files`;
8586
await Deno.mkdir(fileStorageDir, { recursive: true });
8687
const filePath = `${fileStorageDir}/${fileName}.${fileHash}`;

typegraph/python/typegraph/graph/tg_deploy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def tg_deploy(tg: TypegraphOutput, params: TypegraphDeployParams) -> DeployResul
6060
if isinstance(ref_files, Err):
6161
raise Exception(ref_files.value)
6262

63+
# TODO: fetch all the upload by one request
6364
get_upload_url = params.base_url + sep + "get-upload-url"
6465
for file_hash, file_path in ref_files.value:
6566
with open(file_path, "rb") as file:

0 commit comments

Comments
 (0)