Skip to content

Commit

Permalink
Merge branch 'dev' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
lucksus committed Aug 8, 2024
2 parents 07872bf + 7eb4deb commit 16f18ce
Show file tree
Hide file tree
Showing 29 changed files with 78 additions and 60 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ad4m-hooks/helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coasys/hooks-helpers",
"version": "0.10.0-rc5",
"version": "0.10.0-rc6",
"description": "",
"main": "./src/index.ts",
"module": "./src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion ad4m-hooks/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coasys/ad4m-react-hooks",
"version": "0.10.0-rc5",
"version": "0.10.0-rc6",
"description": "",
"main": "./src/index.ts",
"module": "./src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion ad4m-hooks/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coasys/ad4m-vue-hooks",
"version": "0.10.0-rc5",
"version": "0.10.0-rc6",
"description": "",
"main": "./src/index.ts",
"module": "./src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion bootstrap-languages/agent-language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@
"md5": "^2.3.0",
"postcss": "^8.2.1"
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
2 changes: 1 addition & 1 deletion bootstrap-languages/direct-message-language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
"dependencies": {
"@types/node": "^18.0.0"
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
2 changes: 1 addition & 1 deletion bootstrap-languages/neighbourhood-language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
},
"author": "[email protected]",
"license": "ISC",
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
2 changes: 1 addition & 1 deletion bootstrap-languages/p-diff-sync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
"devDependencies": {
"run-script-os": "^1.1.6"
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
2 changes: 1 addition & 1 deletion bootstrap-languages/perspective-language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
"typescript": "^4.5.5",
"uint8arrays": "^3.0.0"
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
6 changes: 3 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ad4m"

version = "0.10.0-rc5"
version = "0.10.0-rc6"

edition = "2021"
authors = ["Nicolas Luck <[email protected]>"]
Expand All @@ -24,8 +24,8 @@ path = "src/ad4m_executor.rs"
[dependencies]


ad4m-client = { path = "../rust-client", version="0.10.0-rc4"}
ad4m-executor = { path = "../rust-executor", version="0.10.0-rc4" }
ad4m-client = { path = "../rust-client", version="0.10.0-rc6"}
ad4m-executor = { path = "../rust-executor", version="0.10.0-rc6" }
anyhow = "1.0.65"
clap = { version = "4.0.8", features = ["derive"] }
futures = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@
"esbuild-plugin-replace": "^1.4.0",
"lit": "^2.3.1"
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
16 changes: 4 additions & 12 deletions connect/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default class Ad4mConnect {
if (data.serviceId) {
this.setPort(data.port);
this.setUrl(data.url);

this.isHosting = true;

setForVersion('ad4mhosting', 'true');
Expand Down Expand Up @@ -296,16 +296,6 @@ export default class Ad4mConnect {
// Make sure the url is valid
try {
const websocket = new WebSocket(this.url);

websocket.onerror = (error) => {
this.notifyConnectionChange("not_connected");
};

setTimeout(() => {
if (websocket.readyState !== WebSocket.OPEN) {
this.notifyConnectionChange("not_connected");
}
}, 10000);
} catch (e) {
this.notifyConnectionChange("not_connected");
return;
Expand All @@ -315,6 +305,8 @@ export default class Ad4mConnect {
this.requestedRestart = true;
this.wsClient.dispose();
this.apolloClient.stop();
this.wsClient = null;
this.apolloClient = null;
}

this.wsClient = createClient({
Expand Down Expand Up @@ -413,7 +405,7 @@ export default class Ad4mConnect {
let token = localStorage.getItem('hosting_token');

const response = await fetch('https://hosting.ad4m.dev/api/service/checkStatus', {
method: 'GET',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token
Expand Down
7 changes: 5 additions & 2 deletions connect/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ export async function connectWebSocket(url, timeout = 10000) {
return Promise.race([
new Promise((resolve, reject) => {
try {
if (!url.includes("localhost")) {
resolve(new WebSocket(url));
}
const websocket = new WebSocket(url);

websocket.onopen = () => {
resolve(websocket);
};

websocket.onerror = (error) => {
reject(error);
};
Expand Down
39 changes: 31 additions & 8 deletions connect/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ export class Ad4mConnectElement extends LitElement {

@state()
private _hostingStep = 0;

@state()
private _email = "";

@state()
private _passowrd = "";

Expand Down Expand Up @@ -612,7 +612,7 @@ export class Ad4mConnectElement extends LitElement {

private changeEmail(email: string) {
this._email = email;
}
}

private changePassword(passowrd: string) {
this._passowrd = passowrd;
Expand All @@ -631,6 +631,11 @@ export class Ad4mConnectElement extends LitElement {
}

private changeUrl(url) {
if (url !== this._client.url) {
removeForVersion("ad4mtoken")
this._client.setToken(null);
}

this._client.setUrl(url);
}

Expand Down Expand Up @@ -683,10 +688,15 @@ export class Ad4mConnectElement extends LitElement {
}

private handleConnectionChange(event: ConnectionStates) {
console.log(event);
// this._isOpen = true;
console.log(event);
// this._isOpen = true;
if (event === "connected") {
this.changeUIState("requestcap");
if (this.authState !== "authenticated") {
this.changeUIState("requestcap");
} else {
this.changeUIState("connected");
this._isOpen = false;
}
}
if (event === "disconnected") {
this._isOpen = true;
Expand Down Expand Up @@ -740,6 +750,14 @@ export class Ad4mConnectElement extends LitElement {
this._isOpen = true;
this.requestUpdate();
const client = await this._client.connect();
try {
const status = await client.agent.status();
if (status.isUnlocked && status.isInitialized) {
window.location.reload();
}
} catch (e) {
console.warn(e);
}
return client;
}

Expand All @@ -749,13 +767,18 @@ export class Ad4mConnectElement extends LitElement {

async connectRemote(url) {
try {
this.changeUrl(url);
const client = await this._client.connect(url);
const status = await client.agent.status();
if (status.isUnlocked && status.isInitialized) {
return client
}

this.changeUIState("requestcap");
return client;
} catch (e) {
if (e.message === "Socket closed with event 4500 Invalid Compact JWS") {
this.changeUIState("requestcap");
}
this._isOpen = true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@types/yargs": "*"
},
"patchedDependencies": {},
"version": "0.10.0-rc5",
"version": "0.10.0-rc6",
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
Expand Down
14 changes: 7 additions & 7 deletions core/src/perspectives/PerspectiveProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,22 +455,22 @@ export class PerspectiveProxy {
// Collect all set functions of the object in a list
let setFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection"))
// Add all set functions of the object's prototype to that list
setFunctions = setFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof obj[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection")))
setFunctions = setFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection")))

// Collect all add functions of the object in a list
let addFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("add"))
let addFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("add"))
// Add all add functions of the object's prototype to that list
addFunctions = addFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof obj[key] === "function") && key.startsWith("add")))
addFunctions = addFunctions.concat(Object.keys(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("add")))

// Collect all remove functions of the object in a list
let removeFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("remove"))
let removeFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("remove"))
// Add all remove functions of the object's prototype to that list
removeFunctions = removeFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof obj[key] === "function") && key.startsWith("remove")))
removeFunctions = removeFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("remove")))

// Collect all add functions of the object in a list
let setCollectionFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("setCollection"))
let setCollectionFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("setCollection"))
// Add all add functions of the object's prototype to that list
setCollectionFunctions = setCollectionFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof obj[key] === "function") && key.startsWith("setCollection")))
setCollectionFunctions = setCollectionFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("setCollection")))

// Construct query to find all subject classes that have the given properties and collections
let query = `subject_class(Class, C)`
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
"typedoc-plugin-markdown": "^3.15.2",
"typescript": "^4.9.3"
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
2 changes: 1 addition & 1 deletion executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@
"tmp": "^0.2.1",
"uuid": "*"
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
2 changes: 1 addition & 1 deletion executor/src/core/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'node:path';
import * as fs from 'node:fs';
import { Address, Expression } from '@coasys/ad4m';

export let ad4mExecutorVersion = "0.10.0-rc5";
export let ad4mExecutorVersion = "0.10.0-rc6";
export let agentLanguageAlias = "did";
export let languageLanguageAlias = "lang";
export let neighbourhoodLanguageAlias = "neighbourhood";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,5 @@
"[email protected]": "patches/[email protected]"
}
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
2 changes: 1 addition & 1 deletion rust-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ad4m-client"
version = "0.10.0-rc5"
version = "0.10.0-rc6"
edition = "2021"
authors = ["Nicolas Luck <[email protected]>"]
description = "Client library wrapping AD4M's GraphQL interface"
Expand Down
4 changes: 2 additions & 2 deletions rust-executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ad4m-executor"
version = "0.10.0-rc5"
version = "0.10.0-rc6"
edition = "2021"
authors = ["Nicolas Luck <[email protected]>"]
description = "Runtime implementation of AD4M as library - https://ad4m.dev"
Expand Down Expand Up @@ -89,7 +89,7 @@ kitsune_p2p_types = { version = "0.3.2-rc.0", git = "https://github.com/coasys/h
scryer-prolog = { version = "0.9.4" }
# scryer-prolog = { path = "../../scryer-prolog", features = ["multi_thread"] }

ad4m-client = { path = "../rust-client", version="0.10.0-rc5" }
ad4m-client = { path = "../rust-client", version="0.10.0-rc6" }
reqwest = { version = "0.11.20", features = ["json", "native-tls"] }

rusqlite = { version = "0.29.0", git = "https://github.com/coasys/rusqlite.git", rev = "12ec1330bd4b46411ab9895364da4a3e172d0fbb", features = ["bundled"] }
Expand Down
2 changes: 1 addition & 1 deletion rust-executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
"@coasys/ad4m-executor": "link:../core"
},
"dependencies": {},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
2 changes: 1 addition & 1 deletion rust-executor/src/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use lazy_static::lazy_static;

lazy_static! {
/// The current version of AD4M
pub static ref AD4M_VERSION: String = String::from("0.10.0-rc5");
pub static ref AD4M_VERSION: String = String::from("0.10.0-rc6");
}

/// Struct representing oldest supported version and indicator if state should be cleared if update is required
Expand Down
2 changes: 1 addition & 1 deletion test-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@
"bugs": {
"url": "https://github.com/perspect3vism/ad4m-test/issues"
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
2 changes: 1 addition & 1 deletion tests/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@
"dependencies": {
"uuid": "*"
},
"version": "0.10.0-rc5"
"version": "0.10.0-rc6"
}
Loading

0 comments on commit 16f18ce

Please sign in to comment.