Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade runtime #227

Merged
merged 28 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5116cdb
chore: upgrade runtime
Magnus-Kuhn Aug 2, 2024
f35ee4b
chore: fix tests
sebbi08 Aug 2, 2024
2f07b50
Merge branch 'release/v5' into chore/upgrade-runtime
Magnus-Kuhn Aug 6, 2024
3a61fd8
fix: npm i
Magnus-Kuhn Aug 6, 2024
fda33a5
refactor: remove comment
Magnus-Kuhn Aug 6, 2024
4097242
chore: upgrade backbone
Magnus-Kuhn Aug 6, 2024
8467ea4
refactor: isDefault true
Magnus-Kuhn Aug 6, 2024
95c37cc
Merge branch 'release/v5' into chore/upgrade-runtime
Magnus-Kuhn Aug 6, 2024
a4efe56
fix: use syncUntil in test
Magnus-Kuhn Aug 6, 2024
2055c28
Merge branch 'release/v5' into chore/upgrade-runtime
mergify[bot] Aug 7, 2024
8f105c1
chore: bump runtime to real v5
jkoenig134 Aug 12, 2024
5d8488a
chore: undo unnecessary formatting change
jkoenig134 Aug 13, 2024
6da3ed4
Merge branch 'release/v5' into chore/upgrade-runtime
mergify[bot] Aug 13, 2024
b265029
fix: update test
jkoenig134 Aug 13, 2024
ac669fa
refactor: rename ConnectorResponse to Response
jkoenig134 Aug 14, 2024
2cabd35
refactor: Response -> ConnectorHttpResponse
jkoenig134 Aug 14, 2024
50daf37
refactor: update sdk types
jkoenig134 Aug 14, 2024
8c1a20c
refactor: update tests
jkoenig134 Aug 14, 2024
1b242f6
chore: bump local backbone
jkoenig134 Aug 14, 2024
4f335e2
ci: audit exclude
jkoenig134 Aug 14, 2024
2e4253e
Merge branch 'release/v5' into chore/upgrade-runtime
jkoenig134 Aug 14, 2024
dc4b7ed
chore: rm comment
jkoenig134 Aug 14, 2024
1026865
fix: specify atTypes
jkoenig134 Aug 14, 2024
eb84ba6
fix: do not use runtime in connector tests
jkoenig134 Aug 14, 2024
8ea0b3f
fix: more issues
jkoenig134 Aug 14, 2024
040f8ea
chore: remove relic
jkoenig134 Aug 14, 2024
c3e27c4
fix: naming
jkoenig134 Aug 15, 2024
7088ae6
fix: make only optional where necessary
jkoenig134 Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dev/compose.backbone.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BACKBONE_VERSION=6.2.0
BACKBONE_VERSION=6.5.1
2 changes: 1 addition & 1 deletion .dev/compose.backbone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ services:
image: postgres
environment:
- PGPASSWORD=Passw0rd
command: /bin/bash -c 'env && apt update -y && apt install -y wget && wget https://raw.githubusercontent.com/nmshd/backbone/${BACKBONE_VERSION}/setup-db/setup-postgres.sql -O /setup-postgres.sql && psql -h postgres -U postgres -d enmeshed -f /setup-postgres.sql'
command: /bin/bash -c 'env && apt update -y && apt install -y wget && wget https://raw.githubusercontent.com/nmshd/backbone/${BACKBONE_VERSION}/scripts/sql/postgres/setup.sql -O /setup-postgres.sql && psql -h postgres -U postgres -d enmeshed -f /setup-postgres.sql'
depends_on:
database:
condition: service_healthy
Expand Down
25 changes: 18 additions & 7 deletions .dev/scripts/establishRelationshipAndSpamMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ async function run() {
const { connector1Address, connector2Address } = await establishOrReturnRelationship(connector1, connector2);

while (true) {
await connector1.messages.sendMessage({ recipients: [connector2Address], content: {} });
await connector1.messages.sendMessage({ recipients: [connector2Address], content: { "@type": "ArbitraryMessageContent", value: {} } });
await sleep(2000);

await connector2.messages.sendMessage({ recipients: [connector1Address], content: {} });
await connector2.messages.sendMessage({ recipients: [connector1Address], content: { "@type": "ArbitraryMessageContent", value: {} } });
await sleep(2000);
}
}
Expand All @@ -29,8 +29,8 @@ async function establishOrReturnRelationship(connector1: ConnectorClient, connec
const relationships = (await connector1.relationships.getRelationships()).result;

if (relationships.length > 0) {
if (relationships[0].status === ConnectorRelationshipStatus.PENDING) {
await connector1.relationships.acceptRelationshipChange(relationships[0].id, relationships[0].changes[0].id);
if (relationships[0].status === ConnectorRelationshipStatus.Pending) {
await connector1.relationships.acceptRelationship(relationships[0].id);
}

return {
Expand All @@ -39,15 +39,26 @@ async function establishOrReturnRelationship(connector1: ConnectorClient, connec
};
}

const template = (await connector1.relationshipTemplates.createOwnRelationshipTemplate({ expiresAt: "2099", maxNumberOfAllocations: 1, content: {} })).result;
const template = (
await connector1.relationshipTemplates.createOwnRelationshipTemplate({
expiresAt: "2099",
maxNumberOfAllocations: 1,
content: { "@type": "ArbitraryRelationshipTemplateContent", value: {} }
})
).result;

await connector2.relationshipTemplates.loadPeerRelationshipTemplate({ reference: template.truncatedReference });

const relationship = (await connector2.relationships.createRelationship({ templateId: template.id, content: {} })).result;
const relationship = (
await connector2.relationships.createRelationship({
templateId: template.id,
creationContent: { "@type": "ArbitraryRelationshipCreationContent", value: {} }
})
).result;

await connector1.account.sync();

const accepted = (await connector1.relationships.acceptRelationshipChange(relationship.id, relationship.changes[0].id)).result;
const accepted = (await connector1.relationships.acceptRelationship(relationship.id)).result;
console.log(accepted);

await connector2.account.sync();
Expand Down
64 changes: 26 additions & 38 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"@js-soft/node-logger": "1.2.0",
"@js-soft/ts-utils": "^2.3.3",
"@nmshd/iql": "^1.0.2",
"@nmshd/runtime": "5.0.0-alpha.9",
"@nmshd/runtime": "5.0.0",
"agentkeepalive": "4.5.0",
"amqplib": "^0.10.4",
"axios": "^1.7.4",
Expand Down
14 changes: 7 additions & 7 deletions packages/sdk/_examples/relationships.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ async function run() {

const createdRelationship = await client.relationships.createRelationship({
templateId: "RLT_________________",
content: {
prop1: "value",
prop2: 1
creationContent: {
"@type": "ArbitraryRelationshipCreationContent",
value: {
prop1: "value",
prop2: 1
}
}
});
console.log(createdRelationship);

const syncedRelationships = await client.account.sync();
const relationship = syncedRelationships.result!.relationships[0];

const acceptedRelationship = await client.relationships.acceptRelationshipChange(relationship.id, relationship.changes[0].id, { content: { a: "b" } });
const acceptedRelationship = await client.relationships.acceptRelationship("REL_________________");
console.log(acceptedRelationship);
}

Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/src/endpoints/AccountEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ConnectorResponse, ConnectorSyncInfo, IdentityInfo } from "../types";
import { ConnectorHttpResponse, ConnectorSyncInfo, IdentityInfo } from "../types";
import { Endpoint } from "./Endpoint";

export class AccountEndpoint extends Endpoint {
public async getIdentityInfo(): Promise<ConnectorResponse<IdentityInfo>> {
public async getIdentityInfo(): Promise<ConnectorHttpResponse<IdentityInfo>> {
return await this.get("/api/v2/Account/IdentityInfo");
}

public async sync(): Promise<ConnectorResponse<void>> {
public async sync(): Promise<ConnectorHttpResponse<void>> {
return await this.post("/api/v2/Account/Sync", undefined, 204);
}

public async getSyncInfo(): Promise<ConnectorResponse<ConnectorSyncInfo>> {
public async getSyncInfo(): Promise<ConnectorHttpResponse<ConnectorSyncInfo>> {
return await this.get("/api/v2/Account/SyncInfo");
}
}
Loading