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

Refactor/Migrate to new Relationship APIs #216

Merged
merged 51 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
54023dc
chore/fix: bump and build runtime, use flag platform=node
Magnus-Kuhn Jun 10, 2024
4aa1454
chore: use creation content
Magnus-Kuhn Jun 10, 2024
40cf9d5
chore: change relationship dtos
Magnus-Kuhn Jun 10, 2024
9ff7fa3
test: new creation content tests
Magnus-Kuhn Jun 10, 2024
826d5db
chore: adapt relationship dto tests
Magnus-Kuhn Jun 10, 2024
7392af8
chore: add relationship events
Magnus-Kuhn Jun 11, 2024
0b67686
chore: more relationship change removal
Magnus-Kuhn Jun 11, 2024
955ec2b
chore: remove realm
Magnus-Kuhn Jun 11, 2024
b6e51b7
test: add relationship facade tests
Magnus-Kuhn Jun 11, 2024
49fc252
fix: add changes to tests
Magnus-Kuhn Jun 11, 2024
60016c7
chore: generate g.dart
Magnus-Kuhn Jun 11, 2024
bcd2065
fix: make tests run
Magnus-Kuhn Jun 11, 2024
d5aaa8e
Merge branch 'main' into chore/update-relationship-termination-etc
Magnus-Kuhn Jun 17, 2024
e5616ea
refactor: remove unused code, fix naming
Magnus-Kuhn Jun 17, 2024
e47722a
refactor: name relationshipCreationContentContaingResponse
Magnus-Kuhn Jun 17, 2024
ae36ce6
fix: relationship facade errors
Magnus-Kuhn Jun 17, 2024
c299503
Merge branch 'release/v5' into chore/update-relationship-termination-etc
Magnus-Kuhn Jul 1, 2024
79e2518
fix: identitfier typo
Magnus-Kuhn Jul 1, 2024
2069464
chore: runtime version bump and build
Magnus-Kuhn Jul 1, 2024
2c2d363
chore: license bump
Magnus-Kuhn Jul 3, 2024
bccb526
Ci/debug using local backbone (#215)
jkoenig134 Jun 27, 2024
a412c09
chore: version bump
Magnus-Kuhn Jul 3, 2024
c59f70f
chore: backbone version bump
Magnus-Kuhn Jul 3, 2024
d290fc6
Merge branch 'release/v5' into chore/update-relationship-termination-etc
Magnus-Kuhn Jul 3, 2024
bb7d9e5
fix: audit log null check, correct creation content
Magnus-Kuhn Jul 3, 2024
8a30147
fix: jsons in test
Magnus-Kuhn Jul 3, 2024
aab5152
chore: add event handlers
Magnus-Kuhn Jul 3, 2024
dfa725f
chore: update config
jkoenig134 Jul 9, 2024
d75ad55
fix: undo merge errors
jkoenig134 Jul 9, 2024
7b0c8e2
refactor: trailing commas
jkoenig134 Jul 9, 2024
272c902
fix: change license back
Magnus-Kuhn Jul 9, 2024
99a4f40
fix: remove changecount from relationship dvo
Magnus-Kuhn Jul 9, 2024
92ee310
chore: update runtime
Magnus-Kuhn Jul 9, 2024
a6b58bb
fix: thirdParty attribute query in tests
Magnus-Kuhn Jul 9, 2024
9077ff7
fix. requestsfacade test
Magnus-Kuhn Jul 9, 2024
8edc687
fix: messageFacade test
Magnus-Kuhn Jul 9, 2024
5c5401d
fix: requestFacade (same thing as last time)
Magnus-Kuhn Jul 9, 2024
0efde6f
refactor: use more dids
Magnus-Kuhn Jul 11, 2024
701bb76
chore: thirdPartyAttrOwner enum
Magnus-Kuhn Jul 11, 2024
01bbba9
fix: attributeFacadeTest types
Magnus-Kuhn Jul 11, 2024
b4e2d14
fix: remove realm
Magnus-Kuhn Jul 11, 2024
cb68020
test: regex address check
Magnus-Kuhn Jul 11, 2024
fe91d01
chore: update connector sdk
Magnus-Kuhn Jul 11, 2024
1843f3c
fix: owner in attributeQueryTest
Magnus-Kuhn Jul 11, 2024
e6cefee
fix: thirdPartyRelQueryFromJson
Magnus-Kuhn Jul 11, 2024
8405ac7
chore: runtime to alpha:4
Magnus-Kuhn Jul 11, 2024
7890936
fix: incorporate review comments
britsta Jul 12, 2024
a2ea09a
refactor: renaming RelationshipCreationContents
britsta Jul 12, 2024
99cb2b7
fix: imports
jkoenig134 Jul 12, 2024
75cea15
chore: trailing commas
jkoenig134 Jul 12, 2024
def17f7
fix: add import
jkoenig134 Jul 12, 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
9 changes: 9 additions & 0 deletions .dev/appsettings.override.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
}
}
}
},
"Application": {
"didDomainName": "localhost"
}
},
"Files": {
Expand All @@ -69,6 +72,9 @@
"Provider": "Postgres",
"ConnectionString": "User ID=messages;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
}
},
"Application": {
"didDomainName": "localhost"
}
},
"Relationships": {
Expand All @@ -77,6 +83,9 @@
"Provider": "Postgres",
"ConnectionString": "User ID=relationships;Password=Passw0rd;Server=postgres;Port=5432;Database=enmeshed;"
}
},
"Application": {
"didDomainName": "localhost"
}
},
"Synchronization": {
Expand Down
2 changes: 1 addition & 1 deletion .dev/compose.backbone.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BACKBONE_VERSION=5.9.1
BACKBONE_VERSION=6.2.0
Magnus-Kuhn marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 0 additions & 15 deletions apps/enmeshed/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1054,21 +1054,6 @@
"Rejected": "Abgelehnte Kontaktanfrage",
"Revoked": "Zurückgezogene Kontaktanfrage"
},
"relationshipChange": {
"Accepted": "Akzeptierte Anfrage",
"Creation": "Eingehen einer Beziehung",
"Pending": "Offene Anfrage",
"Rejected": "Abgelehnte Anfrage",
"request": {
"name": "Anfrage zum Ändern einer Beziehung"
},
"response": {
"name": "Antwort zum Ändern einer Beziehung"
},
"Revoked": "Zurückgezogene Anfrage",
"Termination": "Auflösen einer Beziehung",
"TerminationCancellation": "Wiederaufnahme einer Beziehung"
},
"requestItem": {
"AuthenticationRequestItem": {
"name": "Hat eine Bestätigung angefordert"
Expand Down
15 changes: 0 additions & 15 deletions apps/enmeshed/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1054,21 +1054,6 @@
"Rejected": "Rejected contact request",
"Revoked": "Withdrawn contact request"
},
"relationshipChange": {
"Accepted": "Accepted relationship change",
"Creation": "Relationship Creation",
"Pending": "Pending relationship change",
"Rejected": "Rejected relationship change",
"request": {
"name": "Relationship Change Request"
},
"response": {
"name": "Relationship Change Response"
},
"Revoked": "Revoked relationship change",
"Termination": "Relationship Termination",
"TerminationCancellation": "Cancellation of Relationship Termination"
},
"requestItem": {
"AuthenticationRequestItem": {
"name": "Requested your authentication"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import 'transformers.dart';
class RelationshipsEndpoint extends Endpoint {
RelationshipsEndpoint(super.dio);

Future<ConnectorResponse<RelationshipDTO>> createRelationship({required String templateId, required Map<String, dynamic> content}) => post(
Future<ConnectorResponse<RelationshipDTO>> createRelationship({required String templateId, required Map<String, dynamic> creationContent}) => post(
'/api/v2/Relationships',
data: {
'templateId': templateId,
'content': content,
'content': creationContent,
},
transformer: relationshipTransformer,
);
Expand All @@ -25,25 +25,39 @@ class RelationshipsEndpoint extends Endpoint {
'/api/v2/Relationships/$relationshipId',
transformer: relationshipTransformer,
);
Future<ConnectorResponse<RelationshipDTO>> acceptRelationshipChange({
required String relationshipId,
required String changeId,
required Map<String, dynamic> content,
}) =>
put(
'/api/v2/Relationships/$relationshipId/Changes/$changeId/Accept',
data: {'content': content},

Future<ConnectorResponse<RelationshipDTO>> acceptRelationship(String relationshipId) => put(
'/api/v2/Relationships/$relationshipId/Accept',
transformer: relationshipTransformer,
);

Future<ConnectorResponse<RelationshipDTO>> rejectRelationship(String relationshipId) => put(
'/api/v2/Relationships/$relationshipId/Reject',
transformer: relationshipTransformer,
);

Future<ConnectorResponse<RelationshipDTO>> revokeRelationship(String relationshipId) => put(
'/api/v2/Relationships/$relationshipId/Revoke',
transformer: relationshipTransformer,
);

Future<ConnectorResponse<RelationshipDTO>> requestRelationshipReactivation(String relationshipId) => put(
'/api/v2/Relationships/$relationshipId/Reactivate',
transformer: relationshipTransformer,
);

Future<ConnectorResponse<RelationshipDTO>> acceptRelationshipReactivation(String relationshipId) => put(
'/api/v2/Relationships/$relationshipId/Reactivate/Accept',
transformer: relationshipTransformer,
);

Future<ConnectorResponse<RelationshipDTO>> rejectRelationshipReactivation(String relationshipId) => put(
'/api/v2/Relationships/$relationshipId/Reactivate/Reject',
transformer: relationshipTransformer,
);

Future<ConnectorResponse<RelationshipDTO>> rejectRelationshipChange({
required String relationshipId,
required String changeId,
required Map<String, dynamic> content,
}) =>
put(
'/api/v2/Relationships/$relationshipId/Changes/$changeId/Reject',
data: {'content': content},
Future<ConnectorResponse<RelationshipDTO>> revokeRelationshipReactivation(String relationshipId) => put(
'/api/v2/Relationships/$relationshipId/Reactivate/Revoke',
transformer: relationshipTransformer,
);

Expand Down
2 changes: 1 addition & 1 deletion packages/enmeshed_runtime_bridge/assets/index.js

Large diffs are not rendered by default.

Magnus-Kuhn marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,11 @@ void run(EnmeshedRuntime runtime) {
eventBus,
);

final query = ThirdPartyRelationshipAttributeQuery(key: 'aKey', owner: senderAddress, thirdParty: [thirdPartyAddress]);
final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.recipient,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down Expand Up @@ -1108,7 +1112,11 @@ void run(EnmeshedRuntime runtime) {
);

final receivedAttributeResult = await recipient.consumptionServices.attributes.executeThirdPartyRelationshipAttributeQuery(
query: ThirdPartyRelationshipAttributeQuery(key: 'website', owner: account1.address!, thirdParty: [account1.address!]),
query: ThirdPartyRelationshipAttributeQuery(
key: 'website',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [account1.address!],
),
);

expect(receivedAttributeResult, isSuccessful<List<LocalAttributeDTO>>());
Expand Down Expand Up @@ -1609,7 +1617,11 @@ void run(EnmeshedRuntime runtime) {
final senderOwnSharedRelationshipAttribute =
(await sender.consumptionServices.attributes.getAttribute(attributeId: thirdPartyOwnSharedRelationshipAttribute.id)).value;

final query = ThirdPartyRelationshipAttributeQuery(key: 'aKey', owner: thirdPartyAddress, thirdParty: [thirdPartyAddress]);
final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down Expand Up @@ -1639,7 +1651,11 @@ void run(EnmeshedRuntime runtime) {
final senderOwnSharedRelationshipAttribute =
(await sender.consumptionServices.attributes.getAttribute(attributeId: thirdPartyOwnSharedRelationshipAttribute.id)).value;

final query = ThirdPartyRelationshipAttributeQuery(key: 'aKey', owner: thirdPartyAddress, thirdParty: [thirdPartyAddress]);
final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down Expand Up @@ -1672,7 +1688,11 @@ void run(EnmeshedRuntime runtime) {
final senderOwnSharedRelationshipAttribute =
(await sender.consumptionServices.attributes.getAttribute(attributeId: thirdPartyOwnSharedRelationshipAttribute.id)).value;

final query = ThirdPartyRelationshipAttributeQuery(key: 'aKey', owner: thirdPartyAddress, thirdParty: [thirdPartyAddress]);
final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down Expand Up @@ -1715,7 +1735,11 @@ void run(EnmeshedRuntime runtime) {
final senderOwnSharedRelationshipAttribute =
(await sender.consumptionServices.attributes.getAttribute(attributeId: thirdPartyOwnSharedRelationshipAttribute.id)).value;

final query = ThirdPartyRelationshipAttributeQuery(key: 'aKey', owner: thirdPartyAddress, thirdParty: [thirdPartyAddress]);
final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void run(EnmeshedRuntime runtime) {
final result = await recipient.consumptionServices.incomingRequests.canAccept(
params: DecideRequestParameters(requestId: rLocalRequest.id, items: [
AcceptReadAttributeRequestItemParametersWithNewAttribute(
newAttribute: IdentityAttribute(owner: account1.address!, value: const CityAttributeValue(value: 'aCity')),
newAttribute: IdentityAttribute(owner: account2.address!, value: const CityAttributeValue(value: 'aCity')),
),
]),
);
Expand All @@ -98,7 +98,7 @@ void run(EnmeshedRuntime runtime) {
final result = await recipient.consumptionServices.incomingRequests.accept(
params: DecideRequestParameters(requestId: rLocalRequest.id, items: [
AcceptReadAttributeRequestItemParametersWithNewAttribute(
newAttribute: IdentityAttribute(owner: account1.address!, value: const CityAttributeValue(value: 'aCity')),
newAttribute: IdentityAttribute(owner: account2.address!, value: const CityAttributeValue(value: 'aCity')),
),
]),
);
Expand Down Expand Up @@ -285,7 +285,7 @@ void run(EnmeshedRuntime runtime) {
final result = await recipient.consumptionServices.incomingRequests.canAccept(
params: DecideRequestParameters(requestId: rLocalRequest.id, items: [
AcceptReadAttributeRequestItemParametersWithNewAttribute(
newAttribute: IdentityAttribute(owner: account1.address!, value: const CityAttributeValue(value: 'aCity')),
newAttribute: IdentityAttribute(owner: account2.address!, value: const CityAttributeValue(value: 'aCity')),
),
]),
);
Expand All @@ -300,7 +300,7 @@ void run(EnmeshedRuntime runtime) {
final result = await recipient.consumptionServices.incomingRequests.accept(
params: DecideRequestParameters(requestId: rLocalRequest.id, items: [
AcceptReadAttributeRequestItemParametersWithNewAttribute(
newAttribute: IdentityAttribute(owner: account1.address!, value: const CityAttributeValue(value: 'aCity')),
newAttribute: IdentityAttribute(owner: account2.address!, value: const CityAttributeValue(value: 'aCity')),
),
]),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ void run(EnmeshedRuntime runtime) {
final identityInfoResult = await session.transportServices.account.getIdentityInfo();

expect(identityInfoResult, isSuccessful<GetIdentityInfoResponse>());
expect(identityInfoResult.value.address.length, lessThanOrEqualTo(36));
Magnus-Kuhn marked this conversation as resolved.
Show resolved Hide resolved
expect(identityInfoResult.value.address.length, greaterThanOrEqualTo(35));
expect(identityInfoResult.value.address, contains('id1'));
final regExp = RegExp(r'^did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}$');
expect(regExp.hasMatch(identityInfoResult.value.address), true);
expect(identityInfoResult.value.publicKey.length, equals(82));
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void run(EnmeshedRuntime runtime) {
});

group('Message errors', () {
const fakeAddress = 'id1PNvUP4jHD74qo6usnWNoaFGFf33MXZi6c';
const fakeAddress = 'did:e:a-domain:dids:fef1992c5e529adc413288';
test('should throw correct error for empty "to" in the Message', () async {
final result = await session1.transportServices.messages.sendMessage(
recipients: [fakeAddress],
Expand Down
Loading