refactor
Laurin Weger 3 days ago
parent 9d73bbe878
commit 6744584a23
No known key found for this signature in database
GPG Key ID: 9B372BB0B792770F
  1. 0
      engine/verifier/src/orm/initialize.rs
  2. 2
      engine/verifier/src/orm/mod.rs
  3. 14
      engine/verifier/src/orm/query.rs
  4. 32
      sdk/js/lib-wasm/DEV.md
  5. 12
      sdk/js/signals/src/connector/ormConnectionHandler.ts

@ -10,7 +10,7 @@
pub mod add_remove_triples; pub mod add_remove_triples;
pub mod handle_backend_update; pub mod handle_backend_update;
pub mod handle_frontend_update; pub mod handle_frontend_update;
pub mod materialize; pub mod initialize;
pub mod process_changes; pub mod process_changes;
pub mod query; pub mod query;
pub mod shape_validation; pub mod shape_validation;

@ -35,14 +35,15 @@ impl Verifier {
// &update.overlay_id, // &update.overlay_id,
// ); // );
//let base = NuriV0::repo_id(&repo.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_info!("querying construct\n{}\n{}\n", nuri, query);
log_debug!("querying construct\n{}\n{}\n", nuri_str.unwrap(), query);
let parsed = let parsed = Query::parse(&query, Some(nuri.clone()))
Query::parse(&query, nuri_str).map_err(|e| NgError::OxiGraphError(e.to_string()))?; .map_err(|e| NgError::OxiGraphError(e.to_string()))?;
let results = oxistore let results = oxistore
.query(parsed, nuri) .query(parsed, Some(nuri.to_string()))
.map_err(|e| NgError::OxiGraphError(e.to_string()))?; .map_err(|e| NgError::OxiGraphError(e.to_string()))?;
match results { match results {
QueryResults::Graph(triples) => { QueryResults::Graph(triples) => {
@ -50,7 +51,8 @@ impl Verifier {
for t in triples { for t in triples {
match t { match t {
Err(e) => { Err(e) => {
log_err!("{}", e.to_string()); log_info!("Error: {:?}n", e);
return Err(NgError::SparqlError(e.to_string())); return Err(NgError::SparqlError(e.to_string()));
} }
Ok(triple) => { Ok(triple) => {

@ -12,14 +12,14 @@
First of all, run: First of all, run:
``` ```bash
cargo install cargo-run-script cargo install cargo-run-script
``` ```
Please note that the dev and prod builds share the same output folder, they thus override each other. 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. When building the app, be sure to have the production build of the SDK in the output folder.
``` ```bash
// for the app sdk (browser) // for the app sdk (browser)
cargo run-script appdev cargo run-script appdev
@ -29,16 +29,16 @@ cargo run-script nodedev
For testing in vanilla JS For testing in vanilla JS
``` ```bash
cargo run-script webdev cargo run-script webdev
python3 -m http.server python3 -m http.server
// open http://localhost:8000 # open http://localhost:8000
``` ```
Or automated testing with headless chrome: Or automated testing with headless chrome:
``` ```bash
wasm-pack test --chrome --headless 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 : in a separate terminal, from the root of the mono-repo :
``` ```bash
pnpm buildfrontdev3 pnpm buildfrontdev3
cd engine/broker/auth cd engine/broker/auth
pnpm dev3 pnpm dev3
@ -54,7 +54,7 @@ pnpm dev3
in a separate terminal, from the root of the mono-repo : in a separate terminal, from the root of the mono-repo :
``` ```bash
cd infra/ngnet cd infra/ngnet
cargo run-script buildfrontdev3 cargo run-script buildfrontdev3
cargo run cargo run
@ -62,32 +62,32 @@ cargo run
in a separate terminal, from the root of the mono-repo, start your local ngd 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 export NG_DEV3=1; cargo run -r -p ngd -- -vv --save-key -l 14400
// then log in to your account by opening # Then log in to your account by opening
http://localhost:14400 # http://localhost:14400
``` ```
finally, start your local third party webapp you will use to test the WASM SDK. 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, in a separate terminal, from the root of the mono-repo,
``` ```bash
// this is up to you. by example : # This is up to you. By example :
cd sdk/js/examples/multi-framework-signals cd sdk/js/examples/multi-framework-signals
pnpm dev 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) : every time you modify the SDK, re-run (at the root of mono-repo) :
``` ```bash
cargo run-script libwasmdev3 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 ## Production build
``` ```bash
cargo run-script app cargo run-script app
cargo run-script node cargo run-script node
cargo run-script web cargo run-script web

@ -70,10 +70,16 @@ export class OrmConnection<T extends BaseType> {
}); });
ngSession.then(({ ng, session }) => { ngSession.then(({ ng, session }) => {
console.log("ng and session", ng, session);
try { 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( ng.orm_start(
scope, sc,
shapeType, shapeType,
session.session_id, session.session_id,
this.onBackendMessage this.onBackendMessage
@ -130,7 +136,7 @@ export class OrmConnection<T extends BaseType> {
ngSession.then(({ ng, session }) => { ngSession.then(({ ng, session }) => {
ng.orm_update( ng.orm_update(
this.scope, ("did:ng:" + session.private_store_id).substring(0, 53),
this.shapeType.shape, this.shapeType.shape,
ormPatches, ormPatches,
session.session_id session.session_id

Loading…
Cancel
Save