From 6744584a234169af54f4d22134765b6c0cb493ab Mon Sep 17 00:00:00 2001 From: Laurin Weger Date: Tue, 21 Oct 2025 20:39:15 +0200 Subject: [PATCH] wip --- .../src/orm/{materialize.rs => initialize.rs} | 0 engine/verifier/src/orm/mod.rs | 2 +- engine/verifier/src/orm/query.rs | 14 ++++---- sdk/js/lib-wasm/DEV.md | 32 +++++++++---------- .../src/connector/ormConnectionHandler.ts | 12 +++++-- 5 files changed, 34 insertions(+), 26 deletions(-) rename engine/verifier/src/orm/{materialize.rs => initialize.rs} (100%) diff --git a/engine/verifier/src/orm/materialize.rs b/engine/verifier/src/orm/initialize.rs similarity index 100% rename from engine/verifier/src/orm/materialize.rs rename to engine/verifier/src/orm/initialize.rs diff --git a/engine/verifier/src/orm/mod.rs b/engine/verifier/src/orm/mod.rs index f602fb38..58bcb495 100644 --- a/engine/verifier/src/orm/mod.rs +++ b/engine/verifier/src/orm/mod.rs @@ -10,7 +10,7 @@ pub mod add_remove_triples; pub mod handle_backend_update; pub mod handle_frontend_update; -pub mod materialize; +pub mod initialize; pub mod process_changes; pub mod query; pub mod shape_validation; diff --git a/engine/verifier/src/orm/query.rs b/engine/verifier/src/orm/query.rs index ea228ce0..3cbc9b15 100644 --- a/engine/verifier/src/orm/query.rs +++ b/engine/verifier/src/orm/query.rs @@ -35,14 +35,15 @@ impl Verifier { // &update.overlay_id, // ); //let base = NuriV0::repo_id(&repo.id); + let binding = nuri.unwrap(); + let nuri = binding.split_at(53).0; - let nuri_str = nuri.as_ref().map(|s| s.as_str()); - log_debug!("querying construct\n{}\n{}\n", nuri_str.unwrap(), query); + log_info!("querying construct\n{}\n{}\n", nuri, query); - let parsed = - Query::parse(&query, nuri_str).map_err(|e| NgError::OxiGraphError(e.to_string()))?; + let parsed = Query::parse(&query, Some(nuri.clone())) + .map_err(|e| NgError::OxiGraphError(e.to_string()))?; let results = oxistore - .query(parsed, nuri) + .query(parsed, Some(nuri.to_string())) .map_err(|e| NgError::OxiGraphError(e.to_string()))?; match results { QueryResults::Graph(triples) => { @@ -50,7 +51,8 @@ impl Verifier { for t in triples { match t { Err(e) => { - log_err!("{}", e.to_string()); + log_info!("Error: {:?}n", e); + return Err(NgError::SparqlError(e.to_string())); } Ok(triple) => { diff --git a/sdk/js/lib-wasm/DEV.md b/sdk/js/lib-wasm/DEV.md index d0b33b57..bd0f0a9b 100644 --- a/sdk/js/lib-wasm/DEV.md +++ b/sdk/js/lib-wasm/DEV.md @@ -12,14 +12,14 @@ First of all, run: -``` +```bash cargo install cargo-run-script ``` Please note that the dev and prod builds share the same output folder, they thus override each other. When building the app, be sure to have the production build of the SDK in the output folder. -``` +```bash // for the app sdk (browser) cargo run-script appdev @@ -29,16 +29,16 @@ cargo run-script nodedev For testing in vanilla JS -``` +```bash cargo run-script webdev python3 -m http.server -// open http://localhost:8000 +# open http://localhost:8000 ``` Or automated testing with headless chrome: -``` +```bash wasm-pack test --chrome --headless ``` @@ -46,7 +46,7 @@ wasm-pack test --chrome --headless in a separate terminal, from the root of the mono-repo : -``` +```bash pnpm buildfrontdev3 cd engine/broker/auth pnpm dev3 @@ -54,7 +54,7 @@ pnpm dev3 in a separate terminal, from the root of the mono-repo : -``` +```bash cd infra/ngnet cargo run-script buildfrontdev3 cargo run @@ -62,32 +62,32 @@ cargo run in a separate terminal, from the root of the mono-repo, start your local ngd -``` +```bash export NG_DEV3=1; cargo run -r -p ngd -- -vv --save-key -l 14400 -// then log in to your account by opening -http://localhost:14400 +# Then log in to your account by opening +# http://localhost:14400 ``` finally, start your local third party webapp you will use to test the WASM SDK. in a separate terminal, from the root of the mono-repo, -``` -// this is up to you. by example : +```bash +# This is up to you. By example : cd sdk/js/examples/multi-framework-signals pnpm dev -// then open that app in your browser +# Then open that app in your browser ``` every time you modify the SDK, re-run (at the root of mono-repo) : -``` +```bash cargo run-script libwasmdev3 -// or in the sdk/js/lib-wasm folder run cargo run-script appdev3 +# Or in the sdk/js/lib-wasm folder run cargo run-script appdev3 ``` ## Production build -``` +```bash cargo run-script app cargo run-script node cargo run-script web diff --git a/sdk/js/signals/src/connector/ormConnectionHandler.ts b/sdk/js/signals/src/connector/ormConnectionHandler.ts index 1aadfcd4..77d9333c 100644 --- a/sdk/js/signals/src/connector/ormConnectionHandler.ts +++ b/sdk/js/signals/src/connector/ormConnectionHandler.ts @@ -70,10 +70,16 @@ export class OrmConnection { }); ngSession.then(({ ng, session }) => { + console.log("ng and session", ng, session); try { - console.log("SCOPE=",scope); + const sc = ("did:ng:" + session.private_store_id).substring( + 0, + 53 + ); + console.log("calling orm_start with nuri", sc); + ng.orm_start( - scope, + sc, shapeType, session.session_id, this.onBackendMessage @@ -130,7 +136,7 @@ export class OrmConnection { ngSession.then(({ ng, session }) => { ng.orm_update( - this.scope, + ("did:ng:" + session.private_store_id).substring(0, 53), this.shapeType.shape, ormPatches, session.session_id