feat/orm-diffs
Laurin Weger 15 hours 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 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;

@ -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) => {

@ -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

@ -70,10 +70,16 @@ export class OrmConnection<T extends BaseType> {
});
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<T extends BaseType> {
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

Loading…
Cancel
Save